Commit a122bfb4 authored by Nick Mathewson's avatar Nick Mathewson 🐻
Browse files

r7007@Kushana: nickm | 2006-08-03 09:58:30 -0700

 Export and use eventdns_config_windows_nameservers(); clean up some comments and log messages.

parent 2299bbdb
......@@ -7,18 +7,16 @@ const char dns_c_id[] =
* \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
* 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"
......@@ -166,19 +164,23 @@ dns_init(void)
or_options_t *options = get_options();
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);
} else {
log_info(LD_EXIT, "Parsing /etc/resolv.conf");
/* $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.
* - Support IPv6 and PTR records.
/* Async DNS Library
* Adam Langley <>
......@@ -52,6 +52,9 @@ int eventdns_nameserver_add(unsigned long int address);
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 *);
int eventdns_config_windows_nameservers(void);
void eventdns_search_clear(void);
void eventdns_search_add(const char *domain);
void eventdns_search_ndots_set(const int ndots);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment