Opened 12 years ago

Last modified 7 years ago

#617 closed defect (Fixed)

DNS bug: duplicate call to connection_mark_for_close at connection_edge.c

Reported by: jasemandude Owned by:
Priority: Low Milestone: 0.2.0.22-rc
Component: Core Tor/Tor Version: 0.2.0.20-rc
Severity: Keywords:
Cc: jasemandude, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Actually, I'm running 0.2.0.21-rc, not 0.2.0.20-rc

This occurs when tor is running and the modem connects to the ISP

In order to ensure dns requests aren't leaked, my resolv.conf is just
127.0.0.1
127.0.0.1
127.0.0.1

and named is set to forward any non-cached queries to port 9999, which tor is listening on for DNS queries.

Here's the debug output:

Mar 05 22:15:01.887 [info] evdns_server_callback(): Got a new DNS request!
Mar 05 22:15:01.887 [debug] connection_add(): new conn type Socks, socket -1, n_conns 23.
Mar 05 22:15:01.887 [info] evdns_server_callback(): Passing request for [scrubbed] to rewrite_and_attach.
Mar 05 22:15:01.887 [debug] connection_ap_handshake_rewrite_and_attach(): Client asked for [scrubbed]:0
Mar 05 22:15:01.887 [warn] Malformed IP "lb._dns-sd._udp.0.0.0.10.in-addr.arpa" in address pattern; rejecting.
Mar 05 22:15:01.887 [debug] connection_ap_handshake_attach_circuit(): Attaching apconn to circ 32257 (stream 0 sec old).
Mar 05 22:15:01.887 [info] exit (high-uptime) circ (length 3): GuyMontag(open) $4539E403341C5B7D7A7494127C12F7DFAEEB5952(open) croeso(open)
Mar 05 22:15:01.887 [debug] link_apconn_to_circ(): attaching new conn to circ. n_circ_id 32257.
Mar 05 22:15:01.887 [warn] Bug: Duplicate call to connection_mark_for_close at connection_edge.c:1504 (first at connection_edge.c:2015)
Mar 05 22:15:01.887 [info] evdns_server_callback(): Passed request for [scrubbed] to rewrite_and_attach.
Mar 05 22:15:01.887 [debug] conn_write_callback(): socket 18 wants to write.
Mar 05 22:15:01.887 [debug] conn_close_if_marked(): Cleaning up connection (fd -1).
Mar 05 22:15:01.887 [debug] connection_remove(): removing socket -1 (type Socks), n_conns now 23

[Automatically added by flyspray2trac: Operating System: OSX 10.5 Leopard]

Child Tickets

Change History (6)

comment:1 Changed 12 years ago by nickm

I can replicate this by running Tor with DNSPort 9999 and executing

dig @127.0.0.1 -p9999 -t ptr foo.10.10.10.10.in-addr.arpa

I see:

Mar 11 15:13:27.308 [warn] Malformed IP "foo.10.10.10.10.in-addr.arpa" in address pattern; rejecting.
Mar 11 15:13:27.489 [notice] Tor has successfully opened a circuit. Looks like client functionality is working.
Mar 11 15:13:27.489 [warn] Bug: Duplicate call to connection_mark_for_close at connection_edge.c:457 (first at connection_edge.c:2015)

This looks like two separate bugs. First, apparently addresses of the form *.int.int.int.int.in-addr.arpa are
not so nonexistent as Tor was assuming and therefore should probably be handled somehow. Second, the duplicate
close issue.

comment:2 Changed 12 years ago by nickm

WRT the duplicate mark-for-close issue, it looks like some callers of connection_ap_handshake_attach_circuit()
are unconditionally marking the connection if the function fails. However, it looks like some functions called by
connection_ap_handshake_attach_circuit() (including connection_ap_handshake_send_resolve [and possibly others, I'm
not sure yet]) will mark the connections too.

Need to review the code a little to see which part of this is the bug. It's also possible that the checking on the
address format should happen earlier, before we make the connection at all.

comment:3 Changed 12 years ago by nickm

It looks like the address in question is a zeroconf thing. So far as I know, it would actually be _bad_ to send this
off to a remote DNS server. Tor should continue to treat addresses of this form as automatically NXDOMAIN, but it
shouldn't be quite so loud about it.

comment:4 Changed 12 years ago by nickm

The double-mark should be fixed in 14066 and 14067.

comment:5 Changed 12 years ago by nickm

flyspray2trac: bug closed.

comment:6 Changed 7 years ago by nickm

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