[or-cvs] r9475: Fail when we are unable to parse the nameserver configuratio (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Fri Feb 2 18:58:06 UTC 2007


Author: nickm
Date: 2007-02-02 13:58:04 -0500 (Fri, 02 Feb 2007)
New Revision: 9475

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/config.c
   tor/trunk/src/or/dns.c
   tor/trunk/src/or/or.h
Log:
 r12122 at Kushana:  nickm | 2007-02-02 10:41:39 -0500
 Fail when we are unable to parse the nameserver configuration.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r12122] on c95137ef-5f19-0410-b913-86e773d04f59

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-02-01 18:33:02 UTC (rev 9474)
+++ tor/trunk/ChangeLog	2007-02-02 18:58:04 UTC (rev 9475)
@@ -63,6 +63,7 @@
     - Handle TTL values correctly on reverse DNS lookups.
     - Stop using the reserved ac_cv namespace in our configure script.
     - Call stat() slightly less often; use fstat() when possible.
+    - Treat failure to parse resolv.conf as an error.
 
   o Major features:
     - Weight directory requests by advertised bandwidth. Now we can

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-02-01 18:33:02 UTC (rev 9474)
+++ tor/trunk/src/or/config.c	2007-02-02 18:58:04 UTC (rev 9475)
@@ -990,11 +990,13 @@
           inform_testing_reachability();
       }
       cpuworkers_rotate();
-      dns_reset();
+      if (dns_reset())
+        return -1;
     }
 #ifdef USE_EVENTDNS
     else {
-      dns_reset();
+      if (dns_reset())
+        return -1;
     }
 #endif
   }

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2007-02-01 18:33:02 UTC (rev 9474)
+++ tor/trunk/src/or/dns.c	2007-02-02 18:58:04 UTC (rev 9475)
@@ -222,8 +222,9 @@
   return 0;
 }
 
-/** Called when DNS-related options change (or may have changed) */
-void
+/** Called when DNS-related options change (or may have changed).  Returns -1
+ * on failure, 0 on success. */
+int
 dns_reset(void)
 {
 #ifdef USE_EVENTDNS
@@ -236,8 +237,7 @@
     resolv_conf_mtime = 0;
   } else {
     if (configure_nameservers(0) < 0)
-      /* XXXX012 */
-      return;
+      return -1;
   }
 #else
   dnsworkers_rotate();
@@ -322,7 +322,8 @@
     SMARTLIST_FOREACH(cached_resolve_pqueue, cached_resolve_t *, res,
       {
         /* XXXX012 The hash lookups here could be quite slow; remove them
-         * once we're happy. */
+         * once we're happy. (Leave them in for at least 0.1.2.7-alpha, so they
+         * get some testing.) -NM */
         if (res->state == CACHE_STATE_DONE) {
           cached_resolve_t *found = HT_FIND(cache_map, &cache_root, res);
           tor_assert(!found || found != res);

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-02-01 18:33:02 UTC (rev 9474)
+++ tor/trunk/src/or/or.h	2007-02-02 18:58:04 UTC (rev 9475)
@@ -2415,7 +2415,7 @@
 int connection_dns_finished_flushing(connection_t *conn);
 int connection_dns_reached_eof(connection_t *conn);
 int connection_dns_process_inbuf(connection_t *conn);
-void dns_reset(void);
+int dns_reset(void);
 void connection_dns_remove(edge_connection_t *conn);
 void assert_connection_edge_not_dns_pending(edge_connection_t *conn);
 void assert_all_pending_dns_resolves_ok(void);



More information about the tor-commits mailing list