about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-05-18 16:58:36 +0000
committerUlrich Drepper <drepper@redhat.com>2006-05-18 16:58:36 +0000
commit6e2a7825284e41f2336b0cb5a98609ff486e85fa (patch)
tree8084e65d95ff9acac81496574d841ae8c5d5011c
parent758b9d7efe599e3de3472593b6f8f03cfc29ea92 (diff)
downloadglibc-6e2a7825284e41f2336b0cb5a98609ff486e85fa.tar.gz
glibc-6e2a7825284e41f2336b0cb5a98609ff486e85fa.tar.xz
glibc-6e2a7825284e41f2336b0cb5a98609ff486e85fa.zip
* sysdeps/posix/getaddrinfo.c: Add unique labels to the default
	RFC3484 precedence table for fec0::/10 and fc00::/7 (site-local
	and ULA respectively). Set precedence for IPv4 address to 10 as
	defined in RFC3484 for preferring IPv6.
	* posix/gai.conf: Update to match the new default tables.
-rw-r--r--ChangeLog8
-rw-r--r--posix/gai.conf26
-rw-r--r--sysdeps/posix/getaddrinfo.c17
3 files changed, 43 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index d7e33323fa..6b38b9d256 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-18  David Woodhouse  <dwmw2@infradead.org>
+
+	* sysdeps/posix/getaddrinfo.c: Add unique labels to the default
+	RFC3484 precedence table for fec0::/10 and fc00::/7 (site-local
+	and ULA respectively). Set precedence for IPv4 address to 10 as
+	defined in RFC3484 for preferring IPv6.
+	* posix/gai.conf: Update to match the new default tables.
+
 2006-05-18  Jakub Jelinek  <jakub@redhat.com>
 
 	* nis/nss_compat/compat-pwd.c (internal_setpwent): If nss_set*ent
diff --git a/posix/gai.conf b/posix/gai.conf
index 5f063f5c3c..0e334ac2c5 100644
--- a/posix/gai.conf
+++ b/posix/gai.conf
@@ -24,17 +24,29 @@
 #label  2002::/16     2
 #label ::/96          3
 #label ::ffff:0:0/96  4
+#label  fec0::/10     5
+#label  fc00::/7      6
+#
+#    This default differs from the tables given in RFC 3484 by handling
+#    (now obsolete) site-local IPv6 addresses and Unique Local Addresses.
+#    The reason for this difference is that these addresses are never
+#    NATed while IPv4 site-local addresses most probably are.  Given
+#    the precedence of IPv6 over IPv4 (see below) on machines having only
+#    site-local IPv4 and IPv6 addresses a lookup for a global address would
+#    see the IPv6 be preferred.  The result is a long delay because the
+#    site-local IPv6 addresses cannot be used while the IPv4 address is
+#    (at least for the foreseeable future) NATed.
 #
 # precedence  <mask>   <value>
-#    Add another rule the to RFC 3484 precendence table.  See section 2.1
+#    Add another rule the to RFC 3484 precedence table.  See section 2.1
 #    and 10.3 in RFC 3484.  The default is:
 #
-#precendence  ::1/128       50
-#precendence  ::/0          40
-#precendence  2002::/16     30
-#precendence ::/96          20
-#precendence ::ffff:0:0/96  10
+#precedence  ::1/128       50
+#precedence  ::/0          40
+#precedence  2002::/16     30
+#precedence ::/96          20
+#precedence ::ffff:0:0/96  10
 #
 #    For sites which prefer IPv4 connections change the last line to
 #
-#precendence ::ffff:0:0/96  100
+#precedence ::ffff:0:0/96  100
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index a78c670bfb..a35b8662d5 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1202,6 +1202,21 @@ static const struct prefixentry default_labels[] =
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
       96, 4 },
+    /* The next two entries differ from RFC 3484.  We need to treat
+       IPv6 site-local addresses special because they are never NATed,
+       unlike site-locale IPv4 addresses.  If this would not happen, on
+       machines which have only IPv4 and IPv6 site-local addresses, the
+       sorting would prefer the IPv6 site-local addresses, causing
+       unnecessary delays when trying to connect to a global IPv6 address
+       through a site-local IPv6 address.  */
+    { { .in6_u
+	= { .u6_addr8 = { 0xfe, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      10, 5 },
+    { { .in6_u
+	= { .u6_addr8 = { 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
+      7, 6 },
     { { .in6_u
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },
@@ -1231,7 +1246,7 @@ static const struct prefixentry default_precedence[] =
     { { .in6_u
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } } },
-      96, 100 },
+      96, 10 },
     { { .in6_u
 	= { .u6_addr8 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 			  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } },