Hello,

currently I am having some problems with the dns resolver in sofia-sip-1.12.10.
There are two nameservers configured in my system via resolv.conf. The first
one unfortunately responses with dns code 5(refused) to all requests, the second
one is working.

When sofia-sip tries to register its user agents at startup, the first dns 
server is used
to resolve the server name. The server refuses the request. Now the expected 
behaviour
should be a fallback to the second server. Unfortunately this never happens.

Of course its also a problem if the first server is working, and the second one 
responses
with that errorcode. In this case the system can work fine for 
hours/days/weeks, until
for example one request to the server is not responded and sofia sip falls back 
to
the second server. Sofia-sip will never recover from this error.

I looked into the code in sres.c and it seems that in case of network errors or 
timeouts
the nameserver is marked as unavailable internally for some time and the 
request is
resent to the next server. If the resolver got a response from nameserver and 
there
is an error while decoding, this is reported to the callback, but the server is 
not marked
as unavailable and the request is not resent to another server.

One way to fix this is to mark the server as temporarily unavailable as I did 
in the patch 
attached to this mail. The fix is working fine in my test environment.

Could anyone of the developers please have a look at it to verify that it does 
not break
anything else i did not see?

Best Regards,
Timo Bruhn





______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

diff -u -r -N sofia-sip-1.12.10/libsofia-sip-ua/sresolv/sres.c sofia-sip-1.12.10_dns/libsofia-sip-ua/sresolv/sres.c
--- sofia-sip-1.12.10/libsofia-sip-ua/sresolv/sres.c	2008-12-08 16:39:23.000000000 +0100
+++ sofia-sip-1.12.10_dns/libsofia-sip-ua/sresolv/sres.c	2009-09-18 09:34:36.000000000 +0200
@@ -580,6 +580,7 @@
 
 /** Internal errors */
 enum {
+  SRES_REFUSED_ERR = 254,  
   SRES_EDNS0_ERR = 255		/**< Server did not support EDNS. */
 };
 
@@ -3389,6 +3390,9 @@
 
   if (query == NULL)
     ;
+  else if (error == SRES_REFUSED_ERR) {
+      sres_resolver_report_error(res, socket, 13, NULL, 0, "");
+  }
   else if (error == SRES_EDNS0_ERR) {
     dns->dns_edns = edns_not_supported;
     assert(query->q_id);
@@ -3527,6 +3531,9 @@
 
   err = m->m_flags & SRES_HDR_RCODE;
 
+  if (err == SRES_AUTH_ERR)
+      return SRES_REFUSED_ERR;
+  
   if (m->m_ancount == 0 && err == 0)
     err = SRES_RECORD_ERR;
 
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to