getaddrinfo() should disregard link-local IPv6 addresses for AI_ADDRCONFIG purposes

Bug #762512 reported by Tore Anderson
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
eglibc (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

If the system is configured with link-local (and loopback) IPv6 addresses only, getaddrinfo() will look up AAAA records in DNS and return any results to the caller, even if the caller is specififying the AI_ADDRCONFIG hint.

This defeats the purpose of AI_ADDRCONFIG, as an IPv6-capable operating system (including Ubuntu) will automatically configure link-local IPv6 addresses on every interface.

RFC 2553 says the following about AI_ADDRCONFIG:

      - The AI_ADDRCONFIG flag specifies that a query for AAAA records
        should occur only if the node has at least one IPv6 source
        address configured and a query for A records should occur only
        if the node has at least one IPv4 source address configured.

While it does not mention link-local (or loopback) addresses specifically, it is obvious that its intended use is to allow an application to avoid getting addresses returned that cannot be used for communication. In that regard
link-local addresses are very similar to loopback addresses, in the sense that they're automatically configured on all hosts regardless of any external connectivity, and can not be used when communicating with the outside world. And, as it happens, loopback addresses are already disregarded by getaddrinfo() for AI_ADDRCONFIG (even for IPv4 loopback addresses). This is done in in sysdeps/unix/sysv/linux/check_pf.cl line 179, in make_request().

The current behaviour is causing problems for end users who happen to be in IPv4-only networks and are using DNS resolvers that do not correctly handle AAAA lookups (cf. bug #417757 - 317 comments so far). If getaddrinfo() had not considered the always-present link-local addresses as an indicator of connectivity to the IPv6 internet, the problematic AAAA lookups would have been suppressed and the users would not have experienced any problems.

The one-line patch is trivial. Please apply. For what it's worth, both Microsoft Windows and Mac OS X appear to disregard link-local IPv6 addresses for AI_ADDRCONFIG purposes, with no apparent ill effects.

Tore

Tags: patch
Revision history for this message
Tore Anderson (toreanderson) wrote :
tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in eglibc (Ubuntu):
status: New → Confirmed
Revision history for this message
Pavel Šimerda (pavlix-a) wrote :

Upstream bug report:

sourceware.org/bugzilla/show_bug.cgi?id=12377

More information:

https://fedoraproject.org/wiki/Networking/NameResolution/ADDRCONFIG

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.