The code in ares_nit.c and get_iphlpapi_dns_info()
seems to ignore the 'zone index' for IPv6 DNS-addresesses.
Here is what GetAdaptersAddresses() returns for one of
my adapters (I have IPv6 installed):
Adapter name: {48FCE3FC-EC30-E50E-F1A7-71172AEEE3AE}
Unicast Addresses: fe80::5efe:10.0.0.6%2
Anycast Addresses: <none>
Multicast Addresses: <none>
DNS Servers: fec0:0:0:ffff::1%2
fec0:0:0:ffff::2%2
fec0:0:0:ffff::3%2
217.13.4.140
217.13.4.24
In get_iphlpapi_dns_info(), the output of GetAdaptersAddresses() is parsed:
else if( pGenericAddr->sa_family == AF_INET6 && left > ipv6_size )
{
/* Handle the v6 case */
struct sockaddr_in6 *pIPv6Addr = ( struct sockaddr_in6 * ) pGenericAddr;
ares_inet_ntop( AF_INET6, &pIPv6Addr->sin6_addr, ret, ipv6_size - 1 ); /* -1 for comma */
ares_inet_ntop() doesn't AFAICS grok the "%zone-index" syntax. Ref.
http://en.wikipedia.org/wiki/IPv6_address#Link-local_addresses_and_zone_indices
The end result will be that C-ares hangs "forever" trying to contact the DNS-servers
on such zoneless IPv6 non-global addresses.
I think the fix would be to use WSAAddressToString() instead of
ares_inet_ntop().
--gv
Received on 2011-10-11