View | Details | Raw Unified | Return to bug 767125
Collapse All | Expand All

(-)a/sysdeps/posix/getaddrinfo.c (-4 / +11 lines)
Lines 269-275 extern service_user *__nss_hosts_database attribute_hidden; Link Here
269
static int
269
static int
270
gaih_inet (const char *name, const struct gaih_service *service,
270
gaih_inet (const char *name, const struct gaih_service *service,
271
	   const struct addrinfo *req, struct addrinfo **pai,
271
	   const struct addrinfo *req, struct addrinfo **pai,
272
	   unsigned int *naddrs)
272
	   unsigned int *naddrs, bool usable_ipv6)
273
{
273
{
274
  const struct gaih_typeproto *tp = gaih_inet_typeproto;
274
  const struct gaih_typeproto *tp = gaih_inet_typeproto;
275
  struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
275
  struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
Lines 832-838 gaih_inet (const char *name, const struct gaih_service *service, Link Here
832
	      no_data = 0;
832
	      no_data = 0;
833
	      nss_gethostbyname4_r fct4
833
	      nss_gethostbyname4_r fct4
834
		= __nss_lookup_function (nip, "gethostbyname4_r");
834
		= __nss_lookup_function (nip, "gethostbyname4_r");
835
	      if (fct4 != NULL)
835
	      /* If we don't want ipv6, don't use gethostbyname4_r,
836
	         as it's using T_UNSPEC to libc_res_nsearch, which always
837
		 create T_A and T_AAAA queries.  */
838
	      if (usable_ipv6 && fct4 != NULL)
836
		{
839
		{
837
		  int herrno;
840
		  int herrno;
838
841
Lines 935-941 gaih_inet (const char *name, const struct gaih_service *service, Link Here
935
		  if (fct != NULL)
938
		  if (fct != NULL)
936
		    {
939
		    {
937
		      if (req->ai_family == AF_INET6
940
		      if (req->ai_family == AF_INET6
938
			  || req->ai_family == AF_UNSPEC)
941
			  || (req->ai_family == AF_UNSPEC && usable_ipv6))
939
			{
942
			{
940
			  gethosts (AF_INET6, struct in6_addr);
943
			  gethosts (AF_INET6, struct in6_addr);
941
			  no_inet6_data = no_data;
944
			  no_inet6_data = no_data;
Lines 2418-2424 getaddrinfo (const char *name, const char *service, Link Here
2418
  if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
2421
  if (hints->ai_family == AF_UNSPEC || hints->ai_family == AF_INET
2419
      || hints->ai_family == AF_INET6)
2422
      || hints->ai_family == AF_INET6)
2420
    {
2423
    {
2421
      last_i = gaih_inet (name, pservice, hints, end, &naddrs);
2424
      if (!check_pf_called)
2425
	__check_pf (&seen_ipv4, &seen_ipv6, &in6ai, &in6ailen);
2426
      check_pf_called = true;
2427
2428
      last_i = gaih_inet (name, pservice, hints, end, &naddrs, seen_ipv6);
2422
      if (last_i != 0)
2429
      if (last_i != 0)
2423
	{
2430
	{
2424
	  freeaddrinfo (p);
2431
	  freeaddrinfo (p);

Return to bug 767125