summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/config.c16
-rw-r--r--src/or/dns.c19
-rw-r--r--src/or/or.h12
3 files changed, 27 insertions, 20 deletions
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. */