NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/42405: libc: getaddrinfo() should perform T_A lookups before T_AAAA lookups



>Number:         42405
>Category:       lib
>Synopsis:       libc: getaddrinfo() should perform T_A lookups before T_AAAA 
>lookups
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 03 19:45:00 +0000 2009
>Originator:     Chuck Swiger
>Release:        5.0
>Organization:
PKIX
>Environment:
N/A
>Description:
From discussion on netbsd-users mailing list:

Trying to perform A lookups before you try AAAA lookups turns out to resolve 
almost all the problems users were experiencing with sites which do not support 
IPv6 well, and so this became the default behavior on FreeBSD.

See _dns_getaddrinfo() in 
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/net/getaddrinfo.c?rev=1.91 ; 
this change was made back in 2005.
>How-To-Repeat:
Use firefox to browse the web and go past popular sites which make use of 
ad-serving domains which do not handle IPv6 requests very well, and note delays 
in page rendering resulting from failing/dropped AAAA lookups.
>Fix:
Starting from 
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libc/net/getaddrinfo.c?rev=1.95

--- getaddrinfo.c~      2009-12-02 12:56:20.000000000 -0800
+++ getaddrinfo.c       2009-12-02 12:57:15.000000000 -0800
@@ -1321,16 +1321,16 @@

        switch (pai->ai_family) {
        case AF_UNSPEC:
-               /* prefer IPv6 */
+               /* prefer IPv4 */
                q.name = name;
                q.qclass = C_IN;
-               q.qtype = T_AAAA;
+               q.qtype = T_A;
                q.answer = buf->buf;
                q.anslen = sizeof(buf->buf);
                q.next = &q2;
                q2.name = name;
                q2.qclass = C_IN;
-               q2.qtype = T_A;
+               q2.qtype = T_AAAA;
                q2.answer = buf2->buf;
                q2.anslen = sizeof(buf2->buf);
                break;



Home | Main Index | Thread Index | Old Index