NetBSD-Users archive

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

Re: Resolver problems



Hi--

On Dec 2, 2009, at 12:13 PM, Ingolf Steinbach wrote:
> which configuration settings are necessary to avoid AAAA look-ups in
> general? v6 support has already been removed from my kernel -- no
> interface has a v6 address, but still every application which wants to
> resolve a name first asks for a AAAA record and requests the A record
> only after 15 seconds.

Unfortunately, you'll likely have to change libc, more specifically 
src/lib/libc/net/getaddrinfo.c _dns_getaddrinfo() to avoid generating AAAA 
queries.  Starting from 
http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/lib/libc/net/getaddrinfo.c?rev=1.95

--- getaddrinfo.c~      2009-12-02 12:53:02.000000000 -0800
+++ getaddrinfo.c       2009-12-02 12:54:18.000000000 -0800
@@ -1321,18 +1321,11 @@
 
        switch (pai->ai_family) {
        case AF_UNSPEC:
-               /* prefer IPv6 */
                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.answer = buf2->buf;
-               q2.anslen = sizeof(buf2->buf);
                break;
        case AF_INET:
                q.name = name;

A more reasonable compromise would be to perform IPv4 lookups first, and fall 
back to IPv6 lookups only when needed:

--- 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;

I can't think of a reason why sensible people would prefer IPv6 addresses over 
IPv4....

Regards,
-- 
-Chuck



Home | Main Index | Thread Index | Old Index