Commit 04bec675 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

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.


svn:r8439
parent 083e9c2b
...@@ -22,6 +22,10 @@ Changes in version 0.1.2.2-alpha - 2006-??-?? ...@@ -22,6 +22,10 @@ Changes in version 0.1.2.2-alpha - 2006-??-??
- Fix a debug log message in eventdns to say "X resolved to Y" - Fix a debug log message in eventdns to say "X resolved to Y"
instead of "X resolved to X". 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 Changes in version 0.1.2.1-alpha - 2006-08-27
o Major features: o Major features:
- Add "eventdns" async dns library from Adam Langley, tweaked to - Add "eventdns" async dns library from Adam Langley, tweaked to
......
...@@ -92,7 +92,7 @@ N - DNS improvements ...@@ -92,7 +92,7 @@ N - DNS improvements
d - Autodetect whether DNS is broken in this way. d - Autodetect whether DNS is broken in this way.
- Don't ask reject *:* nodes for DNS unless client wants you to. - Don't ask reject *:* nodes for DNS unless client wants you to.
. Asynchronous DNS . Asynchronous DNS
- Document SearchDomains, ResolvConf options o Document and rename SearchDomains, ResolvConf options
D Make API closer to getaddrinfo() D Make API closer to getaddrinfo()
- Teach it to be able to listen for A and PTR requests to be processed. - 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) ] Interface should be set_request_listener(sock, cb); [ cb(request) ]
......
...@@ -630,6 +630,23 @@ as day 1 and Sunday as day 7. If \fBday\fR is given, each accounting ...@@ -630,6 +630,23 @@ as day 1 and Sunday as day 7. If \fBday\fR is given, each accounting
period runs from the time \fIHH:MM\fR each day to the same time on the 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 next day. All times are local, and given in 24-hour time. (Defaults to
"month 1 0:00".) "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 .SH DIRECTORY SERVER OPTIONS
.PP .PP
......
...@@ -58,7 +58,6 @@ static config_abbrev_t _option_abbrevs[] = { ...@@ -58,7 +58,6 @@ static config_abbrev_t _option_abbrevs[] = {
PLURAL(LongLivedPort), PLURAL(LongLivedPort),
PLURAL(HiddenServiceNode), PLURAL(HiddenServiceNode),
PLURAL(HiddenServiceExcludeNode), PLURAL(HiddenServiceExcludeNode),
PLURAL(Nameserver),
PLURAL(NumCpu), PLURAL(NumCpu),
PLURAL(RendNode), PLURAL(RendNode),
PLURAL(RendExcludeNode), PLURAL(RendExcludeNode),
...@@ -77,6 +76,8 @@ static config_abbrev_t _option_abbrevs[] = { ...@@ -77,6 +76,8 @@ static config_abbrev_t _option_abbrevs[] = {
{ "NumHelperNodes", "NumEntryGuards", 0, 0}, { "NumHelperNodes", "NumEntryGuards", 0, 0},
{ "UseEntryNodes", "UseEntryGuards", 0, 0}, { "UseEntryNodes", "UseEntryGuards", 0, 0},
{ "NumEntryNodes", "NumEntryGuards", 0, 0}, { "NumEntryNodes", "NumEntryGuards", 0, 0},
{ "ResolvConf", "ServerDNSResolvConfFile", 0, 1},
{ "SearchDomains", "ServerDNSSearchDomains", 0, 1},
{ NULL, NULL, 0, 0}, { NULL, NULL, 0, 0},
}; };
/* A list of state-file abbreviations, for compatibility. */ /* A list of state-file abbreviations, for compatibility. */
...@@ -216,13 +217,13 @@ static config_var_t _option_vars[] = { ...@@ -216,13 +217,13 @@ static config_var_t _option_vars[] = {
VAR("RendNodes", STRING, RendNodes, NULL), VAR("RendNodes", STRING, RendNodes, NULL),
VAR("RendPostPeriod", INTERVAL, RendPostPeriod, "1 hour"), VAR("RendPostPeriod", INTERVAL, RendPostPeriod, "1 hour"),
VAR("RephistTrackTime", INTERVAL, RephistTrackTime, "24 hours"), VAR("RephistTrackTime", INTERVAL, RephistTrackTime, "24 hours"),
VAR("ResolvConf", STRING, ResolvConf, NULL),
OBSOLETE("RouterFile"), OBSOLETE("RouterFile"),
VAR("RunAsDaemon", BOOL, RunAsDaemon, "0"), VAR("RunAsDaemon", BOOL, RunAsDaemon, "0"),
VAR("RunTesting", BOOL, RunTesting, "0"), VAR("RunTesting", BOOL, RunTesting, "0"),
VAR("SafeLogging", BOOL, SafeLogging, "1"), VAR("SafeLogging", BOOL, SafeLogging, "1"),
VAR("SafeSocks", BOOL, SafeSocks, "0"), 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("ShutdownWaitLength", INTERVAL, ShutdownWaitLength, "30 seconds"),
VAR("SocksListenAddress", LINELIST, SocksListenAddress, NULL), VAR("SocksListenAddress", LINELIST, SocksListenAddress, NULL),
VAR("SocksPolicy", LINELIST, SocksPolicy, NULL), VAR("SocksPolicy", LINELIST, SocksPolicy, NULL),
...@@ -2443,6 +2444,12 @@ options_validate(or_options_t *old_options, or_options_t *options, ...@@ -2443,6 +2444,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
if (options->UseEntryGuards && ! options->NumEntryGuards) if (options->UseEntryGuards && ! options->NumEntryGuards)
REJECT("Cannot enable UseEntryGuards with NumEntryGuards set to 0"); 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)) if (check_nickname_list(options->ExitNodes, "ExitNodes", msg))
return -1; return -1;
if (check_nickname_list(options->EntryNodes, "EntryNodes", msg)) if (check_nickname_list(options->EntryNodes, "EntryNodes", msg))
...@@ -2566,7 +2573,8 @@ options_transition_affects_workers(or_options_t *old_options, ...@@ -2566,7 +2573,8 @@ options_transition_affects_workers(or_options_t *old_options,
if (!opt_streq(old_options->DataDirectory, new_options->DataDirectory) || if (!opt_streq(old_options->DataDirectory, new_options->DataDirectory) ||
old_options->NumCpus != new_options->NumCpus || old_options->NumCpus != new_options->NumCpus ||
old_options->ORPort != new_options->ORPort || old_options->ORPort != new_options->ORPort ||
old_options->SearchDomains != new_options->SearchDomains || old_options->ServerDNSSearchDomains !=
new_options->ServerDNSSearchDomains ||
old_options->SafeLogging != new_options->SafeLogging || old_options->SafeLogging != new_options->SafeLogging ||
!config_lines_eq(old_options->Logs, new_options->Logs)) !config_lines_eq(old_options->Logs, new_options->Logs))
return 1; return 1;
......
...@@ -796,10 +796,9 @@ dns_cancel_pending_resolve(const char *address) ...@@ -796,10 +796,9 @@ dns_cancel_pending_resolve(const char *address)
} }
/** Helper: adds an entry to the DNS cache mapping <b>address</b> to the ipv4 /** 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}. * DNS_RESOLVE_{FAILED_TRANSIENT|FAILED_PERMANENT|SUCCEEDED}.
*
* DOCDOC args
**/ **/
static void static void
add_answer_to_cache(const char *address, int is_reverse, uint32_t addr, add_answer_to_cache(const char *address, int is_reverse, uint32_t addr,
...@@ -1136,7 +1135,7 @@ dnsworker_main(void *data) ...@@ -1136,7 +1135,7 @@ dnsworker_main(void *data)
int *fdarray = data; int *fdarray = data;
int fd; int fd;
int result; 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, /* log_fn(LOG_NOTICE,"After spawn: fdarray @%d has %d:%d", (int)fdarray,
* fdarray[0],fdarray[1]); */ * fdarray[0],fdarray[1]); */
...@@ -1375,9 +1374,9 @@ connection_dns_reached_eof(connection_t *conn) ...@@ -1375,9 +1374,9 @@ connection_dns_reached_eof(connection_t *conn)
/** Configure eventdns nameservers if force is true, or if the configuration /** Configure eventdns nameservers if force is true, or if the configuration
* has changed since the last time we called this function. On Unix, this * 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 * reads from options->ServerDNSResolvConfFile or /etc/resolv.conf; on
* from options->ResolvConf or the registry. Return 0 on success or -1 on * Windows, this reads from options->ServerDNSResolvConfFile or the registry.
* failure. */ * Return 0 on success or -1 on failure. */
static int static int
configure_nameservers(int force) configure_nameservers(int force)
{ {
...@@ -1385,7 +1384,7 @@ configure_nameservers(int force) ...@@ -1385,7 +1384,7 @@ configure_nameservers(int force)
const char *conf_fname; const char *conf_fname;
struct stat st; struct stat st;
options = get_options(); options = get_options();
conf_fname = options->ResolvConf; conf_fname = options->ServerDNSResolvConfFile;
#ifndef MS_WINDOWS #ifndef MS_WINDOWS
if (!conf_fname) if (!conf_fname)
conf_fname = "/etc/resolv.conf"; conf_fname = "/etc/resolv.conf";
...@@ -1433,7 +1432,7 @@ configure_nameservers(int force) ...@@ -1433,7 +1432,7 @@ configure_nameservers(int force)
if (eventdns_count_nameservers() == 0) { if (eventdns_count_nameservers() == 0) {
log_warn(LD_EXIT, "Unable to find any platform nameservers in " log_warn(LD_EXIT, "Unable to find any platform nameservers in "
"your Windows configuration. Perhaps you should list a " "your Windows configuration. Perhaps you should list a "
"ResolvConf file in your torrc?"); "ServerDNSResolvConfFile file in your torrc?");
return -1; return -1;
} }
if (nameservers_configured) if (nameservers_configured)
...@@ -1507,7 +1506,7 @@ launch_resolve(edge_connection_t *exitconn) ...@@ -1507,7 +1506,7 @@ launch_resolve(edge_connection_t *exitconn)
char *addr = tor_strdup(exitconn->_base.address); char *addr = tor_strdup(exitconn->_base.address);
struct in_addr in; struct in_addr in;
int r; 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. */ /* What? Nameservers not configured? Sounds like a bug. */
if (!nameservers_configured) { if (!nameservers_configured) {
log_warn(LD_EXIT, "Harmless bug: nameservers not configured, but resolve " log_warn(LD_EXIT, "Harmless bug: nameservers not configured, but resolve "
......
...@@ -1571,12 +1571,12 @@ typedef struct { ...@@ -1571,12 +1571,12 @@ typedef struct {
char *VirtualAddrNetwork; /**< Address and mask to hand out for virtual char *VirtualAddrNetwork; /**< Address and mask to hand out for virtual
* MAPADDRESS requests. */ * MAPADDRESS requests. */
int SearchDomains; /**< Boolean: If set, we don't force exit addresses to int ServerDNSSearchDomains; /**< Boolean: If set, we don't force exit
* be FQDNs, but rather search for them in the local * addresses to be FQDNs, but rather search for them in
* domains. */ * the local domains. */
char *ResolvConf; /**< If provided, we configure our internal resolver from char *ServerDNSResolvConfFile; /**< If provided, we configure our internal
* the file here rather than from /etc/resolv.conf (unix) * resolver from the file here rather than from
* or the registry (windows) */ * /etc/resolv.conf (unix) or the registry (windows) */
} or_options_t; } or_options_t;
/** Persistent state for an onion router, as saved to disk. */ /** Persistent state for an onion router, as saved to disk. */
......
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