File opal-server-flood.patch of Package opal
Index: opal-3.10.9/include/sip/sippdu.h
===================================================================
--- opal-3.10.9.orig/include/sip/sippdu.h
+++ opal-3.10.9/include/sip/sippdu.h
@@ -234,6 +234,7 @@ class SIPURLList : public std::list<SIPU
bool reversed = false
);
PString ToString() const;
+ friend ostream & operator<<(ostream & strm, const SIPURLList & urls);
};
Index: opal-3.10.9/src/sip/handlers.cxx
===================================================================
--- opal-3.10.9.orig/src/sip/handlers.cxx
+++ opal-3.10.9/src/sip/handlers.cxx
@@ -716,6 +716,7 @@ void SIPRegisterHandler::OnReceivedOK(SI
for (SIPURLList::iterator reply = replyContacts.begin(); reply != replyContacts.end(); ) {
if (reply->GetHostAddress() == externalAddress) {
externalAddress.MakeEmpty(); // Clear this so no further action taken
+ m_externalAddress.MakeEmpty();
++reply;
}
else if (std::find(requestedContacts.begin(), requestedContacts.end(), *reply) != requestedContacts.end())
@@ -749,27 +750,29 @@ void SIPRegisterHandler::OnReceivedOK(SI
return;
}
- // Remember (possibly new) NAT address
- m_externalAddress == externalAddress;
-
if (GetExpire() == 0) {
// If we had discovered we are behind NAT and had unregistered, re-REGISTER with new addresses
- PTRACE(2, "SIP\tRe-registering with NAT address " << externalAddress);
+ PTRACE(2, "SIP\tRe-registering NAT address change (" << m_contactAddresses << ") to " << externalAddress);
for (SIPURLList::iterator contact = m_contactAddresses.begin(); contact != m_contactAddresses.end(); ++contact)
contact->SetHostAddress(externalAddress);
+ m_contactAddresses.unique();
SetExpire(m_originalExpireTime);
}
else {
/* If we got here then we have done a successful register, but registrar indicated
that we are behind firewall. Unregister what we just registered */
- PTRACE(2, "SIP\tRemote indicated change of REGISTER Contact header required due to NAT");
for (SIPURLList::iterator contact = replyContacts.begin(); contact != replyContacts.end(); ++contact)
contact->GetFieldParameters().Remove("expires");
+ PTRACE(2, "SIP\tRemote indicated change of REGISTER Contact address(s) (" << replyContacts
+ << ") required due to NAT address " << externalAddress << ", previous=" << m_externalAddress);
m_contactAddresses = replyContacts;
SetExpire(0);
}
- SendRequest(previousState);
+ // Remember (possibly new) NAT address
+ m_externalAddress == externalAddress;
+
+ SendRequest(Refreshing);
SendStatus(SIP_PDU::Information_Trying, previousState);
}
Index: opal-3.10.9/src/sip/sippdu.cxx
===================================================================
--- opal-3.10.9.orig/src/sip/sippdu.cxx
+++ opal-3.10.9/src/sip/sippdu.cxx
@@ -691,8 +691,15 @@ bool SIPURLList::FromString(const PStrin
PString SIPURLList::ToString() const
{
PStringStream strm;
+ strm << *this;
+ return strm;
+}
+
+
+ostream & operator<<(ostream & strm, const SIPURLList & urls)
+{
bool outputCommas = false;
- for (const_iterator it = begin(); it != end(); ++it) {
+ for (SIPURLList::const_iterator it = urls.begin(); it != urls.end(); ++it) {
if (it->IsEmpty())
continue;