Bug#503912: libc6: getaddrinfo V4MAPPED behaviour is not according to standard and manpage
Package: libc6
Version: 2.7-15
Severity: normal
Hello,
the getaddrinfo call with a hints set to AI_V4MAPPED should return
IPv4 mapped addresses if they are available.
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0; /* Any protocol */
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
hints.ai_flags = AI_V4MAPPED;
However, this doesn't work. I only get the mapped V4 adresses when I do this:
hints.ai_flags = AI_V4MAPPED | AI_ALL;
However the AI_ALL flag has a different meaning.
If I compare this behaviour with opensolaris, there I DO get V4 mapped addresses with
only AI_V4MAPPED set in the hints.
Reading the manual page, and also the docs on opengroup.org, I would expect the following
behavior:
Only AI_V4MAPPED -> return IPv6 addresses only if available, if not available, return
IPv4 mapped
AI_V4MAPPED | AI_ALL -> return IPv6 addresses and IPv4 mapped addresses.
Which is not what glibc does.
I'll see if I can come up with a patch somewhere in the next days.
Thanks, Joost Damad
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.25-5-s1 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libc6 depends on:
ii libgcc1 1:4.3.2-1 GCC support library
libc6 recommends no packages.
Versions of packages libc6 suggests:
ii glibc-doc 2.7-15 GNU C Library: Documentation
ii libc6-i686 2.7-15 GNU C Library: Shared libraries [i
ii locales-all [locales] 2.7-15 GNU C Library: Precompiled locale
-- debconf information:
glibc/upgrade: true
glibc/restart-failed:
glibc/restart-services:
Reply to: