From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SUBJ_OBFU_PUNCT_FEW autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15693 invoked from network); 3 Aug 2020 13:37:33 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 3 Aug 2020 13:37:33 -0000 Received: (qmail 10130 invoked by uid 550); 3 Aug 2020 13:37:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 10110 invoked from network); 3 Aug 2020 13:37:30 -0000 Date: Mon, 3 Aug 2020 09:37:18 -0400 From: Rich Felker To: Dmitry Samersoff Cc: musl@lists.openwall.com Message-ID: <20200803133717.GC6949@brightrain.aerifal.cx> References: <89b25567-5887-80ee-bfac-58b25e7a9b45@bell-sw.com> <20200227144523.GE11469@brightrain.aerifal.cx> <6b3be14d-214d-9dde-86d2-1d97684f4004@bell-sw.com> <20200730160012.GT6949@brightrain.aerifal.cx> <8bd97d8a-ff78-27a0-8231-ffd0357218eb@samersoff.net> <20200731191917.GU6949@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] 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 > >