about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-14 22:47:15 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-14 22:47:15 +0000
commit5846c4e2692a18a922cf07ab6c3ec20efa61b4d3 (patch)
treeb9f3f02645cf01ddfc591f355a58e958d3d6f76e
parentaf77c9b7484f64b61f51087dc2e36d1393ee2940 (diff)
downloadglibc-5846c4e2692a18a922cf07ab6c3ec20efa61b4d3.tar.gz
glibc-5846c4e2692a18a922cf07ab6c3ec20efa61b4d3.tar.xz
glibc-5846c4e2692a18a922cf07ab6c3ec20efa61b4d3.zip
(match_prefix): Don't treat IPv4 loopback address special when
	converting to v4 mapped addressed.
-rw-r--r--ChangeLog2
-rw-r--r--sysdeps/posix/getaddrinfo.c16
2 files changed, 7 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index db05ed217a..2dc03d5b43 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
 	[BZ #6472]
 	* sysdeps/posix/getaddrinfo.c (get_scope): Loopback addresses have
 	to be treated like link-local addresses.
+	(match_prefix): Don't treat IPv4 loopback address special when
+	converting to v4 mapped addressed.
 
 	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Add _res_hconf_init
 	if necessary.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 855c5a5c06..8908fc10c3 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -1248,20 +1248,14 @@ match_prefix (const struct sockaddr_in6 *in6,
     {
       const struct sockaddr_in *in = (const struct sockaddr_in *) in6;
 
-      /* Convert to IPv6 address.  */
+      /* Construct a V4-to-6 mapped address.  */
       in6_mem.sin6_family = PF_INET6;
       in6_mem.sin6_port = in->sin_port;
       in6_mem.sin6_flowinfo = 0;
-      if (in->sin_addr.s_addr == htonl (0x7f000001))
-	in6_mem.sin6_addr = (struct in6_addr) IN6ADDR_LOOPBACK_INIT;
-      else
-	{
-	  /* Construct a V4-to-6 mapped address.  */
-	  memset (&in6_mem.sin6_addr, '\0', sizeof (in6_mem.sin6_addr));
-	  in6_mem.sin6_addr.s6_addr16[5] = 0xffff;
-	  in6_mem.sin6_addr.s6_addr32[3] = in->sin_addr.s_addr;
-	  in6_mem.sin6_scope_id = 0;
-	}
+      memset (&in6_mem.sin6_addr, '\0', sizeof (in6_mem.sin6_addr));
+      in6_mem.sin6_addr.s6_addr16[5] = 0xffff;
+      in6_mem.sin6_addr.s6_addr32[3] = in->sin_addr.s_addr;
+      in6_mem.sin6_scope_id = 0;
 
       in6 = &in6_mem;
     }