public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/10083] New: IPV6 getaddrinfo and AI_ADDRCONFIG
@ 2009-04-19  8:59 spam at messir dot net
  2009-04-19 20:59 ` [Bug libc/10083] " pasky at suse dot cz
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: spam at messir dot net @ 2009-04-19  8:59 UTC (permalink / raw)
  To: glibc-bugs

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.


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

end of thread, other threads:[~2009-04-21 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-19  8:59 [Bug libc/10083] New: IPV6 getaddrinfo and AI_ADDRCONFIG spam at messir dot net
2009-04-19 20:59 ` [Bug libc/10083] " pasky at suse dot cz
2009-04-20  9:09 ` spam at messir dot net
2009-04-20 22:08 ` pasky at suse dot cz
2009-04-21 11:51 ` spam at messir dot net
2009-04-21 20:02 ` pasky at suse dot cz

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