public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dj at redhat dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/26630] New: getaddrinfo drops ipv6 V4MAPPED addresses from ncsd results Date: Wed, 16 Sep 2020 20:57:31 +0000 [thread overview] Message-ID: <bug-26630-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=26630 Bug ID: 26630 Summary: getaddrinfo drops ipv6 V4MAPPED addresses from ncsd results Product: glibc Version: unspecified Status: NEW Severity: normal Priority: P2 Component: libc Assignee: unassigned at sourceware dot org Reporter: dj at redhat dot com CC: drepper.fsp at gmail dot com Target Milestone: --- Consider a set of DNS records like this: testv5c IN A 1.2.3.9 testv5c IN AAAA 2001:1234::8393 testv5c IN AAAA ::ffff:2.3.4.5 "getent ahosts testv5c" normally returns: 1.2.3.9 STREAM testv5c 1.2.3.9 DGRAM 1.2.3.9 RAW ::ffff:2.3.4.5 STREAM ::ffff:2.3.4.5 DGRAM ::ffff:2.3.4.5 RAW 2001:1234::8393 STREAM 2001:1234::8393 DGRAM 2001:1234::8393 RAW If NSCD is running, it instead returns: 1.2.3.9 STREAM testv5c 1.2.3.9 DGRAM 1.2.3.9 RAW 2001:1234::8393 STREAM 2001:1234::8393 DGRAM 2001:1234::8393 RAW While this seems (arguably) normal, if the second AAAA DNS entry is missing, only the IPv4 records are printed. If the *only* DNS response is a V4MAPPED address (i.e. ::ffff:*), getent will return nothing. The root cause of this is thus: * In sysdeps/posix/getaddrinfo.c around line 691, we are iterating on the list of addresses we got from nscd, and detect that we've gotten at least one valid IPv6 address, and set the "got_ipv6" flag[1]. * Around line 1035 we iterate over the list of addresses and discard any "V4MAPPED" addresses if we've seen any IPv6 addresses. The problem is, the IPv6 address we saw - and set the flag for - is the same address we're later discarding. If the test around line 691 adds a conditional on not being a V4-mapped address, the test case seems to work correctly, although the actual fix may be more complicated than that. Testing should include all eight permutations of address family availability (v4, v4mapped, v6) with and without nscd running. [1] Note this flag is also set around line 807, for non-nscd lookups, but does not seem to cause the same problem. Further investigation is warranted here. Originally reported at https://bugzilla.redhat.com/show_bug.cgi?id=901532 -- You are receiving this mail because: You are on the CC list for the bug.
reply other threads:[~2020-09-16 20:57 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-26630-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).