mailing list of musl libc
 help / color / mirror / code / Atom feed
* getaddrinfo behaviour with AI_V4MAPPED
@ 2014-02-11 16:35 Clément Vasseur
  0 siblings, 0 replies; only message in thread
From: Clément Vasseur @ 2014-02-11 16:35 UTC (permalink / raw)
  To: musl

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?



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-02-11 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11 16:35 getaddrinfo behaviour with AI_V4MAPPED Clément Vasseur

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).