diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/channels.c b/channels.c index e8b8aa07e..22e7f628b 100644 --- a/channels.c +++ b/channels.c | |||
@@ -2577,6 +2577,8 @@ channel_setup_fwd_listener(int type, const char *listen_addr, | |||
2577 | } | 2577 | } |
2578 | 2578 | ||
2579 | channel_set_reuseaddr(sock); | 2579 | channel_set_reuseaddr(sock); |
2580 | if (ai->ai_family == AF_INET6) | ||
2581 | sock_set_v6only(sock); | ||
2580 | 2582 | ||
2581 | debug("Local forwarding listening on %s port %s.", | 2583 | debug("Local forwarding listening on %s port %s.", |
2582 | ntop, strport); | 2584 | ntop, strport); |
@@ -3108,13 +3110,8 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost, | |||
3108 | continue; | 3110 | continue; |
3109 | } | 3111 | } |
3110 | } | 3112 | } |
3111 | #ifdef IPV6_V6ONLY | 3113 | if (ai->ai_family == AF_INET6) |
3112 | if (ai->ai_family == AF_INET6) { | 3114 | sock_set_v6only(sock); |
3113 | int on = 1; | ||
3114 | if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) | ||
3115 | error("setsockopt IPV6_V6ONLY: %.100s", strerror(errno)); | ||
3116 | } | ||
3117 | #endif | ||
3118 | if (x11_use_localhost) | 3115 | if (x11_use_localhost) |
3119 | channel_set_reuseaddr(sock); | 3116 | channel_set_reuseaddr(sock); |
3120 | if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { | 3117 | if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { |