aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2011-11-24 19:01:56 +0100
committerNick Mathewson <nickm@torproject.org>2011-11-30 11:55:46 -0500
commit529820f8baeaccc6efffde1d9b241eb9f11ce82f (patch)
tree106eb6b9c3c722f2f326a5ac784adcf1b1b4e118 /src/or/connection.c
parentf89c6196797a6a4b485b3a5eb8788e36eacd9819 (diff)
downloadtor-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.c5
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)) {