Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <lddjgi$jv9$1@ger.gmane.org>
Date: Tue, 11 Feb 2014 16:35:30 +0000 (UTC)
From: Clément Vasseur <clement.vasseur@...il.com>
To: musl@...ts.openwall.com
Subject: getaddrinfo behaviour with AI_V4MAPPED

Hi,

I noticed a difference between musl and glibc for the following code:

    struct addrinfo hints;
    struct addrinfo *res;

    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_INET6;
    hints.ai_flags = AI_NUMERICHOST | AI_V4MAPPED | AI_ALL;

    ret = getaddrinfo("192.168.0.1", NULL, &hints, &res);
    
musl returns EAI_NONAME (Name does not resolve)
glibc returns the correct ipv6 address in ipv4-mapped format.

The POSIX specification for AI_V4MAPPED says:

    If the AI_V4MAPPED flag is specified along with an ai_family of
    AF_INET6, then getaddrinfo() shall return IPv4-mapped IPv6 addresses
    on finding no matching IPv6 addresses ( ai_addrlen shall be 16). The
    AI_V4MAPPED flag shall be ignored unless ai_family equals AF_INET6.
    If the AI_ALL flag is used with the AI_V4MAPPED flag, then
    getaddrinfo() shall return all matching IPv6 and IPv4 addresses. The
    AI_ALL flag without the AI_V4MAPPED flag is ignored. [Option End]

Shouldn't musl behave like glibc in this example?

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.