[Bug network/14212] New: getaddrinfo() with multiple results from /etc/hosts and AF_INET6 in hints fails when /etc/hosts.conf:multi=off

vapier at gentoo dot org sourceware-bugzilla@sourceware.org
Sat Jun 9 05:15:00 GMT 2012


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

             Bug #: 14212
           Summary: getaddrinfo() with multiple results from /etc/hosts
                    and AF_INET6 in hints fails when
                    /etc/hosts.conf:multi=off
           Product: glibc
           Version: 2.15
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
        AssignedTo: unassigned@sourceware.org
        ReportedBy: vapier@gentoo.org
    Classification: Unclassified


Created attachment 6444
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6444
getaddrinfo test

i have these /etc settings:

$ cat /etc/hosts
127.0.0.1   localhost
::1         localhost

$ cat /etc/host.conf 
order hosts, bind
multi off

trying to do getaddrinfo("localhost") when hints is just set to
ai_family=AF_INET6 fails with EAI_NODATA when it should have returned ::1

if i change multi on, then i get back ::1 as expected

if i also use ai_flags=AI_V4MAPPED, then multi off gives me ::ffff:127.0.0.1 --
which is correct, just pointing out that it seems to be matching the first
result and then aborting because the hints didn't line up

see attached code:
$ gcc getaddrinfo.c && ./a.out localhost

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Glibc-bugs mailing list