From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id 792a134b for ; Thu, 27 Feb 2020 14:45:38 +0000 (UTC) Received: (qmail 13322 invoked by uid 550); 27 Feb 2020 14:45:36 -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 12280 invoked from network); 27 Feb 2020 14:45:35 -0000 Date: Thu, 27 Feb 2020 09:45:23 -0500 From: Rich Felker To: musl@lists.openwall.com Message-ID: <20200227144523.GE11469@brightrain.aerifal.cx> References: <89b25567-5887-80ee-bfac-58b25e7a9b45@bell-sw.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <89b25567-5887-80ee-bfac-58b25e7a9b45@bell-sw.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] getaddrinfo(3) with AI_V4MAPPED and AI_ALL flags 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