Opened 11 years ago

Last modified 7 years ago

#868 closed defect (Duplicate)

DNS nameservers not correctly loaded in Windows XP

Reported by: TheJash Owned by:
Priority: High Milestone:
Component: Core Tor/Tor Version: 0.2.1.7-alpha
Severity: Keywords:
Cc: TheJash, nickm, coderman, knappo Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I think this bug might be related to:
http://bugs.noreply.org/flyspray/?do=details&id=813
However, here the problem is with dealing with bad nameservers from GetNetworkParams. When I started up Tor
on another network, it gave the following output and exited:

Nov 17 10:32:50.656 [notice] Parsing GEOIP file.
Nov 17 10:32:53.078 [info] eventdns: Added nameserver 196.1.106.65
Nov 17 10:32:53.078 [info] eventdns: Successfully added 65.106.1.196 as nameserver
Nov 17 10:32:53.078 [info] eventdns: Could not add nameserver 65.106.7.196 to list,error: 0
Nov 17 10:32:53.078 [info] eventdns: Didn't find nameservers in nt_key/"NameServer"
Nov 17 10:32:53.078 [info] eventdns: Didn't find nameservers in nt_key/"DhcpNameServer"
Nov 17 10:32:53.078 [info] eventdns: Didn't find nameservers in interfaces_key/"NameServer"
Nov 17 10:32:53.078 [info] eventdns: Didn't find nameservers in interfaces_key/"DhcpNameServer"
Nov 17 10:32:53.078 [warn] eventdns: Didn't find any nameservers.
Nov 17 10:32:53.078 [warn] Could not config nameservers.
Nov 17 10:32:53.078 [err] Error initializing dns subsystem; exiting

I think there are a few bugs here. First, evdns_config_windows_nameservers can fail even when there are valid
nameservers because load_nameservers_with_getnetworkparams will fail even when there are valid nameservers, which
causes load_nameservers_from_registry to be called, and there are no DNS settings in my registry (and that is probably
the case for most Windows users), which in turn causes the whole function to fail, and Tor to exit.

The second bug is that within load_nameservers_with_getnetworkparams, calls to evdns_nameserver_ip_add_line seem to
fail at the wrong time. I originally encountered the above error when testing on another network (that I cant get back
to), so while I was trying to reproduce the error, I ended up making my own IP_ADDR_STRING lists: (note that everything
from this point on was done on the HEAD revision of Tor. The previous error came from 2.1.6-alpha)

near the top of load_nameservers_with_getnetworkparams:

IP_ADDR_STRING addr1, addr2;
memcpy(addr1.IpAddress.String, "192.168.1.9\0", 12);
memcpy(addr2.IpAddress.String, "192.168.1.1\0", 12);
addr1.Next = &addr2;
addr2.Next = NULL;
ns = &addr1;

...later on in that function, I just commented out where ns was set normally, so it used the debug IP list:

assert(fixed);
added_any = 0;
ns = &(fixed->DnsServerList);
while (ns) {

...

In my network, 192.168.1.1 is the DNS server, and 192.168.1.9 does not exist. However, running the above test gives
this output:

Nov 17 14:33:31.227 [info] eventdns: Added nameserver 9.1.168.192
Nov 17 14:33:32.446 [info] eventdns: Successfully added 192.168.1.9 as nameserver
Nov 17 14:33:37.680 [info] eventdns: Could not add nameserver 192.168.1.1 to list,error: 0

Which is not right. Tor also fails if I reverse the order of the list (trying 192.168.1.1 before 192.168.1.9), with
this more logical output:

Nov 17 14:32:01.680 [info] eventdns: Added nameserver 1.1.168.192
Nov 17 14:32:04.118 [info] eventdns: Successfully added 192.168.1.1 as nameserver
Nov 17 14:32:19.915 [info] eventdns: Could not add nameserver 192.168.1.9 to list,error: 0

Sorry that I can't provide a patch, but I cant figure out what is causing evdns_nameserver_ip_add_line to fail at
the wrong time. Hopefully this information is helpful.

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (8)

comment:1 Changed 11 years ago by nickm

Looks a little like bug 813...

comment:2 Changed 11 years ago by nickm

The code currently in svn should generate better messages for the nameservers that fail, and tolerate partial success
better. It would be good to figure out _why_ the failing ones are failing, though.

comment:3 Changed 11 years ago by phobos

Try the win32 packages at:

http://moria.seul.org/~phobos/tor-0.2.1.7-alpha-dev-win32.exe and
http://moria.seul.org/~phobos/tor-0.2.1.7-alpha-dev-win32.exe.asc

These are based on r17477 and include Nick's code to generate better messages during nameserver failures.

comment:4 Changed 11 years ago by knappo

Could we perhabs merge/link this bug with bug #813 as it is essentially the same?

comment:5 Changed 11 years ago by phobos

Everyone should update 813 now.

comment:6 Changed 11 years ago by nickm

Closing as duplicate of 813; I believe we have 813 fixed, too: see discussion there.

comment:7 Changed 11 years ago by nickm

flyspray2trac: bug closed.

comment:8 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.