Re: [reSIProcate] DnsResult blacklistLast,greylistLast question.
How's this look? Don't have the time to toss together a test-case
tonight, can look into it tomorrow.
Best regards,
Byron Campen
Index: resip/stack/DnsResult.cxx
===================================================================
--- resip/stack/DnsResult.cxx (revision 10796)
+++ resip/stack/DnsResult.cxx (working copy)
@@ -436,23 +436,26 @@
mark=mInterface.getMarkManager().getMarkType(tuple);
}
- if(mark!=TupleMarkManager::OK && (mInterface.isSupported(TCP,
V4) ||
- mInterface.isSupported(TCP, V6)))
+ if (!mInterface.getUdpOnlyOnNumeric())
{
- mTransport=TCP;
- mPort = getDefaultPort(mTransport,uri.port());
- tuple=Tuple(mTarget,mPort,mTransport,mTarget);
- mark=mInterface.getMarkManager().getMarkType(tuple);
+ if(mark!=TupleMarkManager::OK &&
(mInterface.isSupported(TCP, V4) ||
+ mInterface.isSupported(TCP, V6)))
+ {
+ mTransport=TCP;
+ mPort = getDefaultPort(mTransport,uri.port());
+ tuple=Tuple(mTarget,mPort,mTransport,mTarget);
+ mark=mInterface.getMarkManager().getMarkType(tuple);
+ }
+
+ if(mark!=TupleMarkManager::OK &&
(mInterface.isSupported(TLS, V4) ||
+ mInterface.isSupported(TLS, V6)))
+ {
+ mTransport=TLS;
+ mPort = getDefaultPort(mTransport,uri.port());
+ tuple=Tuple(mTarget,mPort,mTransport,mTarget);
+ mark=mInterface.getMarkManager().getMarkType(tuple);
+ }
}
-
- if(mark!=TupleMarkManager::OK && (mInterface.isSupported(TLS,
V4) ||
- mInterface.isSupported(TLS, V6)))
- {
- mTransport=TLS;
- mPort = getDefaultPort(mTransport,uri.port());
- tuple=Tuple(mTarget,mPort,mTransport,mTarget);
- mark=mInterface.getMarkManager().getMarkType(tuple);
- }
}
if(mark==TupleMarkManager::OK || mark==TupleMarkManager::GREY)
@@ -1479,3 +1482,5 @@
* <http://www.vovida.org/>.
*
*/
+
+// vim: softtabstop=3:shiftwidth=3:expandtab
Index: resip/stack/SipStack.hxx
===================================================================
--- resip/stack/SipStack.hxx (revision 10796)
+++ resip/stack/SipStack.hxx (working copy)
@@ -897,6 +897,16 @@
mTransactionController->setFixBadCSeqNumbers(pFixBadCSeqNumbers);
}
+ bool setUdpOnlyOnNumeric(bool value)
+ {
+ return
mTransactionController->transportSelector().setUdpOnlyOnNumeric(value);
+ }
+
+ bool getUdpOnlyOnNumeric() const
+ {
+ return
mTransactionController->transportSelector().getUdpOnlyOnNumeric();
+ }
+
/**
@todo should this be fixed to work with other applicable transports?
[]
@brief Used to enable/disable content-length checking on
datagram-based
Index: resip/stack/DnsInterface.hxx
===================================================================
--- resip/stack/DnsInterface.hxx (revision 10796)
+++ resip/stack/DnsInterface.hxx (working copy)
@@ -79,6 +79,17 @@
//virtual void handleDnsRaw(ExternalDnsRawResult);
TupleMarkManager& getMarkManager(){return mMarkManager;}
+ bool setUdpOnlyOnNumeric(bool value)
+ {
+ mUdpOnlyOnNumeric = value;
+ return mUdpOnlyOnNumeric;
+ }
+
+ bool getUdpOnlyOnNumeric() const
+ {
+ return mUdpOnlyOnNumeric;
+ }
+
protected:
// When complete or partial results are ready, call DnsHandler::process()
// For synchronous DnsInterface, set to 0
@@ -88,6 +99,9 @@
typedef std::vector<std::pair<TransportType, IpVersion> > TransportMap;
TransportMap mSupportedTransports;
//std::set<TransportType> mSupportedTransportTypes;
+ // Whether transport failover should be disabled on URIs with only a
numeric
+ // IP address (only UDP will ever be attempted).
+ bool mUdpOnlyOnNumeric;
//ExternalDns* mDnsProvider;
@@ -150,4 +164,5 @@
*
*/
+// vim: softtabstop=3:shiftwidth=3:expandtab
Index: resip/stack/DnsInterface.cxx
===================================================================
--- resip/stack/DnsInterface.cxx (revision 10796)
+++ resip/stack/DnsInterface.cxx (working copy)
@@ -33,7 +33,8 @@
#define RESIPROCATE_SUBSYSTEM resip::Subsystem::DNS
DnsInterface::DnsInterface(DnsStub& dnsStub) :
- mDnsStub(dnsStub)
+ mDnsStub(dnsStub),
+ mUdpOnlyOnNumeric(false)
{
#ifdef USE_DNS_VIP
Index: resip/stack/TransportSelector.hxx
===================================================================
--- resip/stack/TransportSelector.hxx (revision 10796)
+++ resip/stack/TransportSelector.hxx (working copy)
@@ -124,6 +124,16 @@
void terminateFlow(const resip::Tuple& flow);
void enableFlowTimer(const resip::Tuple& flow);
+ bool setUdpOnlyOnNumeric(bool value)
+ {
+ return mDns.setUdpOnlyOnNumeric(value);
+ }
+
+ bool getUdpOnlyOnNumeric() const
+ {
+ return mDns.getUdpOnlyOnNumeric();
+ }
+
void setCongestionManager(CongestionManager* manager)
{
for(TransportList::iterator i=mSharedProcessTransports.begin();
@@ -308,5 +318,6 @@
* Inc. For more information on Vovida Networks, Inc., please see
* <http://www.vovida.org/>.
*
- * vi: set shiftwidth=3 expandtab:
*/
+
+// vim: softtabstop=3:shiftwidth=3:expandtab