View | Details | Raw Unified | Return to bug 1648 | Differences between
and this patch

Collapse All | Expand All

(-)channels.c (-7 / +4 lines)
Lines 2577-2582 channel_setup_fwd_listener(int type, con Link Here
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);
Lines 3108-3120 x11_create_display_inet(int x11_display_ Link Here
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) {
(-)misc.c (+11 lines)
Lines 849-851 ms_to_timeval(struct timeval *tv, int ms Link Here
849
	tv->tv_usec = (ms % 1000) * 1000;
849
	tv->tv_usec = (ms % 1000) * 1000;
850
}
850
}
851
851
852
void
853
sock_set_v6only(int s)
854
{
855
#ifdef IPV6_V6ONLY
856
	int on = 1;
857
858
	debug3("%s: set socket %d IPV6_V6ONLY", __func__, s);
859
	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
860
		error("setsockopt IPV6_V6ONLY: %s", strerror(errno));
861
#endif
862
}
(-)misc.h (+1 lines)
Lines 35-40 char *tohex(const void *, size_t); Link Here
35
void	 sanitise_stdfd(void);
35
void	 sanitise_stdfd(void);
36
void	 ms_subtract_diff(struct timeval *, int *);
36
void	 ms_subtract_diff(struct timeval *, int *);
37
void	 ms_to_timeval(struct timeval *, int);
37
void	 ms_to_timeval(struct timeval *, int);
38
void	 sock_set_v6only(int);
38
39
39
struct passwd *pwcopy(struct passwd *);
40
struct passwd *pwcopy(struct passwd *);
40
const char *ssh_gai_strerror(int);
41
const char *ssh_gai_strerror(int);
(-)sshd.c (-8 / +2 lines)
Lines 979-993 server_listen(void) Link Here
979
		    &on, sizeof(on)) == -1)
979
		    &on, sizeof(on)) == -1)
980
			error("setsockopt SO_REUSEADDR: %s", strerror(errno));
980
			error("setsockopt SO_REUSEADDR: %s", strerror(errno));
981
981
982
#ifdef IPV6_V6ONLY
983
		/* Only communicate in IPv6 over AF_INET6 sockets. */
982
		/* Only communicate in IPv6 over AF_INET6 sockets. */
984
		if (ai->ai_family == AF_INET6) {
983
		if (ai->ai_family == AF_INET6)
985
			if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY,
984
			sock_set_v6only(listen_sock);
986
			    &on, sizeof(on)) == -1)
987
				error("setsockopt IPV6_V6ONLY: %s",
988
				    strerror(errno));
989
		}
990
#endif
991
985
992
		debug("Bind to port %s on %s.", strport, ntop);
986
		debug("Bind to port %s on %s.", strport, ntop);
993
987

Return to bug 1648