[tor-commits] [tor/master] Initialize ipv{4, 6}_traffic_ok in entry_connection_new

nickm at torproject.org nickm at torproject.org
Sun Nov 18 23:48:21 UTC 2012


commit bfe8d829c2bcfe24e1bdfe616444f074fe0f549c
Author: Nick Mathewson <nickm at torproject.org>
Date:   Sun Nov 18 17:15:41 2012 -0500

    Initialize ipv{4,6}_traffic_ok in entry_connection_new
    
    This one is necessary for sending BEGIN cells with sane flags when
    self-testing a directory port.  All real entry connections were
    getting their ipv{4,6}_traffic_ok flags set from their listeners, and
    for begindir entry connections we didn't care, but for directory
    self-testing, we had a problem.
    
    Fixes at least one more case of 7493; if there are more lingering
    cases of 7493, this might fix them too.
    
    Bug not in any released version of Tor.
---
 src/or/connection.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/or/connection.c b/src/or/connection.c
index f9d8a6d..dbcfc41 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -281,6 +281,13 @@ entry_connection_new(int type, int socket_family)
   tor_assert(type == CONN_TYPE_AP);
   connection_init(time(NULL), ENTRY_TO_CONN(entry_conn), type, socket_family);
   entry_conn->socks_request = socks_request_new();
+  /* If this is coming from a listener, we'll set it up based on the listener
+   * in a little while.  Otherwise, we're doing this as a linked connection
+   * of some kind, and we should set it up here based on the socket family */
+  if (socket_family == AF_INET)
+    entry_conn->ipv4_traffic_ok = 1;
+  else if (socket_family == AF_INET6)
+    entry_conn->ipv6_traffic_ok = 1;
   return entry_conn;
 }
 





More information about the tor-commits mailing list