Red Hat Bugzilla – Bug 435563
Should getaddrinfo()'s AI_ADDRCONFIG flag ignore loopback interfaces?
Last modified: 2008-03-12 22:53:19 EDT
Description of problem:
On a host with IPV4-only interfaces, getaddrinfo() still returns AF_INET6
addresses even if the AI_ADDRCONFIG flag is specified.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Invoke getaddrinfo() to look up a hostname with both AF_INET and AF_INET6
addresses, on a host that has only IPv4 connectivity.
getaddrinfo() will return both IPv6 and IPv4 addresses.
Only IPv4 addresses should be returned.
This is because in Fedora, the loopback interface is set up with the IPv6
loopback address ::1, in addition to 127.0.0.1. As such, getaddrinfo() thinks
that the host has IPv6 connectivity. Essentially, the AI_ADDRCONFIG flag is
Given the intent of the AI_ADDRCONFIG flag, getaddrinfo() should skip loopback
interfaces, when evaluating the AI_ADDRCONFIG flag.
Loopback addresses are ignored for some time now.