public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10128] New: __libc_res_nquery fails if one answer returns NOERROR and the other NOTIMP or FORMERR
@ 2009-05-04 22:49 aurelien at aurel32 dot net
  2009-05-05 14:49 ` [Bug libc/10128] " drepper at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: aurelien at aurel32 dot net @ 2009-05-04 22:49 UTC (permalink / raw)
  To: glibc-bugs

Now that the glibc send both IPv4 and IPv6 requests in parallel, name 
resolution does not work anymore on DNS servers returning *two answers*, but 
NOTIMP or FORMERR to the AAAA query and NOERROR on the A query. This is broken 
according to the RFC, but it seems a common mistake among broken DNS software.

The recent changes to switch back to single request mode in case of timeout 
does not work here (as both queries are answered), so I propose the following 
patch below to solve the issue:


2009-05-05  Aurelien Jarno  <aurelien@aurel32.net>

        * resolv/res_query.c (__libc_res_nquery): If one query returns NOTIMP
        or FORMERR and the other NOERROR, don't raise an error.

--- a/resolv/res_query.c
+++ b/resolv/res_query.c
@@ -289,6 +289,10 @@ __libc_res_nquery(res_state statp,
                        break;
                case FORMERR:
                case NOTIMP:
+                       if ((hp->rcode == NOERROR && ntohs (hp->ancount) != 0)
+                           || (hp2->rcode == NOERROR
+                               && ntohs (hp2->ancount) != 0))
+                               goto success;
                case REFUSED:
                default:
                        RES_SET_H_ERRNO(statp, NO_RECOVERY);

-- 
           Summary: __libc_res_nquery fails if one answer returns NOERROR
                    and the other NOTIMP or FORMERR
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: aurelien at aurel32 dot net
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=10128

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 5+ messages in thread
[parent not found: <bug-10128-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-06-30  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-04 22:49 [Bug libc/10128] New: __libc_res_nquery fails if one answer returns NOERROR and the other NOTIMP or FORMERR aurelien at aurel32 dot net
2009-05-05 14:49 ` [Bug libc/10128] " drepper at redhat dot com
2009-05-05 15:36 ` aurelien at aurel32 dot net
2009-05-09 16:12 ` drepper at redhat dot com
     [not found] <bug-10128-131@http.sourceware.org/bugzilla/>
2014-06-30  9:15 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).