[or-cvs] r13402: New config option ServerDNSAllowBrokenResolvConf to start a (tor/trunk/src/or)

arma at seul.org arma at seul.org
Wed Feb 6 12:46:17 UTC 2008


Author: arma
Date: 2008-02-06 07:46:17 -0500 (Wed, 06 Feb 2008)
New Revision: 13402

Modified:
   tor/trunk/src/or/config.c
   tor/trunk/src/or/dns.c
   tor/trunk/src/or/or.h
Log:
New config option ServerDNSAllowBrokenResolvConf to start a relay
even when the local resolv.conf file is missing, broken, or contains
only unusable nameservers.

Now I can run a local network on my laptop when I'm on an airplane.


Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2008-02-06 12:45:04 UTC (rev 13401)
+++ tor/trunk/src/or/config.c	2008-02-06 12:46:17 UTC (rev 13402)
@@ -265,6 +265,7 @@
   V(RunTesting,                  BOOL,     "0"),
   V(SafeLogging,                 BOOL,     "1"),
   V(SafeSocks,                   BOOL,     "0"),
+  V(ServerDNSAllowBrokenResolvConf, BOOL,  "0"),
   V(ServerDNSAllowNonRFC953Hostnames, BOOL,"0"),
   V(ServerDNSDetectHijacking,    BOOL,     "1"),
   V(ServerDNSResolvConfFile,     STRING,   NULL),
@@ -3252,7 +3253,7 @@
 
   if (options->V3AuthVoteDelay + options->V3AuthDistDelay >=
       options->V3AuthVotingInterval/2) {
-    REJECT("V3AuthVoteDelay and V3AuthDistDelay must be no more than half "
+    REJECT("V3AuthVoteDelay plus V3AuthDistDelay must be less than half "
            "V3AuthVotingInterval");
   }
   if (options->V3AuthVoteDelay < MIN_VOTE_SECONDS)

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2008-02-06 12:45:04 UTC (rev 13401)
+++ tor/trunk/src/or/dns.c	2008-02-06 12:46:17 UTC (rev 13402)
@@ -1108,7 +1108,7 @@
     if (stat(conf_fname, &st)) {
       log_warn(LD_EXIT, "Unable to stat resolver configuration in '%s': %s",
                conf_fname, strerror(errno));
-      return -1;
+      return options->ServerDNSAllowBrokenResolvConf ? 0 : -1;
     }
     if (!force && resolv_conf_fname && !strcmp(conf_fname,resolv_conf_fname)
         && st.st_mtime == resolv_conf_mtime) {
@@ -1123,11 +1123,11 @@
     if ((r = evdns_resolv_conf_parse(DNS_OPTIONS_ALL, conf_fname))) {
       log_warn(LD_EXIT, "Unable to parse '%s', or no nameservers in '%s' (%d)",
                conf_fname, conf_fname, r);
-      return -1;
+      return options->ServerDNSAllowBrokenResolvConf ? 0 : -1;
     }
     if (evdns_count_nameservers() == 0) {
       log_warn(LD_EXIT, "Unable to find any nameservers in '%s'.", conf_fname);
-      return -1;
+      return options->ServerDNSAllowBrokenResolvConf ? 0 : -1;
     }
     tor_free(resolv_conf_fname);
     resolv_conf_fname = tor_strdup(conf_fname);
@@ -1143,13 +1143,13 @@
     }
     if (evdns_config_windows_nameservers())  {
       log_warn(LD_EXIT,"Could not config nameservers.");
-      return -1;
+      return options->ServerDNSAllowBrokenResolvConf ? 0 : -1;
     }
     if (evdns_count_nameservers() == 0) {
       log_warn(LD_EXIT, "Unable to find any platform nameservers in "
                "your Windows configuration.  Perhaps you should list a "
                "ServerDNSResolvConfFile file in your torrc?");
-      return -1;
+      return options->ServerDNSAllowBrokenResolvConf ? 0 : -1;
     }
     if (nameservers_configured)
       evdns_resume();

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-02-06 12:45:04 UTC (rev 13401)
+++ tor/trunk/src/or/or.h	2008-02-06 12:46:17 UTC (rev 13402)
@@ -2291,6 +2291,10 @@
   char *ServerDNSResolvConfFile; /**< If provided, we configure our internal
                      * resolver from the file here rather than from
                      * /etc/resolv.conf (Unix) or the registry (Windows). */
+  /** Boolean: if set, we start even if our resolv.conf file is missing
+   * or broken. */
+  int ServerDNSAllowBrokenResolvConf;
+
   smartlist_t *ServerDNSTestAddresses; /**< A list of addresses that definitely
                                         * should be resolveable. Used for
                                         * testing our DNS server. */



More information about the tor-commits mailing list