1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

A couple of places in sk_newlistener were using AF_INET6 even with NO_IPV6.

Correct them.

[originally from svn r6305]
This commit is contained in:
Ben Harris 2005-09-13 19:54:01 +00:00
parent 7a763b358d
commit 4598889284

View File

@ -691,7 +691,10 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
* into local reality. * into local reality.
*/ */
address_family = (address_family == ADDRTYPE_IPV4 ? AF_INET : address_family = (address_family == ADDRTYPE_IPV4 ? AF_INET :
address_family == ADDRTYPE_IPV6 ? AF_INET6 : AF_UNSPEC); #ifndef NO_IPV6
address_family == ADDRTYPE_IPV6 ? AF_INET6 :
#endif
AF_UNSPEC);
#ifndef NO_IPV6 #ifndef NO_IPV6
/* Let's default to IPv6. /* Let's default to IPv6.
@ -707,11 +710,13 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
*/ */
s = socket(address_family, SOCK_STREAM, 0); s = socket(address_family, SOCK_STREAM, 0);
#ifndef NO_IPV6
/* If the host doesn't support IPv6 try fallback to IPv4. */ /* If the host doesn't support IPv6 try fallback to IPv4. */
if (s < 0 && address_family == AF_INET6) { if (s < 0 && address_family == AF_INET6) {
address_family = AF_INET; address_family = AF_INET;
s = socket(address_family, SOCK_STREAM, 0); s = socket(address_family, SOCK_STREAM, 0);
} }
#endif
if (s < 0) { if (s < 0) {
ret->error = strerror(errno); ret->error = strerror(errno);