2013-08-06 16:52:55 +02:00
|
|
|
Index: glibc-2.17.90/sysdeps/posix/getaddrinfo.c
|
2012-11-23 16:16:20 +01:00
|
|
|
===================================================================
|
2013-08-06 16:52:55 +02:00
|
|
|
--- glibc-2.17.90.orig/sysdeps/posix/getaddrinfo.c
|
|
|
|
+++ glibc-2.17.90/sysdeps/posix/getaddrinfo.c
|
|
|
|
@@ -270,7 +270,7 @@ extern service_user *__nss_hosts_databas
|
2009-02-20 08:46:43 +01:00
|
|
|
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;
|
2013-08-06 16:52:55 +02:00
|
|
|
@@ -840,7 +840,10 @@ gaih_inet (const char *name, const struc
|
2012-11-23 16:16:20 +01:00
|
|
|
if (req->ai_family == PF_UNSPEC)
|
|
|
|
fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
|
|
|
|
|
2012-04-13 11:37:44 +02:00
|
|
|
- if (fct4 != NULL)
|
|
|
|
+ /* If we don't want ipv6, don't use gethostbyname4_r,
|
|
|
|
+ as it's using T_UNSPEC to libc_res_nsearch, which always
|
|
|
|
+ create T_A and T_AAAA queries. */
|
|
|
|
+ if (usable_ipv6 && fct4 != NULL)
|
|
|
|
{
|
|
|
|
int herrno;
|
|
|
|
|
2013-08-06 16:52:55 +02:00
|
|
|
@@ -943,7 +946,7 @@ gaih_inet (const char *name, const struc
|
2009-02-20 08:46:43 +01:00
|
|
|
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;
|
2013-08-06 16:52:55 +02:00
|
|
|
@@ -2471,7 +2474,11 @@ getaddrinfo (const char *name, const cha
|
2009-02-20 08:46:43 +01:00
|
|
|
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);
|
2012-07-04 17:02:55 +02:00
|
|
|
+ if (!check_pf_called)
|
|
|
|
+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
|
|
|
|
+ check_pf_called = true;
|
|
|
|
+
|
2009-02-20 08:46:43 +01:00
|
|
|
+ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
|
|
|
|
if (last_i != 0)
|
|
|
|
{
|
|
|
|
freeaddrinfo (p);
|