From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28031 invoked by alias); 27 Feb 2012 05:45:36 -0000 Received: (qmail 28020 invoked by uid 22791); 27 Feb 2012 05:45:33 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,SUBJ_OBFU_PUNCT_FEW X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 27 Feb 2012 05:45:20 +0000 From: "siddhesh at redhat dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug network/13760] New: [PATCH] Fix dns lookup for AF_UNSPEC when response for T_A exceeds buffer size Date: Mon, 27 Feb 2012 05:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: network X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: siddhesh at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00492.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=13760 Bug #: 13760 Summary: [PATCH] Fix dns lookup for AF_UNSPEC when response for T_A exceeds buffer size Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: network AssignedTo: unassigned@sourceware.org ReportedBy: siddhesh@redhat.com Classification: Unclassified When a dns lookup is made for a host that returns a large number of results for A (over 28 records in my test) and a finite number for AAAA, getaddrinfo ends up returning only the AAAA records. I have posted a patch on libc-alpha to fix this: http://sourceware.org/ml/libc-alpha/2012-02/msg00502.html An example DNS zone file that should trigger this problem: $TTL 86400 ; 24 hours could have been written as 24h or 1d $ORIGIN foo.net. @ 1D IN SOA ns1.foo.net. hostmaster.foo.net. ( 2002022401 ; serial 3H ; refresh 15 ; retry 1w ; expire 3h ; minimum ) IN NS ns1.foo.net. ; in the domain ; server host definitions ns1 IN A 192.168.0.1 ;name server definition ; non server domain hosts ad IN A 1.0.0.1 ad IN A 1.0.0.2 ad IN A 1.0.0.3 ad IN A 1.0.0.4 ad IN A 1.0.0.5 ad IN A 1.0.0.6 ad IN A 1.0.0.7 ad IN A 1.0.0.8 ad IN A 1.0.0.9 ad IN A 1.0.1.1 ad IN A 1.0.1.2 ad IN A 1.0.1.3 ad IN A 1.0.1.4 ad IN A 1.0.1.5 ad IN A 1.0.1.6 ad IN A 1.0.1.7 ad IN A 1.0.1.8 ad IN A 1.0.1.9 ad IN A 1.0.2.1 ad IN A 1.0.2.2 ad IN A 1.0.2.3 ad IN A 1.0.2.4 ad IN A 1.0.2.5 ad IN A 1.0.2.6 ad IN A 1.0.2.7 ad IN A 1.0.2.8 ad IN A 1.0.2.9 ad IN A 1.0.3.1 ad IN AAAA 2002:2003:dead::beef:f00d A simple lookup program returns just the IPv6 address and not the ipv4 addresses: #include #include #include #include #include int main(void) { struct addrinfo *result; struct addrinfo *res; int error; const char *domain = "ad.foo.net"; error = getaddrinfo(domain, NULL, NULL, &result); if (error != 0) { fprintf(stderr, "error in getaddrinfo: %s\n", gaistrerror(error)); return 1; } /* print the domain name */ printf("%s:\n", domain); /* loop over all returned results and print the addresses */ for (res = result; res != NULL; res = res->ainext) { void *addr; char address[64] = ""; if (res->aifamily == AFINET) { addr = &((struct sockaddrin *)(res->aiaddr))->sinaddr; } else if (res->aifamily == AFINET6) { addr = &((struct sockaddrin6 *)(res->aiaddr))->sin6addr; } inetntop(res->aiaddr->safamily, addr, address, 64); printf(" %s\n", address); } freeaddrinfo(result); return EXITSUCCESS; } $ ./a.out ad.foo.net: 2002:2003:dead::beef:f00d 2002:2003:dead::beef:f00d 2002:2003:dead::beef:f00d -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.