[or-cvs] r9687: Try to fix eventdns bug 326 again, this time by noting that (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Wed Feb 28 20:24:24 UTC 2007


Author: nickm
Date: 2007-02-28 15:24:23 -0500 (Wed, 28 Feb 2007)
New Revision: 9687

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/eventdns.c
Log:
 r12000 at catbus:  nickm | 2007-02-28 15:12:21 -0500
 Try to fix eventdns bug 326 again, this time by noting that rcode 2 (serverfailed) does not really mean "The server is useless."



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12000] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-02-28 20:24:09 UTC (rev 9686)
+++ tor/trunk/ChangeLog	2007-02-28 20:24:23 UTC (rev 9687)
@@ -14,6 +14,10 @@
       to INT32_MAX.
     - Fix a potential race condition in the rpm installer.  Found by
       Stefan Nordhausen.
+    - Try to fix eventdns warnings once and for all: do not treat a dns rcode
+      of 2 as indicating that the server is completely bad; it sometimes
+      means that the server is just bad for the request in question. (may fix
+      the last of bug 326.)
 
 
 Changes in version 0.1.2.8-beta - 2007-02-26

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2007-02-28 20:24:09 UTC (rev 9686)
+++ tor/trunk/src/or/eventdns.c	2007-02-28 20:24:23 UTC (rev 9687)
@@ -696,7 +696,6 @@
 		}
 
 		switch(error) {
-		case DNS_ERR_SERVERFAILED:
 		case DNS_ERR_NOTIMPL:
 		case DNS_ERR_REFUSED:
 			// we regard these errors as marking a bad nameserver
@@ -708,6 +707,15 @@
 				if (!request_reissue(req)) return;
 			}
 			break;
+		case DNS_ERR_SERVERFAILED:
+			// rcode 2 (servfailed) sometimes means "we are broken" and
+			// sometimes (with some binds) means "that request was very
+			// confusing."  Treat this as a timeout, not a failure.
+			/*XXXX refactor the parts of */
+			log(EVDNS_LOG_DEBUG, "Got a SERVERFAILED from nameserver %s; "
+				"will allow the request to time out.",
+				debug_nota(req->ns->address));
+			break;
 		default:
 			// we got a good reply from the nameserver
 			nameserver_up(req->ns);
@@ -1876,9 +1884,9 @@
 	case 2:
 		// failed in some other way
 		retcode = 1;
-		// fall through
+		break;
 	default:
-		// all ok
+		// transmitted; we need to check for timeout.
 		log(EVDNS_LOG_DEBUG,
 			"Setting timeout for request %lx", (unsigned long) req);
 		evtimer_set(&req->timeout_event, evdns_request_timeout_callback, req);
@@ -1888,10 +1896,11 @@
 				(unsigned long) req);
 			// ???? Do more?
 		}
-		req->tx_count++;
-		req->transmit_me = 0;
-		return retcode;
 	}
+
+	req->tx_count++;
+	req->transmit_me = 0;
+	return retcode;
 }
 
 static void



More information about the tor-commits mailing list