[or-cvs] r6974: Export and use eventdns_config_windows_nameservers(); clean (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Fri Aug 4 18:24:25 UTC 2006


Author: nickm
Date: 2006-08-04 14:24:25 -0400 (Fri, 04 Aug 2006)
New Revision: 6974

Modified:
   tor/trunk/
   tor/trunk/src/or/dns.c
   tor/trunk/src/or/eventdns.c
   tor/trunk/src/or/eventdns.h
Log:
 r7007 at Kushana:  nickm | 2006-08-03 09:58:30 -0700
 Export and use eventdns_config_windows_nameservers(); clean up some comments and log messages.



Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
   - 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:6997
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
   + 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7007
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950

Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c	2006-08-04 18:24:13 UTC (rev 6973)
+++ tor/trunk/src/or/dns.c	2006-08-04 18:24:25 UTC (rev 6974)
@@ -7,18 +7,16 @@
 
 /**
  * \file dns.c
- * \brief Implements a farm of 'DNS worker' threads or processes to
- * perform DNS lookups for onion routers and cache the results.
- * [This needs to be done in the background because of the lack of a
- * good, ubiquitous asynchronous DNS implementation.]
+ * \brief Implements a local cache for DNS results for Tor servers.
+ * We provide two asynchrounous backend implementations:
+ *   1) A farm of 'DNS worker' threads or processes to perform DNS lookups for
+ *      onion routers and cache the results.
+ *   2) A wrapper around Adam Langley's eventdns.c code, to send requests
+ *      to the nameservers asynchronously.
+ * (We can't just use gethostbyname() and friends because we really need to
+ * be nonblocking.)
  **/
 
-/* See
- * http://elvin.dstc.com/ListArchive/elvin-dev/archive/2001/09/msg00027.html
- * for some approaches to asynchronous dns. We will want to switch once one of
- * them becomes more commonly available.
- */
-
 #include "or.h"
 #include "../common/ht.h"
 #ifdef USE_EVENTDNS
@@ -166,19 +164,23 @@
     or_options_t *options = get_options();
     eventdns_set_log_fn(eventdns_log_cb);
     if (options->Nameservers && smartlist_len(options->Nameservers)) {
+      log_info(LD_EXIT, "Configuring nameservers from Tor configuration");
       SMARTLIST_FOREACH(options->Nameservers, const char *, ip,
         {
           struct in_addr in;
-          log_info(LD_EXIT, "Parsing /etc/resolv.conf");
           if (tor_inet_aton(ip, &in)) {
             log_info(LD_EXIT, "Adding nameserver '%s'", ip);
             eventdns_nameserver_add(in.s_addr);
           }
         });
     } else {
+#ifdef MS_WINDOWS
+      eventdns_config_windows_nameservers();
+#else
       log_info(LD_EXIT, "Parsing /etc/resolv.conf");
       eventdns_resolv_conf_parse(DNS_OPTION_NAMESERVERS|DNS_OPTION_MISC,
                                  "/etc/resolv.conf");
+#endif
     }
   }
 #endif

Modified: tor/trunk/src/or/eventdns.c
===================================================================
--- tor/trunk/src/or/eventdns.c	2006-08-04 18:24:13 UTC (rev 6973)
+++ tor/trunk/src/or/eventdns.c	2006-08-04 18:24:25 UTC (rev 6974)
@@ -1,10 +1,14 @@
 /* $Id$ */
 
-// Modified from agl's original; see CVS for more info.
-// Try to keep this re-mergeable by Adam.  Don't make it depend on Tor.
-// TODO:
-//   - Learn about nameservers on win32.
-//   - Support AAAA (?), A6, and PTR records.
+/* The original version of this module was written by Adam Langley; for
+ * a history of modifications, check out the subversion logs.
+ *
+ * When editiing this module, try to keep it re-mergeable by Adam.  Don't
+ * reformat the whitespace, add Tor dependencies, or so on.
+ *
+ * TODO:
+ *   - Support IPv6 and PTR records.
+ */
 
 /* Async DNS Library
  * Adam Langley <agl at imperialviolet.org>

Modified: tor/trunk/src/or/eventdns.h
===================================================================
--- tor/trunk/src/or/eventdns.h	2006-08-04 18:24:13 UTC (rev 6973)
+++ tor/trunk/src/or/eventdns.h	2006-08-04 18:24:25 UTC (rev 6974)
@@ -52,6 +52,9 @@
 int eventdns_nameserver_ip_add(const char *ip_as_string);
 int eventdns_resolve(const char *name, int flags, eventdns_callback_type callback, void *ptr);
 int eventdns_resolv_conf_parse(int flags, const char *);
+#ifdef MS_WINDOWS
+int eventdns_config_windows_nameservers(void);
+#endif
 void eventdns_search_clear(void);
 void eventdns_search_add(const char *domain);
 void eventdns_search_ndots_set(const int ndots);



More information about the tor-commits mailing list