18-Feb-2010 11:57 PM Per von Zweigbergk:
'getaddrinfo-test.c' was successfully uploaded
18-Feb-2010 11:57 PM Per von Zweigbergk:
Summary:
getaddrinfo() will sometimes fail to respond with IPv6 information
Steps to Reproduce:
1. Make sure to be on a machine with IPv6 connectivity as well as IPv4 connectivity, with a DNS server configured to respond with AAAA records for www.google.com. Not all are - by default, Google only provides AAAA records to DNS specifically requesting it. Setting up DNS via Hurricane Electric's nameserver at 2001:470:20::2 should acheive the desired result.
2. Flush the DirectoryServices cache using "dscacheutil -flushcache", and then immediately "telnet www.google.com 80". Close the connection after it has been established.
3. Force an AAAA (IPv6 address) lookup of www.google.com by issuing the command "ping6 www.google.com". You may abort the ping as soon as you see that it's performed the name resolution.
4. "telnet www.google.com 80" again. Close the connection after it has been established.
Expected results:
Both times, running telnet should connect to google via an IPv6 address.
Actual results:
At step 2 (the first time telnet is run), it is very likely that only the IPv4 addresses of www.google.com will be returned to telnet.
Regression:
Mac OS X 10.5.6 seems not to be affected by this bug, in casual testing.
Notes:
I (and others before me) have tracked this down to somewhere past getaddrinfo() - so it's an OS bug, not a problem with telnet. Other applications are also affected. I first noticed this when running tcpdump to ensure that I am, in fact, getting Google over IPv6 with Safari and Firefox.
I have submitted a demo tool in C which will simply query getaddrinfo() and return the information it returns, to verify that the information it returns is in fact the cause of the exhibited behaviour. This tool may be built simply using gcc and requires no linking with any libraries beyond the standard library, and should build on other platforms as well. (I have tested it on Linux.)
Others have discussed this bug as well, as per http://lists.apple.com/archives/Ipv6-dev/2009/Oct/msg00057.html for example - suggests that this may be a race condition.