Roman Pišl <rpisl(a)seznam.cz> wrote:
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.
V5 - fixes failing test on Windows
Based on https://www.winehq.org/pipermail/wine-patches/2016-July/151919.html
Signed-off-by: Matthieu Nottale <matthieu.nottale(a)infinit.io> Signed-off-by: Roman Pišl <rpisl(a)seznam.cz>
Probably you shouldn't add someone's else sign-off without the author's agreement, or mention that you've got an explicit agreement from the patch author otherwise.
+#ifdef IPV6_V6ONLY + if (unixaf == AF_INET6) + { + int enable = 1; + int fd = get_sock_fd(ret, 0, NULL); + setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &enable, sizeof(enable)); + } +#endif
It's better to verify that get_sock_fd() succeded before using its result, and call release_sock_fd() at the end. -- Dmitry.