This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/10083] New: IPV6 getaddrinfo and AI_ADDRCONFIG
- From: "spam at messir dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 19 Apr 2009 08:59:38 -0000
- Subject: [Bug libc/10083] New: IPV6 getaddrinfo and AI_ADDRCONFIG
- Reply-to: sourceware-bugzilla at sourceware dot org
Hello!
I've got ::1 address on my lo interface.
getaddrinfo fails with "Address family for hostname not supported" when I'm
trying to resolve "::1". This occurs only if I specify AI_ADDRCONFIG flag.
But if I specify any ipv6-address on real interface getaddrinfo will be
success(even if interface is down).
In same situation "127.0.0.1" address resolves successfully.
This code shows this behavior:
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
int main(void) {
struct addrinfo hints;
struct addrinfo *result;
char host[]="::1";
int s;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_NUMERICHOST|AI_PASSIVE|AI_ADDRCONFIG;
hints.ai_protocol = 0; /* Any protocol */
s = getaddrinfo(host, "1234", &hints, &result);
if ( s ) {
printf("getaddrinfo: %s\n", gai_strerror(s));
return 1; }
else {
printf("address resolved!\n"); }
return 0;
}
--
Summary: IPV6 getaddrinfo and AI_ADDRCONFIG
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper at redhat dot com
ReportedBy: spam at messir dot net
CC: glibc-bugs at sources dot redhat dot com
GCC build triplet: Compiled by GNU CC version 4.3.3.
GCC host triplet: i686 GNU/Linux
GCC target triplet: i686 GNU/Linux
http://sourceware.org/bugzilla/show_bug.cgi?id=10083
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.