glibc/getaddrinfo-ipv6-sanity.diff
Andreas Schwab 384789b673 Accepting request 208665 from home:Andreas_Schwab:Factory
- Update to glibc 2.18.90 bd12ab55c05e:
  * New locales: ak_GH, anp_IN, ar_SS, cmn_TW, hak_TW, lzh_TW, nan_TW, pap_AW,
    pap_CW, quz_PE, the_NP.
  * Substantially revised locales: gd_GB, ht_HT
  * The LC_ADDRESS field was updated to support country_car for almost all
    supported locales.
  * ISO 1427 definitions were updated.
  * ISO 3166 definitions were updated.
  * The localedef utility now supports --big-endian and --little-endian
    command-line options to generate locales for a different system from that
    for which the C library was built.
  * Binary locale files now only depend on the endianness of the system for
    which they are generated and not on other properties of that system.
  * ISO 639 definitions were updated for Chiga (cgg) and Chinese (gan, hak, czh,
    cjy, lzh, cmn, mnp, cdo, czo, cpx, wuu, hsn, yue).
  * SystemTap probes for malloc have been introduced.
  * Support for powerpc64le has been added.
  * The soft-float powerpc port now supports e500 processors.
- Remove upstreamed patches:
  cbrtl-ldbl-96.patch
  fcntl-o-tmpfile.patch
  getaddrinfo-overflow.patch
  glibc-2.18.tar.xz
  glibc-ld-profile.patch
  glibc-nscd-hconf.diff
  i686-strcasecmp-fallback.patch
  m68k-Scrt1.patch
  malloc-overflows.patch
  nonascii-case.patch
  nss-database.patch

OBS-URL: https://build.opensuse.org/request/show/208665
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=320
2013-11-27 11:31:05 +00:00

48 lines
1.8 KiB
Diff

Index: glibc-2.18.90/sysdeps/posix/getaddrinfo.c
===================================================================
--- glibc-2.18.90.orig/sysdeps/posix/getaddrinfo.c
+++ glibc-2.18.90/sysdeps/posix/getaddrinfo.c
@@ -286,7 +286,7 @@ extern service_user *__nss_hosts_databas
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;
@@ -855,7 +855,10 @@ gaih_inet (const char *name, const struc
if (req->ai_family == PF_UNSPEC)
fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
- 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;
@@ -958,7 +961,7 @@ gaih_inet (const char *name, const struc
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;
@@ -2418,7 +2421,11 @@ getaddrinfo (const char *name, const cha
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);
+ if (!check_pf_called)
+ __check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
+ check_pf_called = true;
+
+ last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
if (last_i != 0)
{
freeaddrinfo (p);