r11646@Kushana: nickm | 2006-12-19 14:40:38 -0500

Resolve bug 363: do not fall back to 127.0.0.1 when no nameservers are configured.  Instead, have the admin fix resolv.conf or configure a nameserver.


svn:r9157
This commit is contained in:
Nick Mathewson 2006-12-19 19:49:03 +00:00
parent bf6702cf8b
commit baadf35c63
5 changed files with 13 additions and 4 deletions

View File

@ -67,6 +67,10 @@ Changes in version 0.1.2.5-xxxx - 200?-??-??
- Remove an artificial (but quite high) restriction on expected
bandwidth, so that accounting won't break once we all have gigabit
connections to our homes.
- When running as a server, don't fall back to 127.0.0.1 when
no nameservers are configured in /etc/resolv.conf; instead, make
the user fix resolv.conf or specify nameservers explicitly. (Resolves
Bug 363.)
o Controller features:
- Have GETINFO dir/status/* work on hosts with DirPort disabled.

View File

@ -104,7 +104,7 @@ d - Be a DNS proxy.
o add a config option to turn it off.
- Bug 364: notice when all the DNS requests we get back (including a few
well-known sites) are all going to the same place.
- Bug 363: Warn and die if we can't find a nameserver and we're running a
o Bug 363: Warn and die if we can't find a nameserver and we're running a
server; don't fall back to 127.0.0.1.
? - maybe re-check dns when we change IP addresses, rather than
every 12 hours?

View File

@ -1465,8 +1465,11 @@ configure_nameservers(int force)
evdns_clear_nameservers_and_suspend();
}
log_info(LD_EXIT, "Parsing resolver configuration in '%s'", conf_fname);
if (evdns_resolv_conf_parse(DNS_OPTIONS_ALL, conf_fname))
if (evdns_resolv_conf_parse(DNS_OPTIONS_ALL, conf_fname)) {
log_warn(LD_EXIT, "Unable to parse '%s', or no nameservers in '%s'",
conf_fname, conf_fname);
return -1;
}
if (evdns_count_nameservers() == 0) {
log_warn(LD_EXIT, "Unable to find any nameservers in '%s'.", conf_fname);
return -1;

View File

@ -2499,7 +2499,7 @@ resolv_conf_parse_line(char *const start, int flags) {
char *const first_token = strtok_r(start, delims, &strtok_state);
if (!first_token) return;
if (!strcmp(first_token, "nameserver")) {
if (!strcmp(first_token, "nameserver") && (flags & DNS_OPTION_NAMESERVERS)) {
const char *const nameserver = NEXT_TOKEN;
struct in_addr ina;
@ -2579,7 +2579,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
if (fstat(fd, &st)) { err = 2; goto out1; }
if (!st.st_size) {
evdns_resolv_set_defaults(flags);
err = 0;
err = (flags & DNS_OPTION_NAMESERVERS) ? 6 : 0;
goto out1;
}
if (st.st_size > 65535) { err = 3; goto out1; } // no resolv.conf should be any bigger
@ -2608,6 +2608,7 @@ evdns_resolv_conf_parse(int flags, const char *const filename) {
if (!server_head && (flags & DNS_OPTION_NAMESERVERS)) {
// no nameservers were configured.
evdns_nameserver_ip_add("127.0.0.1");
err = 6;
}
if (flags & DNS_OPTION_SEARCH && (!global_search_state || global_search_state->num_domains == 0)) {
search_set_from_hostname();

View File

@ -187,6 +187,7 @@
* 3 file too large
* 4 out of memory
* 5 short read from file
* 6 no nameservers in file
*
* Internals:
*