public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug network/14212] New: getaddrinfo() with multiple results from /etc/hosts and AF_INET6 in hints fails when /etc/hosts.conf:multi=off
@ 2012-06-09  5:15 vapier at gentoo dot org
  2013-04-15 13:11 ` [Bug network/14212] " siddhesh at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vapier at gentoo dot org @ 2012-06-09  5:15 UTC (permalink / raw)
  To: glibc-bugs

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug network/14212] getaddrinfo() with multiple results from /etc/hosts and AF_INET6 in hints fails when /etc/hosts.conf:multi=off
  2012-06-09  5:15 [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
@ 2013-04-15 13:11 ` siddhesh at redhat dot com
  2014-06-19 14:32 ` fweimer at redhat dot com
  2014-09-27  5:51 ` aoliva at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: siddhesh at redhat dot com @ 2013-04-15 13:11 UTC (permalink / raw)
  To: glibc-bugs

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

Siddhesh Poyarekar <siddhesh at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siddhesh at redhat dot com

--- Comment #1 from Siddhesh Poyarekar <siddhesh at redhat dot com> 2013-04-15 13:11:27 UTC ---
I cannot reproduce this with latest master.

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

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

$ ./a.out localhost
this is an IPv6 result
this is an IPv6 result
this is an IPv6 result

-- 
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug network/14212] getaddrinfo() with multiple results from /etc/hosts and AF_INET6 in hints fails when /etc/hosts.conf:multi=off
  2012-06-09  5:15 [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
  2013-04-15 13:11 ` [Bug network/14212] " siddhesh at redhat dot com
@ 2014-06-19 14:32 ` fweimer at redhat dot com
  2014-09-27  5:51 ` aoliva at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: fweimer at redhat dot com @ 2014-06-19 14:32 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug network/14212] getaddrinfo() with multiple results from /etc/hosts and AF_INET6 in hints fails when /etc/hosts.conf:multi=off
  2012-06-09  5:15 [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
  2013-04-15 13:11 ` [Bug network/14212] " siddhesh at redhat dot com
  2014-06-19 14:32 ` fweimer at redhat dot com
@ 2014-09-27  5:51 ` aoliva at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: aoliva at sourceware dot org @ 2014-09-27  5:51 UTC (permalink / raw)
  To: glibc-bugs

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

Alexandre Oliva <aoliva at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |aoliva at sourceware dot org
         Resolution|---                         |FIXED

--- Comment #2 from Alexandre Oliva <aoliva at sourceware dot org> ---
This was fixed, apparently by accident, with the patch for bug 14505, commit
8479f23aa1.  It disabled the use of the nss gethostbyname4 interface for
non-AF_UNSPEC queries.  Without the patch, we'd use gethostbyname4, get only
the
IPv4 address from the hosts plugin (because multi is off, and gethostbyname4
doesn't know what address family we're looking for), and discard that address
as unsuitable.  With the patch, we use gethostbyname2 to look up IPv6 addresses
only.  It doesn't perform V4MAPPED conversions, for the hconf flag that would
do so is explicitly cleared by getaddrinfo, that would look up IPv4 addresses
separately afterwards in case of no IPv6 matches.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-27  5:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-09  5:15 [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
2013-04-15 13:11 ` [Bug network/14212] " siddhesh at redhat dot com
2014-06-19 14:32 ` fweimer at redhat dot com
2014-09-27  5:51 ` aoliva at sourceware dot org

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).