This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] scopev4 in /etc/gai.conf


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  <jakub@redhat.com>

	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]