Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 3 Aug 2020 09:37:18 -0400
From: Rich Felker <dalias@...c.org>
To: Dmitry Samersoff <dms@...ersoff.net>
Cc: musl@...ts.openwall.com
Subject: Re: getaddrinfo(3) with AI_V4MAPPED and AI_ALL flags

On Mon, Aug 03, 2020 at 11:15:54AM +0300, Dmitry Samersoff wrote:
> Hello Rich,
> 
> If you bind to ::ffff:0.0.0.0 on an IPv6 socket you will be able to
> receive IPv4 connection only.
> 
> If you bind to :: on an IPv6 socket you will be able to receive both,
> IPv6 and IPv4 connections.
> 
> So, on my opinion, if ::ffff:0.0.0.0 is the only IPv4 address on the
> interface it should not be returned.

I don't see how your reasoning follows. On a system with
net.ipv6.bindv6only=1 configured, binding :: does not suffice to receive
ipv4 connections. If the application is using AI_V4MAPPED in order to
work entirely with v6 sockets, it needs to bind ::ffff:0.0.0.0 in
order to be able to receive v4 connections, so it needs to be returned
in the list of results.

On a system with net.ipv6.bindv6only=0 (the default and reasonable
setting), it does not hurt to attempt binding both; in one order I
believe the v4mapped one may fail, but that's fine.

Rich



> On 31.07.2020 22:19, Rich Felker wrote:
> >On Fri, Jul 31, 2020 at 07:21:47PM +0300, Dmitry Samersoff wrote:
> >>Hello Rich,
> >>
> >>I'm not sure that mapping of INADDR_ANY (0.0.0.0) and return of
> >>::ffff:0.0.0.0' has any sense.
> >>
> >>Should it be filtered out on musl level?
> >
> >This is an interesting question. What happens if you bind
> >::ffff:0.0.0.0 on an IPv6 socket? Is it the same as binding :: or does
> >it produce a v6 socket that only accepts v4 connections? If it has its
> >own distinct functionality then returning it when V4MAPPED is
> >requested seems to make some sense.
> >
> >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.