From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9548 invoked by alias); 25 Mar 2008 16:08:35 -0000 Received: (qmail 9530 invoked by uid 22791); 25 Mar 2008 16:08:34 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 25 Mar 2008 16:08:17 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id m2PGFxxN012013; Tue, 25 Mar 2008 17:15:59 +0100 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id m2PGFwX6012011; Tue, 25 Mar 2008 17:15:58 +0100 Date: Tue, 25 Mar 2008 16:08:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] scopev4 in /etc/gai.conf Message-ID: <20080325161558.GX3726@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00007.txt.bz2 Hi! When scopev4 is specified in /etc/gai.conf without /prefix_len, for IPv4 address that's just that address, i.e. bits 32 (resp. 128 for v4 mapped address). E.g. scopev4 172.16.0.1 7 and scopev4 172.16.0.1/32 7 are handled the same. But if /prefix_len isn't present for IN6_IS_ADDR_V4_MAPPED address, the entry is handled as invalid (cp == NULL, so satisfies a few initial conditions, but then fails the bits >= 96 test, because it has been initialized to 32. I assume it should default to 128, right? Also, the example scopev4 entries in posix/gai.conf use scopev4 ::ffff:0.0.0.0 14 entry, which ATM isn't parsed at all, with the getaddrinfo.c change below would be parsed as ::ffff:0.0.0.0/128 14, while I believe the nullbits entry should have netmask 0, i.e. ::ffff:0.0.0.0/96. If the last number is 14, that's not a big deal, as getaddrinfo.c will then magically add scope_nullbits entry, but still it would be good if the comment was accurate. 2008-03-25 Jakub Jelinek * posix/gai.conf: Fix comment for scope nullbits. * sysdeps/posix/getaddrinfo.c (gaiconf_init): If /bits is not present, default to 128 bits for v4 mapped addresses. --- libc/posix/gai.conf.jj 2007-12-10 09:05:34.000000000 +0100 +++ libc/posix/gai.conf 2008-03-25 16:57:53.000000000 +0100 @@ -65,4 +65,4 @@ #scopev4 ::ffff:10.0.0.0/104 5 #scopev4 ::ffff:172.16.0.0/108 5 #scopev4 ::ffff:192.168.0.0/112 5 -#scopev4 ::ffff:0.0.0.0 14 +#scopev4 ::ffff:0.0.0.0/96 14 --- libc/sysdeps/posix/getaddrinfo.c.jj 2008-02-01 10:54:30.000000000 +0100 +++ libc/sysdeps/posix/getaddrinfo.c 2008-03-25 16:57:01.000000000 +0100 @@ -1775,6 +1775,7 @@ gaiconf_init (void) *cp++ = '\0'; if (inet_pton (AF_INET6, val1, &prefix)) { + bits = 128; if (IN6_IS_ADDR_V4MAPPED (&prefix) && (cp == NULL || (bits = strtoul (cp, &endp, 10)) != ULONG_MAX Jakub