diff options
author | Linus Nordberg <linus@nordberg.se> | 2011-11-24 19:01:56 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-11-30 11:55:46 -0500 |
commit | 529820f8baeaccc6efffde1d9b241eb9f11ce82f (patch) | |
tree | 106eb6b9c3c722f2f326a5ac784adcf1b1b4e118 /src/or/connection.c | |
parent | f89c6196797a6a4b485b3a5eb8788e36eacd9819 (diff) | |
download | tor-529820f8baeaccc6efffde1d9b241eb9f11ce82f.tar.gz tor-529820f8baeaccc6efffde1d9b241eb9f11ce82f.zip |
Use correct address family where necessary for bridges on IPv6.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index af8663eae8..7b95acac66 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)) { |