about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-14 22:33:51 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-14 22:33:51 +0000
commit5fab55441ced740620008e2387b555f7080e093f (patch)
tree5fc925dbfb2a08b65b3ae73fe9c2b1bbfb60c1a6
parent1f0398248c1c581a1203c0d294acde295b949fea (diff)
downloadglibc-5fab55441ced740620008e2387b555f7080e093f.tar.gz
glibc-5fab55441ced740620008e2387b555f7080e093f.tar.xz
glibc-5fab55441ced740620008e2387b555f7080e093f.zip
* sysdeps/posix/getaddrinfo.c (get_scope): Loopback addresses have
	to be treated like link-local addresses.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/posix/getaddrinfo.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5a06103bef..eec1fb9e84 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-05-14  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/posix/getaddrinfo.c (get_scope): Loopback addresses have
+	to be treated like link-local addresses.
+
 	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Add _res_hconf_init
 	if necessary.
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index c8965ef99d..855c5a5c06 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1112,7 +1112,10 @@ get_scope (const struct sockaddr_in6 *in6)
     {
       if (! IN6_IS_ADDR_MULTICAST (&in6->sin6_addr))
 	{
-	  if (IN6_IS_ADDR_LINKLOCAL (&in6->sin6_addr))
+	  if (IN6_IS_ADDR_LINKLOCAL (&in6->sin6_addr)
+	      /* RFC 4291 2.5.3 says that the loopback address is to be
+		 treated like a link-local address.  */
+	      || IN6_IS_ADDR_LOOPBACK (&in6->sin6_addr))
 	    scope = 2;
 	  else if (IN6_IS_ADDR_SITELOCAL (&in6->sin6_addr))
 	    scope = 5;