getaddrinfo() should disregard link-local IPv6 addresses for AI_ADDRCONFIG purposes
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/
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: | added: patch |
Status changed to 'Confirmed' because the bug affects multiple users.