after recently enabling IPv6 on Windows XP I noticed that I couldn't
connect to some websites any more. I investigated the problem, and after a
little debugging, I noticed that all these sites were running IPv4-only web
servers but had both A and AAAA records in the DNS.
Further investigation showed that this only (and always) happened if the
hostname I tried to connect to was a CNAME.
Basically, fallback to IPv4 is broken for CNAMEs. This affects Windows XP
SP1 (with and without the Advanced Networking pack) and Windows 2003, but
not Windows 2000+IPv6.
This problem has already been reported by Fulvio Risso to this newsgroup in
May 2003, but without mentioning the CNAME issue:
http://groups.google.com/groups?threadm=d805a30b.0305150344.6d17fe60%40posting.google.com
I wrote two small test programs to see what was happening (source code
attached). Indeed, if I call getaddrinfo() on a CNAME which has both AAAA
and A records, only the AAAA record is returned, even if both are present:
> E:\>test-gai www.6net.org
> www.6net.org (godzilla.6net.org) => 2001:610:148:dead:210:18ff:fe02:e38
If i call getaddrinfo() to the hostname that the CNAME points to, both
addresses are returned.
> E:\>test-gai godzilla.6net.org
> godzilla.6net.org (godzilla.6net.org) => 2001:610:148:dead:210:18ff:fe02:e38
> godzilla.6net.org ((null)) => 192.87.30.6
So if an application follows the recommended procedure of calling
getaddrinfo once and looping over the results returned, fallback to IPv4
does not work. If the server is IPv4-only, no connection is possible.
As the problem also affects IE, it is really hurting IPv6 adoption.
Because of this, we can't just tell people to install IPv6 and try it out,
even if they already have an IPv6-enabled network, because if they do so
they will not be able to connect to some websites any more!
This looks like a bug to me. Is it a known issue? Is a fix in the works?
Regards,
Lorenzo Colitti
P.S. Note that this is not the same problem reported in Knowledge Base
article 815768, which is caused by broken DNS servers.
P.P.S. Also note that this is not a DNS misconfiguration. The DNS is
properly configured:
> E:\>nslookup -type=ANY www.6net.org
> [...]
> Non-authoritative answer:
> www.6net.org canonical name = godzilla.6net.org
>
> E:\>nslookup -type=ANY godzilla.6net.org
> [...]
> Non-authoritative answer:
> godzilla.6net.org internet address = 192.87.30.6
> godzilla.6net.org AAAA IPv6 address = 2001:610:148:dead:210:18ff:fe02:e38
--
---------------------------------------------------------
Lorenzo Colitti Ph.D student
Computer Networks research group Roma Tre University
---------------------------------------------------------
1. test-gai.c (which does AI_CANONNAME):
> #include <stdio.h>
> #include <winsock2.h>
> #include <ws2tcpip.h>
>
> int main(int argc, char * argv[]) {
> struct addrinfo *ai, *ai_orig, hints;
> char str[INET6_ADDRSTRLEN];
> unsigned long len;
> WSADATA wsadata;
>
> if (argc < 1) exit(1);
> WSAStartup(MAKEWORD(2,2), &wsadata);
>
> memset(&hints, 0, sizeof(hints));
> hints.ai_family = AF_UNSPEC;
> hints.ai_socktype = SOCK_STREAM;
> hints.ai_flags = AI_CANONNAME;
>
> getaddrinfo(argv[1], NULL, &hints, &ai);
> if(!ai) printf("Unknown host %s\n", argv[1]);
>
> ai_orig = ai;
> while(ai) {
> len = sizeof(str);
> WSAAddressToString(ai->ai_addr, ai->ai_addrlen, NULL, str, &len);
> printf("%s (%s) => %s\n", argv[1], ai->ai_canonname, str);
> ai = ai->ai_next;
> }
>
> if(ai_orig) freeaddrinfo(ai_orig);
> WSACleanup();
> }
2. test-gai-2.c (to see if the simplest possible case fails):
> #include <stdio.h>
> #include <winsock2.h>
> #include <ws2tcpip.h>
>
> int main(int argc, char * argv[]) {
> struct addrinfo *ai, *ai_orig;
> char str[INET6_ADDRSTRLEN];
> unsigned long len;
> WSADATA wsadata;
>
> if (argc < 1) exit(1);
> WSAStartup(MAKEWORD(2,2), &wsadata);
>
> getaddrinfo(argv[1], NULL, NULL, &ai);
> if(!ai) printf("Unknown host %s\n", argv[1]);
>
> ai_orig = ai;
> while(ai) {
> len = sizeof(str);
> WSAAddressToString(ai->ai_addr, ai->ai_addrlen, NULL, str, &len);
> printf("%s => %s\n", argv[1], str);
> ai = ai->ai_next;
> }
>
> if(ai_orig) freeaddrinfo(ai_orig);
> WSACleanup();
> }
Regards,
Lorenzo
Thanks for the detailed report. Reports like these are what help us
make the user experience better for everyone.
-Dave
--
* Windows XP IPv6 Frequently Asked Questions:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/winxppro/Plan/FAQIPV6.asp
* Windows Server 2003 IPv6 Frequently Asked Questions:
http://www.microsoft.com/windowsserver2003/technologies/ipv6/ipv6faq.mspx
* Windows 2000 Technology Preview FAQ:
http://msdn.microsoft.com/downloads/sdks/platform/tpipv6/faq.asp
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lorenzo Colitti" <colitt...@dia.uniroma3.it.NOSPAM> wrote in message
news:e3dAr3N...@TK2MSFTNGP10.phx.gbl...
Sure, no problem! It's in everybody's interest that things work well. :-)
For the benefit of folks on the newsgroup that have run into this problem,
I'd like to add that, until the fix comes out, a workaround is to disable
the DNS client service with "net stop dnscache".
This will probably lower performance if you don't have a fast connection to
your nameserver, but it does help if you're being bitten by this.
Cheers,
Lorenzo