This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/7060] New: getaddrinfo() with hints.ai_family = PF_UNSPEC changes behavior in glibc 2.9
- From: "bero at arklinux dot org" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 1 Dec 2008 14:10:30 -0000
- Subject: [Bug libc/7060] New: getaddrinfo() with hints.ai_family = PF_UNSPEC changes behavior in glibc 2.9
- Reply-to: sourceware-bugzilla at sourceware dot org
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.