[PATCH] ws2_32: Allow user to enable IP dual stack.
Matthieu Nottale
matthieu.nottale at infinit.io
Thu Jun 30 03:57:28 CDT 2016
IP dual stack (v4+v6) should be disabled by default, but previous code
was setting IPV6_V6ONLY in bind() which prevented user to override it.
This patch moves setting IPV6_V6ONLY to socket creation time.
Signed-off-by: Matthieu Nottale <matthieu.nottale at infinit.io>
---
dlls/ws2_32/socket.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index b0af3d7..4cea849 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3240,20 +3240,6 @@ int WINAPI WS_bind(SOCKET s, const struct
WS_sockaddr* name, int namelen)
}
else
{
-#ifdef IPV6_V6ONLY
- const struct sockaddr_in6 *in6 = (const struct
sockaddr_in6*) &uaddr;
- if (name->sa_family == WS_AF_INET6 &&
- !memcmp(&in6->sin6_addr, &in6addr_any,
sizeof(struct in6_addr)))
- {
- int enable = 1;
- if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
&enable, sizeof(enable)) == -1)
- {
- release_sock_fd( s, fd );
- SetLastError(WSAEAFNOSUPPORT);
- return SOCKET_ERROR;
- }
- }
-#endif
if (name->sa_family == WS_AF_INET)
{
struct sockaddr_in *in4 = (struct sockaddr_in*)
&uaddr;
@@ -7163,6 +7149,14 @@ SOCKET WINAPI WSASocketW(int af, int type, int
protocol,
TRACE("\tcreated %04lx\n", ret );
if (ipxptype > 0)
set_ipx_packettype(ret, ipxptype);
+#ifdef IPV6_V6ONLY
+ if (af == WS_AF_INET6)
+ {
+ // dual stack (v4+v6) should be disabled by default
+ int enable = 1;
+ WS_setsockopt(ret, WS_IPPROTO_IPV6, WS_IPV6_V6ONLY, &enable,
sizeof(enable));
+ }
+#endif
return ret;
}
--
2.5.0
More information about the wine-patches
mailing list