lifenjoiner 2 years ago committed by GitHub
parent c4930223e5
commit 5236e35965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/lib/ares_process.c

@ -979,6 +979,22 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
#endif
}
#if defined(IPV6_V6ONLY) && defined(WIN32)
/* It makes support for IPv4-mapped IPv6 addresses.
* Linux kernel, NetBSD, FreeBSD and Darwin: default is off;
* Windows Vista and later: default is on;
* DragonFly BSD: acts like off, and dummy setting;
* OpenBSD and earlier Windows: unsupported.
* Linux: controlled by /proc/sys/net/ipv6/bindv6only.
*/
static void set_ipv6_v6only(ares_socket_t sockfd, int on)
{
(void)setsockopt(sockfd, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(on));
}
#else
#define set_ipv6_v6only(s,v)
#endif
static int configure_socket(ares_socket_t s, int family, ares_channel channel)
{
union {
@ -1041,6 +1057,7 @@ static int configure_socket(ares_socket_t s, int family, ares_channel channel)
if (bind(s, &local.sa, sizeof(local.sa6)) < 0)
return -1;
}
set_ipv6_v6only(s, 0);
}
return 0;

Loading…
Cancel
Save