Skip to content

Commit

Permalink
(match_prefix): Don't treat IPv4 loopback address special when
Browse files Browse the repository at this point in the history
	converting to v4 mapped addressed.
  • Loading branch information
Ulrich Drepper committed May 14, 2008
1 parent af77c9b commit 5846c4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
16 changes: 5 additions & 11 deletions sysdeps/posix/getaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5846c4e

Please sign in to comment.