DNS nameservers not correctly loaded in Windows XP
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]
Trac:
Username: TheJash