[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

bug in address family checking?



xiando was discussing strange messages in the log of the form:
[warn] tor_addr_is_null(): Bug: Called with unknown address family XXX

where XXX is some unexpected value.

in tracing this down, it always appears after
connection_exit_begin_conn() when the DNS resolve returns immediately
(cached name) and connection_exit_connect() is invoked.

based on the order of calls, it appears that connection_init() is
setting conn->socket_family but is not setting conn->addr.family
(which is what tor_addr_is_null() is looking for).

attached is a very simply patch to set both in connection_init().
however, i do not know enough about Tor internals or the nature of the
IPv6 changes to know if this is the right fix, or if some other cause
is at fault.

best regards,
diff -Naur orig-tor/src/or/connection.c mod-tor/src/or/connection.c
--- orig-tor/src/or/connection.c	2008-12-18 17:19:04.459856000 +0000
+++ mod-tor/src/or/connection.c	2008-12-23 00:32:51.577993904 +0000
@@ -260,6 +260,7 @@
 
   conn->type = type;
   conn->socket_family = socket_family;
+  conn->addr.family = socket_family;
   if (!connection_is_listener(conn)) { /* listeners never use their buf */
     conn->inbuf = buf_new();
     conn->outbuf = buf_new();