commit 529820f8baeaccc6efffde1d9b241eb9f11ce82f Author: Linus Nordberg linus@nordberg.se Date: Thu Nov 24 19:01:56 2011 +0100
Use correct address family where necessary for bridges on IPv6. --- src/or/connection.c | 5 +++-- src/or/connection_edge.c | 4 ++-- src/or/connection_or.c | 2 +- src/or/directory.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/or/connection.c b/src/or/connection.c index af8663e..7b95aca 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -880,7 +880,8 @@ connection_create_listener(const struct sockaddr *listensockaddr, return NULL; }
- if (listensockaddr->sa_family == AF_INET) { + if (listensockaddr->sa_family == AF_INET || + listensockaddr->sa_family == AF_INET6) { int is_tcp = (type != CONN_TYPE_AP_DNS_LISTENER); if (is_tcp) start_reading = 1; @@ -890,7 +891,7 @@ connection_create_listener(const struct sockaddr *listensockaddr, log_notice(LD_NET, "Opening %s on %s:%d", conn_type_to_string(type), fmt_addr(&addr), usePort);
- s = tor_open_socket(PF_INET, + s = tor_open_socket(tor_addr_family(&addr), is_tcp ? SOCK_STREAM : SOCK_DGRAM, is_tcp ? IPPROTO_TCP: IPPROTO_UDP); if (!SOCKET_OK(s)) { diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index efaad79..ad0e8c5 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2593,7 +2593,7 @@ connection_ap_make_link(connection_t *partner, want_onehop ? "direct" : "anonymized", safe_str_client(address), port);
- conn = entry_connection_new(CONN_TYPE_AP, AF_INET); + conn = entry_connection_new(CONN_TYPE_AP, tor_addr_family(&partner->addr)); base_conn = ENTRY_TO_CONN(conn); base_conn->linked = 1; /* so that we can add it safely below. */
@@ -3199,7 +3199,7 @@ connection_exit_connect_dir(edge_connection_t *exitconn)
exitconn->_base.state = EXIT_CONN_STATE_OPEN;
- dirconn = dir_connection_new(AF_INET); + dirconn = dir_connection_new(tor_addr_family(&exitconn->_base.addr));
tor_addr_copy(&dirconn->_base.addr, &exitconn->_base.addr); dirconn->_base.port = 0; diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 771e889..24878bf 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -1036,7 +1036,7 @@ connection_or_connect(const tor_addr_t *_addr, uint16_t port, return NULL; }
- conn = or_connection_new(AF_INET); + conn = or_connection_new(tor_addr_family(&addr));
/* set up conn so it's got all the data we need to remember */ connection_or_init_conn_from_address(conn, &addr, port, id_digest, 1); diff --git a/src/or/directory.c b/src/or/directory.c index 43bef5c..65d8d95 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -919,7 +919,7 @@ directory_initiate_command_rend(const char *address, const tor_addr_t *_addr, return; }
- conn = dir_connection_new(AF_INET); + conn = dir_connection_new(tor_addr_family(&addr));
/* set up conn so it's got all the data we need to remember */ tor_addr_copy(&conn->_base.addr, &addr);
tor-commits@lists.torproject.org