Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 30 Jul 2020 18:20:36 +0300
From: Alexander Scherbatiy <alexander.scherbatiy@...l-sw.com>
To: musl@...ts.openwall.com, Rich Felker <dalias@...c.org>
Subject: Re: getaddrinfo(3) with AI_V4MAPPED and AI_ALL flags


  glibc getaddrinfo(3) function uses /etc/gai.conf file to sort addrinfo 
results.
  does musl getaddrinfo(3) implementations allows to configure the 
results order?

Thanks,
Alexander.

On 27.02.2020 17:45, Rich Felker wrote:
> On Thu, Feb 27, 2020 at 01:17:20PM +0300, Alexander Scherbatiy wrote:
>> Hello,
>>
>> When I call getaddrinfo() with different families, SOCK_STREAM
>> socktype, IPPROTO_TCP protocol, and AI_PASSIVE flag the result is
>> the same on the Alpine Linux 3.11.3 and Ubuntu 19.10 (the code
>> sample is below):
>>
>> ----------------
>>
>> family: AF_UNSPEC, flags: AI_PASSIVE
>> AF_INET  IPv4 addr '0.0.0.0'
>> AF_INET6 IPv6 addr '::'
>>
>> family: AF_INET,   flags: AI_PASSIVE
>> AF_INET  IPv4 addr '0.0.0.0'
>>
>> family: AF_INET6,  flags: AI_PASSIVE
>> AF_INET6 IPv6 addr '::'
>>
>> ----------------
>>
>> When I use getaddrinfo() with AF_INET6 family and additional
>> AI_V4MAPPED | AI_ALL (return both IPv6 and IPv4-mapped IPv6
>> addresses) flags the result on Ubuntu contains only IPv6 '::'
>> address:
>>
>> ----------------
>>
>> family: AF_INET6,  flags: AI_PASSIVE | AI_V4MAPPED | AI_ALL
>> AF_INET6 IPv6 addr '::'
>>
>> ----------------
>>
>> whereas the result on Alpine Linux contains both IPv4-mapped IPv6
>> addresses '::ffff:0.0.0.0' and  IPv6 '::'
>>
>> ----------------
>>
>> family: AF_INET6,  flags: AI_PASSIVE | AI_V4MAPPED | AI_ALL
>> AF_INET6 IPv6 addr '::ffff:0.0.0.0'
>> AF_INET6 IPv6 addr '::'
>>
>> ----------------
>>
>> Is it expected behavior?
>>
>> I use Alpine Linux 3.11.3 from docker with musl libc (x86_64).
> The musl behavior is as intended and I think it's more correct. If
> net.ipv6.bindv6only sysctl is enabled, binding using the glibc results
> would fail to accept ipv4 connections.
>
> Rich

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.