[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8439: Rename and document SearchDomains and ResolvConf options; wa (in tor/trunk: . doc src/or)



Author: nickm
Date: 2006-09-21 17:48:16 -0400 (Thu, 21 Sep 2006)
New Revision: 8439

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/doc/tor.1.in
   tor/trunk/src/or/config.c
   tor/trunk/src/or/dns.c
   tor/trunk/src/or/or.h
Log:
 r8874@Kushana:  nickm | 2006-09-21 15:22:27 -0400
 Rename and document SearchDomains and ResolvConf options; warn if ServerDNSResolvConfFile is given but eventdns isnt enabled.



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

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/ChangeLog	2006-09-21 21:48:16 UTC (rev 8439)
@@ -22,6 +22,10 @@
     - Fix a debug log message in eventdns to say "X resolved to Y"
       instead of "X resolved to X".
 
+  o Documentation
+    - Documented (and renamed) ServerDNSSearchDomains and
+      ServerDNSResolvConfFile options.
+
 Changes in version 0.1.2.1-alpha - 2006-08-27
   o Major features:
     - Add "eventdns" async dns library from Adam Langley, tweaked to

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/doc/TODO	2006-09-21 21:48:16 UTC (rev 8439)
@@ -92,7 +92,7 @@
 d     - Autodetect whether DNS is broken in this way.
     - Don't ask reject *:* nodes for DNS unless client wants you to.
     . Asynchronous DNS
-      - Document SearchDomains, ResolvConf options
+      o Document and rename SearchDomains, ResolvConf options
       D Make API closer to getaddrinfo()
       - Teach it to be able to listen for A and PTR requests to be processed.
         Interface should be set_request_listener(sock, cb); [ cb(request) ]

Modified: tor/trunk/doc/tor.1.in
===================================================================
--- tor/trunk/doc/tor.1.in	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/doc/tor.1.in	2006-09-21 21:48:16 UTC (rev 8439)
@@ -630,6 +630,23 @@
 period runs from the time \fIHH:MM\fR each day to the same time on the
 next day.  All times are local, and given in 24-hour time.  (Defaults to
 "month 1 0:00".)
+.LP
+.TP
+\fBServerDNSResolvConfFile \fR\fIfilename\fP
+Overrides the default DNS configuration with the configuration in
+\fIfilename\fP.  The file format is the same as the standard Unix
+"\fBresolv.conf\fP" file (7).  This option only effects name lookup for
+addresses requested by clients; and only takes effect if Tor was built with
+eventdns support.  (Defaults to use the system DNS configuration.)
+.LP
+.TP
+\fBServerDNSSearchDomains \fR\fB0\fR|\fB1\fR\fP
+If set to \fB1\fP, then we will search for addresses in the local search
+domain.  For example, if this system is configured to believe it is in
+"example.com", and a client tries to connect to "www", the client will be
+connected to "www.example.com".
+This option only effects name lookup for addresses requested by clients.
+(Defaults to "0".)
 
 .SH DIRECTORY SERVER OPTIONS
 .PP

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/src/or/config.c	2006-09-21 21:48:16 UTC (rev 8439)
@@ -58,7 +58,6 @@
   PLURAL(LongLivedPort),
   PLURAL(HiddenServiceNode),
   PLURAL(HiddenServiceExcludeNode),
-  PLURAL(Nameserver),
   PLURAL(NumCpu),
   PLURAL(RendNode),
   PLURAL(RendExcludeNode),
@@ -77,6 +76,8 @@
   { "NumHelperNodes", "NumEntryGuards", 0, 0},
   { "UseEntryNodes", "UseEntryGuards", 0, 0},
   { "NumEntryNodes", "NumEntryGuards", 0, 0},
+  { "ResolvConf", "ServerDNSResolvConfFile", 0, 1},
+  { "SearchDomains", "ServerDNSSearchDomains", 0, 1},
   { NULL, NULL, 0, 0},
 };
 /* A list of state-file abbreviations, for compatibility. */
@@ -216,13 +217,13 @@
   VAR("RendNodes",           STRING,   RendNodes,            NULL),
   VAR("RendPostPeriod",      INTERVAL, RendPostPeriod,       "1 hour"),
   VAR("RephistTrackTime",    INTERVAL, RephistTrackTime,     "24 hours"),
-  VAR("ResolvConf",          STRING,   ResolvConf,           NULL),
   OBSOLETE("RouterFile"),
   VAR("RunAsDaemon",         BOOL,     RunAsDaemon,          "0"),
   VAR("RunTesting",          BOOL,     RunTesting,           "0"),
   VAR("SafeLogging",         BOOL,     SafeLogging,          "1"),
   VAR("SafeSocks",           BOOL,     SafeSocks,            "0"),
-  VAR("SearchDomains",       BOOL,     SearchDomains,        "0"),
+  VAR("ServerDNSResolvConfFile", STRING, ServerDNSResolvConfFile, NULL),
+  VAR("ServerDNSSearchDomains",  BOOL,   ServerDNSSearchDomains,  "0"),
   VAR("ShutdownWaitLength",  INTERVAL, ShutdownWaitLength,   "30 seconds"),
   VAR("SocksListenAddress",  LINELIST, SocksListenAddress,   NULL),
   VAR("SocksPolicy",         LINELIST, SocksPolicy,          NULL),
@@ -2443,6 +2444,12 @@
   if (options->UseEntryGuards && ! options->NumEntryGuards)
     REJECT("Cannot enable UseEntryGuards with NumEntryGuards set to 0");
 
+#ifndef USE_EVENTDNS
+  if (options->ServerDNSResolvConfFile)
+    log(LOG_WARN, LD_CONFIG,
+        "ServerDNSResolvConfFile only works when eventdns support is enabled.");
+#endif
+
   if (check_nickname_list(options->ExitNodes, "ExitNodes", msg))
     return -1;
   if (check_nickname_list(options->EntryNodes, "EntryNodes", msg))
@@ -2566,7 +2573,8 @@
   if (!opt_streq(old_options->DataDirectory, new_options->DataDirectory) ||
       old_options->NumCpus != new_options->NumCpus ||
       old_options->ORPort != new_options->ORPort ||
-      old_options->SearchDomains != new_options->SearchDomains ||
+      old_options->ServerDNSSearchDomains !=
+                                       new_options->ServerDNSSearchDomains ||
       old_options->SafeLogging != new_options->SafeLogging ||
       !config_lines_eq(old_options->Logs, new_options->Logs))
     return 1;

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/src/or/dns.c	2006-09-21 21:48:16 UTC (rev 8439)
@@ -796,10 +796,9 @@
 }
 
 /** Helper: adds an entry to the DNS cache mapping <b>address</b> to the ipv4
- * address <b>addr</b>.  <b>ttl</b> is a cache ttl; <b>outcome</b> is one of
+ * address <b>addr</b> (if is_reverse is 0) or the hostname <b>hostname</b> if
+ * (is_reverse is 1).  <b>ttl</b> is a cache ttl; <b>outcome</b> is one of
  * DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
- *
- * DOCDOC args
  **/
 static void
 add_answer_to_cache(const char *address, int is_reverse, uint32_t addr,
@@ -1136,7 +1135,7 @@
   int *fdarray = data;
   int fd;
   int result;
-  int search = get_options()->SearchDomains;
+  int search = get_options()->ServerDNSSearchDomains;
 
   /* log_fn(LOG_NOTICE,"After spawn: fdarray @%d has %d:%d", (int)fdarray,
    * fdarray[0],fdarray[1]); */
@@ -1375,9 +1374,9 @@
 
 /** Configure eventdns nameservers if force is true, or if the configuration
  * has changed since the last time we called this function.  On Unix, this
- * reads from options->ResolvConf or /etc/resolv.conf; on Windows, this reads
- * from options->ResolvConf or the registry.  Return 0 on success or -1 on
- * failure. */
+ * reads from options->ServerDNSResolvConfFile or /etc/resolv.conf; on
+ * Windows, this reads from options->ServerDNSResolvConfFile or the registry.
+ * Return 0 on success or -1 on failure. */
 static int
 configure_nameservers(int force)
 {
@@ -1385,7 +1384,7 @@
   const char *conf_fname;
   struct stat st;
   options = get_options();
-  conf_fname = options->ResolvConf;
+  conf_fname = options->ServerDNSResolvConfFile;
 #ifndef MS_WINDOWS
   if (!conf_fname)
     conf_fname = "/etc/resolv.conf";
@@ -1433,7 +1432,7 @@
     if (eventdns_count_nameservers() == 0) {
       log_warn(LD_EXIT, "Unable to find any platform nameservers in "
                "your Windows configuration.  Perhaps you should list a "
-               "ResolvConf file in your torrc?");
+               "ServerDNSResolvConfFile file in your torrc?");
       return -1;
     }
     if (nameservers_configured)
@@ -1507,7 +1506,7 @@
   char *addr = tor_strdup(exitconn->_base.address);
   struct in_addr in;
   int r;
-  int options = get_options()->SearchDomains ? 0 : DNS_QUERY_NO_SEARCH;
+  int options = get_options()->ServerDNSSearchDomains ? 0 : DNS_QUERY_NO_SEARCH;
   /* What? Nameservers not configured?  Sounds like a bug. */
   if (!nameservers_configured) {
     log_warn(LD_EXIT, "Harmless bug: nameservers not configured, but resolve "

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-09-21 21:48:11 UTC (rev 8438)
+++ tor/trunk/src/or/or.h	2006-09-21 21:48:16 UTC (rev 8439)
@@ -1571,12 +1571,12 @@
 
   char *VirtualAddrNetwork; /**< Address and mask to hand out for virtual
                              * MAPADDRESS requests. */
-  int SearchDomains; /**< Boolean: If set, we don't force exit addresses to
-                      * be FQDNs, but rather search for them in the local
-                      * domains. */
-  char *ResolvConf; /**< If provided, we configure our internal resolver from
-                     * the file here rather than from /etc/resolv.conf (unix)
-                     * or the registry (windows) */
+  int ServerDNSSearchDomains; /**< Boolean: If set, we don't force exit
+                      * addresses to be FQDNs, but rather search for them in
+                      * the local domains. */
+  char *ServerDNSResolvConfFile; /**< If provided, we configure our internal
+                     * resolver from the file here rather than from
+                     * /etc/resolv.conf (unix) or the registry (windows) */
 } or_options_t;
 
 /** Persistent state for an onion router, as saved to disk. */