public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/7060] New: getaddrinfo() with hints.ai_family = PF_UNSPEC changes behavior in glibc 2.9
@ 2008-12-01 14:11 bero at arklinux dot org
  2008-12-01 14:19 ` [Bug libc/7060] " bero at arklinux dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: bero at arklinux dot org @ 2008-12-01 14:11 UTC (permalink / raw)
  To: glibc-bugs

Up until glibc 2.8, this would work and return the IPv4 address:

struct addrinfo hints, *ai, *aitop;
int err;
char *host=strdup("www.google.com");
char *port=strdup("80");
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
err=getaddrinfo(host, port, &hints, &aitop);
if(err)
    fprintf(stderr, "Error: %s", strerror(err));


In glibc 2.9, it returns Error: Name or service not known
Changing hints.ai_family to PF_INET makes it work with glibc 2.9.

I'm not sure which behavior is correct, but 2.9's does break a few 
applications (ncftp for one).

This is on an IPv4 machine (with an IPv6 address for localhost set); 
nsswitch.conf has "hosts: files mdns dns"

-- 
           Summary: getaddrinfo() with hints.ai_family = PF_UNSPEC changes
                    behavior in glibc 2.9
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: bero at arklinux dot org
                CC: glibc-bugs at sources dot redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 13+ messages in thread
[parent not found: <bug-7060-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2020-07-28  7:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-01 14:11 [Bug libc/7060] New: getaddrinfo() with hints.ai_family = PF_UNSPEC changes behavior in glibc 2.9 bero at arklinux dot org
2008-12-01 14:19 ` [Bug libc/7060] " bero at arklinux dot org
2008-12-01 14:33 ` jakub at redhat dot com
2008-12-01 15:41 ` bero at arklinux dot org
2008-12-01 15:53 ` bero at arklinux dot org
2008-12-02 22:43 ` vapier at gentoo dot org
2008-12-03  7:44 ` jgc at archlinux dot org
2008-12-04  2:09 ` pasky at suse dot cz
2009-01-09  4:51 ` pasky at suse dot cz
2009-01-09  8:09 ` jakub at redhat dot com
2010-08-31 19:41 ` schwab at linux-m68k dot org
     [not found] <bug-7060-131@http.sourceware.org/bugzilla/>
2014-07-01 21:02 ` fweimer at redhat dot com
2020-07-28  7:02 ` meave390 at gmail dot com

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