summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-09-21 21:48:16 +0000
committerNick Mathewson <nickm@torproject.org>2006-09-21 21:48:16 +0000
commit04bec6757494a7ac3a798bde068abf151c8a8242 (patch)
treecf7decc1b32538de5585d53a618aaba34cc0b492
parent083e9c2b59614bd5dae78d5db2473ddbca9cb8c4 (diff)
downloadtor-04bec6757494a7ac3a798bde068abf151c8a8242.tar.gz
tor-04bec6757494a7ac3a798bde068abf151c8a8242.zip
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
-rw-r--r--ChangeLog4
-rw-r--r--doc/TODO2
-rw-r--r--doc/tor.1.in17
-rw-r--r--src/or/config.c16
-rw-r--r--src/or/dns.c19
-rw-r--r--src/or/or.h12
6 files changed, 49 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index cb70303812..a4757feb7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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"
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
diff --git a/doc/TODO b/doc/TODO
index 88708a0588..40dd1dd454 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -92,7 +92,7 @@ N - DNS improvements
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) ]
diff --git a/doc/tor.1.in b/doc/tor.1.in
index 8cbb69b50e..a162137c62 100644
--- a/doc/tor.1.in
+++ b/doc/tor.1.in
@@ -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
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
diff --git a/src/or/config.c b/src/or/config.c
index 3fc5f46c09..aaee949384 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -58,7 +58,6 @@ static config_abbrev_t _option_abbrevs[] = {
PLURAL(LongLivedPort),
PLURAL(HiddenServiceNode),
PLURAL(HiddenServiceExcludeNode),
- PLURAL(Nameserver),
PLURAL(NumCpu),
PLURAL(RendNode),
PLURAL(RendExcludeNode),
@@ -77,6 +76,8 @@ static config_abbrev_t _option_abbrevs[] = {
{ "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 @@ static config_var_t _option_vars[] = {
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 @@ options_validate(or_options_t *old_options, or_options_t *options,
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 @@ options_transition_affects_workers(or_options_t *old_options,
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;
diff --git a/src/or/dns.c b/src/or/dns.c
index f2ebc2e481..29255ad822 100644
--- a/src/or/dns.c
+++ b/src/or/dns.c
@@ -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
- * 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 @@ dnsworker_main(void *data)
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 @@ connection_dns_reached_eof(connection_t *conn)
/** 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 @@ configure_nameservers(int force)
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 @@ configure_nameservers(int force)
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 @@ launch_resolve(edge_connection_t *exitconn)
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 "
diff --git a/src/or/or.h b/src/or/or.h
index a24e8762f2..e1c63253e7 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1571,12 +1571,12 @@ typedef struct {
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. */