glibc/glibc-2.7-only-lookup-ipv6-if-it-makes-sense.patch

46 lines
1.7 KiB
Diff

diff -Nru glibc-2.7.orig/sysdeps/posix/getaddrinfo.c glibc-2.7/sysdeps/posix/getaddrinfo.c
--- glibc-2.7.orig/sysdeps/posix/getaddrinfo.c 2007-10-17 18:05:12.000000000 +0200
+++ glibc-2.7/sysdeps/posix/getaddrinfo.c 2008-02-05 19:53:08.000000000 +0100
@@ -263,7 +263,7 @@
static int
gaih_inet (const char *name, const struct gaih_service *service,
const struct addrinfo *req, struct addrinfo **pai,
- unsigned int *naddrs)
+ unsigned int *naddrs, bool usable_ipv6)
{
const struct gaih_typeproto *tp = gaih_inet_typeproto;
struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
@@ -706,7 +706,7 @@
if (fct != NULL)
{
if (req->ai_family == AF_INET6
- || req->ai_family == AF_UNSPEC)
+ || (req->ai_family == AF_UNSPEC && usable_ipv6))
{
gethosts (AF_INET6, struct in6_addr);
no_inet6_data = no_data;
@@ -1914,7 +1914,7 @@
if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
|| hints->ai_family == AF_INET6)
{
- last_i = gaih_inet (name, pservice, hints, end, &naddrs);
+ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
if (last_i != 0)
{
freeaddrinfo (p);
diff -Nru glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c
--- glibc-2.7.orig/sysdeps/unix/sysv/linux/check_pf.c 2007-08-29 18:49:45.000000000 +0200
+++ glibc-2.7/sysdeps/unix/sysv/linux/check_pf.c 2008-02-05 19:50:30.000000000 +0100
@@ -201,7 +201,10 @@
{
out_v6:
if (!IN6_IS_ADDR_LOOPBACK (address ?: local))
- *seen_ipv6 = true;
+ if (ifam->ifa_scope < RT_SCOPE_LINK)
+ {
+ *seen_ipv6 = true;
+ }
}
if (ifam->ifa_flags & (IFA_F_DEPRECATED