#21900: evdns fails when resolv.conf is missing, but succeeds when resolv.conf is empty -------------------------------------------------+------------------------- Reporter: teor | Owner: rl1987 Type: defect | Status: | accepted Priority: Medium | Milestone: Tor: | unspecified Component: Core Tor/Tor | Version: Severity: Normal | Resolution: Keywords: technical-debt, dns, crash, tor- | Actual Points: relay, macos, 032-unreached | Parent ID: | Points: 2 Reviewer: | Sponsor: -------------------------------------------------+-------------------------
Comment (by rl1987): To reproduce, run: {{{ src/app/tor -ORPort 4430 -ServerDNSResolvConfFile no_such_file -SOCKSPort 9053 -Log debug }}} and {{{ src/app/tor -ORPort 4430 -ServerDNSResolvConfFile /dev/null -SOCKSPort 9053 -Log debug }}} The latter yields (on my macOS system): {{{ Aug 13 17:07:34.000 [debug] configure_nameservers: stat()ing /dev/null Aug 13 17:07:34.000 [info] configure_nameservers: Parsing resolver configuration in '/dev/null' Aug 13 17:07:34.000 [info] eventdns: Parsing resolv.conf file /dev/null Aug 13 17:07:34.000 [info] eventdns: Added nameserver 127.0.0.1:53 as 0x7fa1201bc490 Aug 13 17:07:34.000 [warn] Unable to parse '/dev/null', or no nameservers in '/dev/null' (6) Aug 13 17:07:34.000 [info] mark_my_descriptor_dirty: Decided to publish new relay descriptor: dns resolvers failed Aug 13 17:07:34.000 [warn] Couldn't set up any working nameservers. Network not up yet? Will try again soon. }}} Note that empty resolv.conf is still treated as error condition - by libevent code, not by tor. Libevent also falls back to including 127.0.0.1 as default DNS server. See https://github.com/libevent/libevent/blob/master/evdns.c#L3649 So I suppose we should: * When resolv.conf is empty or non-existant: * Don't `goto err` * Add 127.0.0.1 to list of DNS servers. * Print a scary warning. * Mention the above behavior in manpage. -- Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21900#comment:9> Tor Bug Tracker & Wiki <https://trac.torproject.org/> The Tor Project: anonymity online
_______________________________________________ tor-bugs mailing list tor-bugs@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs