mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Dmitry Samersoff <dms@samersoff.net>
Cc: musl@lists.openwall.com
Subject: Re: [musl] getaddrinfo(3) with AI_V4MAPPED and AI_ALL flags
Date: Mon, 3 Aug 2020 09:37:18 -0400	[thread overview]
Message-ID: <20200803133717.GC6949@brightrain.aerifal.cx> (raw)
In-Reply-To: <a244be90-79af-9ff0-3b83-91d662571bf2@samersoff.net>

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
> >

      reply	other threads:[~2020-08-03 13:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 10:17 Alexander Scherbatiy
2020-02-27 14:45 ` Rich Felker
2020-07-30 15:20   ` Alexander Scherbatiy
2020-07-30 16:00     ` Rich Felker
2020-07-31 16:21       ` Dmitry Samersoff
2020-07-31 19:19         ` Rich Felker
2020-08-03  8:15           ` Dmitry Samersoff
2020-08-03 13:37             ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803133717.GC6949@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=dms@samersoff.net \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).