Blame SOURCES/glibc-rh677316-RES_USE_INET6.patch

51f0aa
Backport this upstream commit, but without the resolv/resolv.h change
51f0aa
which introduces the deprecation warning:
51f0aa
51f0aa
commit b76e065991ec01299225d9da90a627ebe6c1ac97
51f0aa
Author: Florian Weimer <fweimer@redhat.com>
51f0aa
Date:   Tue Oct 4 11:52:10 2016 +0200
51f0aa
51f0aa
    resolv: Deprecate the "inet6" option and RES_USE_INET6 [BZ #19582]
51f0aa
51f0aa
No Makefile changes are needed here because we have not backported the
51f0aa
resolver testsuite at this point.  Furthermore, due to the lack of
51f0aa
actual RES_USE_INET6 deprecation, resolv/gethnamaddr.c is not modified
51f0aa
in this patch (because it still compiles).
51f0aa
51f0aa
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
51f0aa
index d79b0bd9c79173c8..fa2d79e7b69da57b 100644
51f0aa
--- a/nis/nss_nis/nis-hosts.c
51f0aa
+++ b/nis/nss_nis/nis-hosts.c
51f0aa
@@ -28,7 +28,7 @@
51f0aa
 #include <string.h>
51f0aa
 #include <netinet/in.h>
51f0aa
 #include <arpa/inet.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <bits/libc-lock.h>
51f0aa
 #include <rpcsvc/yp.h>
51f0aa
 #include <rpcsvc/ypclnt.h>
51f0aa
@@ -232,8 +232,8 @@ _nss_nis_gethostent_r (struct hostent *host, char *buffer, size_t buflen,
51f0aa
   __libc_lock_lock (lock);
51f0aa
 
51f0aa
   status = internal_nis_gethostent_r (host, buffer, buflen, errnop, h_errnop,
51f0aa
-			((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET),
51f0aa
-			((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0 ));
51f0aa
+			(res_use_inet6 () ? AF_INET6 : AF_INET),
51f0aa
+			(res_use_inet6 () ? AI_V4MAPPED : 0 ));
51f0aa
 
51f0aa
   __libc_lock_unlock (lock);
51f0aa
 
51f0aa
@@ -345,7 +345,7 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
51f0aa
 
51f0aa
   return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
51f0aa
 				    h_errnop,
51f0aa
-			((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
51f0aa
+			(res_use_inet6 () ? AI_V4MAPPED : 0));
51f0aa
 }
51f0aa
 
51f0aa
 
51f0aa
@@ -353,7 +353,7 @@ enum nss_status
51f0aa
 _nss_nis_gethostbyname_r (const char *name, struct hostent *host, char *buffer,
51f0aa
 			  size_t buflen, int *errnop, int *h_errnop)
51f0aa
 {
51f0aa
-  if (_res.options & RES_USE_INET6)
51f0aa
+  if (res_use_inet6 ())
51f0aa
     {
51f0aa
       enum nss_status status;
51f0aa
 
51f0aa
@@ -427,9 +427,8 @@ _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
51f0aa
   free (result);
51f0aa
 
51f0aa
   int parse_res = parse_line (p, host, data, buflen, errnop, af,
51f0aa
-			      ((_res.options & RES_USE_INET6)
51f0aa
-			       ? AI_V4MAPPED : 0));
51f0aa
-  if (__builtin_expect (parse_res < 1, 0))
51f0aa
+			      (res_use_inet6 () ? AI_V4MAPPED : 0));
51f0aa
+  if (__glibc_unlikely (parse_res < 1))
51f0aa
     {
51f0aa
       if (parse_res == -1)
51f0aa
 	{
51f0aa
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
51f0aa
index 772d71097d6a2442..fb7461579b5408c9 100644
51f0aa
--- a/nis/nss_nisplus/nisplus-hosts.c
51f0aa
+++ b/nis/nss_nisplus/nisplus-hosts.c
51f0aa
@@ -43,6 +43,7 @@ static u_long tablename_len;
51f0aa
 	(NIS_RES_OBJECT (res)[idx].EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len)
51f0aa
 
51f0aa
 /* Get implementation for some internal functions. */
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <resolv/mapv4v6addr.h>
51f0aa
 
51f0aa
 
51f0aa
@@ -321,7 +322,7 @@ internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
51f0aa
 	    }
51f0aa
 	}
51f0aa
 
51f0aa
-      if (_res.options & RES_USE_INET6)
51f0aa
+      if (res_use_inet6 ())
51f0aa
 	parse_res = _nss_nisplus_parse_hostent (result, AF_INET6, host, buffer,
51f0aa
 						buflen, errnop, AI_V4MAPPED);
51f0aa
       else
51f0aa
@@ -488,7 +489,7 @@ _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
51f0aa
 
51f0aa
   return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
51f0aa
 				    herrnop,
51f0aa
-			 ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0));
51f0aa
+				    (res_use_inet6 () ? AI_V4MAPPED : 0));
51f0aa
 }
51f0aa
 
51f0aa
 
51f0aa
@@ -497,7 +498,7 @@ _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
51f0aa
 			      char *buffer, size_t buflen, int *errnop,
51f0aa
 			      int *h_errnop)
51f0aa
 {
51f0aa
-  if (_res.options & RES_USE_INET6)
51f0aa
+  if (res_use_inet6 ())
51f0aa
     {
51f0aa
       enum nss_status status;
51f0aa
 
51f0aa
@@ -558,7 +559,7 @@ _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
51f0aa
 
51f0aa
   parse_res = _nss_nisplus_parse_hostent (result, af, host,
51f0aa
 					  buffer, buflen, errnop,
51f0aa
-					  ((_res.options & RES_USE_INET6)
51f0aa
+					  (res_use_inet6 ()
51f0aa
 					   ? AI_V4MAPPED : 0));
51f0aa
   nis_freeresult (result);
51f0aa
 
51f0aa
diff --git a/nscd/aicache.c b/nscd/aicache.c
51f0aa
index abab042757920811..0ee25247cd464940 100644
51f0aa
--- a/nscd/aicache.c
51f0aa
+++ b/nscd/aicache.c
51f0aa
@@ -25,6 +25,7 @@
51f0aa
 #include <time.h>
51f0aa
 #include <unistd.h>
51f0aa
 #include <sys/mman.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <resolv/res_hconf.h>
51f0aa
 
51f0aa
 #include "dbg_log.h"
51f0aa
@@ -112,7 +113,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
51f0aa
      IPv6 addresses.  Currently this is decided by setting the
51f0aa
      RES_USE_INET6 bit in _res.options.  */
51f0aa
   int old_res_options = _res.options;
51f0aa
-  _res.options &= ~RES_USE_INET6;
51f0aa
+  _res.options &= ~DEPRECATED_RES_USE_INET6;
51f0aa
 
51f0aa
   size_t tmpbuf6len = 1024;
51f0aa
   char *tmpbuf6 = alloca (tmpbuf6len);
51f0aa
@@ -537,7 +538,7 @@ next_nip:
51f0aa
    }
51f0aa
 
51f0aa
  out:
51f0aa
-  _res.options |= old_res_options & RES_USE_INET6;
51f0aa
+  _res.options |= old_res_options & DEPRECATED_RES_USE_INET6;
51f0aa
 
51f0aa
   if (dataset != NULL && !alloca_used)
51f0aa
     {
51f0aa
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
51f0aa
index d64ad2e7b6c9e58b..41488ed6c033ffcd 100644
51f0aa
--- a/nscd/nscd_gethst_r.c
51f0aa
+++ b/nscd/nscd_gethst_r.c
51f0aa
@@ -17,7 +17,7 @@
51f0aa
    <http://www.gnu.org/licenses/>.  */
51f0aa
 
51f0aa
 #include <errno.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <stdio.h>
51f0aa
 #include <string.h>
51f0aa
 #include <arpa/nameser.h>
51f0aa
@@ -41,7 +41,7 @@ __nscd_gethostbyname_r (const char *name, struct hostent *resultbuf,
51f0aa
 {
51f0aa
   request_type reqtype;
51f0aa
 
51f0aa
-  reqtype = (_res.options & RES_USE_INET6) ? GETHOSTBYNAMEv6 : GETHOSTBYNAME;
51f0aa
+  reqtype = res_use_inet6 () ? GETHOSTBYNAMEv6 : GETHOSTBYNAME;
51f0aa
 
51f0aa
   return nscd_gethst_r (name, strlen (name) + 1, reqtype, resultbuf,
51f0aa
 			buffer, buflen, result, h_errnop);
51f0aa
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
51f0aa
index ee530c69610d5393..7a2b57bdebe03408 100644
51f0aa
--- a/nss/digits_dots.c
51f0aa
+++ b/nss/digits_dots.c
51f0aa
@@ -22,7 +22,7 @@
51f0aa
 #include <stdlib.h>
51f0aa
 #include <ctype.h>
51f0aa
 #include <wctype.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <netdb.h>
51f0aa
 #include <arpa/inet.h>
51f0aa
 #include "nsswitch.h"
51f0aa
@@ -80,7 +80,7 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
51f0aa
 	  break;
51f0aa
 
51f0aa
 	default:
51f0aa
-	  af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
51f0aa
+	  af = res_use_inet6 () ? AF_INET6 : AF_INET;
51f0aa
 	  addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
51f0aa
 	  break;
51f0aa
 	}
51f0aa
@@ -167,7 +167,7 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
51f0aa
 		  (*h_addr_ptrs)[0] = (char *) host_addr;
51f0aa
 		  (*h_addr_ptrs)[1] = NULL;
51f0aa
 		  resbuf->h_addr_list = *h_addr_ptrs;
51f0aa
-		  if (af == AF_INET && (_res.options & RES_USE_INET6))
51f0aa
+		  if (af == AF_INET && res_use_inet6 ())
51f0aa
 		    {
51f0aa
 		      /* We need to change the IP v4 address into the
51f0aa
 			 IP v6 address.  */
51f0aa
@@ -211,7 +211,7 @@ __nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
51f0aa
 	  switch (af)
51f0aa
 	    {
51f0aa
 	    default:
51f0aa
-	      af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
51f0aa
+	      af = res_use_inet6 () ? AF_INET6 : AF_INET;
51f0aa
 	      if (af == AF_INET6)
51f0aa
 		{
51f0aa
 		  addr_size = IN6ADDRSZ;
51f0aa
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
51f0aa
index 6c06b89dc179fd9a..b25ebe5ed19bdded 100644
51f0aa
--- a/nss/nss_files/files-hosts.c
51f0aa
+++ b/nss/nss_files/files-hosts.c
51f0aa
@@ -21,7 +21,7 @@
51f0aa
 #include <arpa/inet.h>
51f0aa
 #include <arpa/nameser.h>
51f0aa
 #include <netdb.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 
51f0aa
 
51f0aa
 /* Get implementation for some internal functions.  */
51f0aa
@@ -98,8 +98,8 @@ LINE_PARSER
51f0aa
  })
51f0aa
 
51f0aa
 #define EXTRA_ARGS_VALUE \
51f0aa
-  , ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET),		      \
51f0aa
-  ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0)
51f0aa
+  , (res_use_inet6 () ? AF_INET6 : AF_INET),		      \
51f0aa
+  (res_use_inet6 () ? AI_V4MAPPED : 0)
51f0aa
 #include "files-XXX.c"
51f0aa
 #undef EXTRA_ARGS_VALUE
51f0aa
 
51f0aa
@@ -133,7 +133,7 @@ _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
51f0aa
     {
51f0aa
       /* XXX Is using _res to determine whether we want to convert IPv4
51f0aa
          addresses to IPv6 addresses really the right thing to do?  */
51f0aa
-      int flags = ((_res.options & RES_USE_INET6) ? AI_V4MAPPED : 0);
51f0aa
+      int flags = (res_use_inet6 () ? AI_V4MAPPED : 0);
51f0aa
 
51f0aa
       /* Tell getent function that we have repositioned the file pointer.  */
51f0aa
       last_use = getby;
51f0aa
@@ -358,7 +358,7 @@ _nss_files_gethostbyname_r (const char *name, struct hostent *result,
51f0aa
 			    char *buffer, size_t buflen, int *errnop,
51f0aa
 			    int *herrnop)
51f0aa
 {
51f0aa
-  int af = ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET);
51f0aa
+  int af = (res_use_inet6 () ? AF_INET6 : AF_INET);
51f0aa
 
51f0aa
   return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
51f0aa
 				      errnop, herrnop, NULL, NULL);
51f0aa
diff --git a/resolv/README b/resolv/README
51f0aa
index 416205da77a15564..1a70bbb1dc615ac9 100644
51f0aa
--- a/resolv/README
51f0aa
+++ b/resolv/README
51f0aa
@@ -84,11 +84,7 @@ code:
51f0aa
 
51f0aa
 * In Multi-threaded that manipulate the _res structure, calls to
51f0aa
   functions like `gethostbyname' in threads other than the "main"
51f0aa
-  thread won't be influenced by the those changes anymore.  So if you
51f0aa
-  set RES_USE_INET6, a call to `gethostbyname' won't return any IPv6
51f0aa
-  hosts anymore.  If you recompile such programs, manipulating the
51f0aa
-  _res structure will affect the thread in which you do so instead of
51f0aa
-  the "main" thread.
51f0aa
+  thread won't be influenced by the those changes anymore.
51f0aa
 
51f0aa
 We recommend to use the new thread-safe interfaces in new code, since
51f0aa
 the traditional interfaces have been deprecated by the BIND folks.
51f0aa
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
51f0aa
index 774d575dd1ce22af..7fc154db5d3130a3 100644
51f0aa
--- a/resolv/nss_dns/dns-host.c
51f0aa
+++ b/resolv/nss_dns/dns-host.c
51f0aa
@@ -82,7 +82,8 @@
51f0aa
 
51f0aa
 #include "nsswitch.h"
51f0aa
 
51f0aa
-/* Get implementation for some internal functions.  */
51f0aa
+/* Get implementeation for some internal functions.  */
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <resolv/mapv4v6addr.h>
51f0aa
 #include <resolv/mapv4v6hostent.h>
51f0aa
 
51f0aa
@@ -221,7 +222,7 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
51f0aa
       /* If we are looking for an IPv6 address and mapping is enabled
51f0aa
 	 by having the RES_USE_INET6 bit in _res.options set, we try
51f0aa
 	 another lookup.  */
51f0aa
-      if (af == AF_INET6 && (_res.options & RES_USE_INET6))
51f0aa
+      if (af == AF_INET6 && res_use_inet6 ())
51f0aa
 	n = __libc_res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf->buf,
51f0aa
 				host_buffer.buf != orig_host_buffer
51f0aa
 				? MAXPACKET : 1024, &host_buffer.ptr,
51f0aa
@@ -266,7 +267,7 @@ _nss_dns_gethostbyname_r (const char *name, struct hostent *result,
51f0aa
 {
51f0aa
   enum nss_status status = NSS_STATUS_NOTFOUND;
51f0aa
 
51f0aa
-  if (_res.options & RES_USE_INET6)
51f0aa
+  if (res_use_inet6 ())
51f0aa
     status = _nss_dns_gethostbyname3_r (name, AF_INET6, result, buffer,
51f0aa
 					buflen, errnop, h_errnop, NULL, NULL);
51f0aa
   if (status == NSS_STATUS_NOTFOUND)
51f0aa
@@ -519,17 +520,6 @@ _nss_dns_gethostbyaddr2_r (const void *addr, socklen_t len, int af,
51f0aa
   memcpy (host_data->host_addr, addr, len);
51f0aa
   host_data->h_addr_ptrs[0] = (char *) host_data->host_addr;
51f0aa
   host_data->h_addr_ptrs[1] = NULL;
51f0aa
-#if 0
51f0aa
-  /* XXX I think this is wrong.  Why should an IPv4 address be
51f0aa
-     converted to IPv6 if the user explicitly asked for IPv4?  */
51f0aa
-  if (af == AF_INET && (_res.options & RES_USE_INET6))
51f0aa
-    {
51f0aa
-      map_v4v6_address ((char *) host_data->host_addr,
51f0aa
-			(char *) host_data->host_addr);
51f0aa
-      result->h_addrtype = AF_INET6;
51f0aa
-      result->h_length = IN6ADDRSZ;
51f0aa
-    }
51f0aa
-#endif
51f0aa
   *h_errnop = NETDB_SUCCESS;
51f0aa
   return NSS_STATUS_SUCCESS;
51f0aa
 }
51f0aa
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
51f0aa
index 3daa44e273db5a41..6549e4ba5ee77f93 100644
51f0aa
--- a/resolv/res_debug.c
51f0aa
+++ b/resolv/res_debug.c
51f0aa
@@ -106,7 +106,7 @@ static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vix
51f0aa
 #include <errno.h>
51f0aa
 #include <math.h>
51f0aa
 #include <netdb.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <stdio.h>
51f0aa
 #include <stdlib.h>
51f0aa
 #include <string.h>
51f0aa
@@ -582,7 +582,7 @@ p_option(u_long option) {
51f0aa
 	case RES_DNSRCH:	return "dnsrch";
51f0aa
 	case RES_INSECURE1:	return "insecure1";
51f0aa
 	case RES_INSECURE2:	return "insecure2";
51f0aa
-	case RES_USE_INET6:	return "inet6";
51f0aa
+	case DEPRECATED_RES_USE_INET6:	return "inet6";
51f0aa
 	case RES_ROTATE:	return "rotate";
51f0aa
 	case RES_NOCHECKNAME:	return "no-check-names";
51f0aa
 	case RES_USEBSTRING:	return "ip6-bytstring";
51f0aa
diff --git a/resolv/res_init.c b/resolv/res_init.c
51f0aa
index 2e3d0f746e855aff..0ed74e0520131418 100644
51f0aa
--- a/resolv/res_init.c
51f0aa
+++ b/resolv/res_init.c
51f0aa
@@ -71,7 +71,7 @@ static const char rcsid[] = "$BINDId: res_init.c,v 8.16 2000/05/09 07:10:12 vixi
51f0aa
 
51f0aa
 #include <ctype.h>
51f0aa
 #include <netdb.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <stdio.h>
51f0aa
 #include <stdio_ext.h>
51f0aa
 #include <stdlib.h>
51f0aa
@@ -530,7 +530,7 @@ res_setoptions(res_state statp, const char *options, const char *source) {
51f0aa
 		    unsigned long int flag;
51f0aa
 		  } options[] = {
51f0aa
 #define STRnLEN(str) str, sizeof (str) - 1
51f0aa
-		    { STRnLEN ("inet6"), 0, RES_USE_INET6 },
51f0aa
+		    { STRnLEN ("inet6"), 0, DEPRECATED_RES_USE_INET6 },
51f0aa
 		    { STRnLEN ("ip6-bytestring"), 0, RES_USEBSTRING },
51f0aa
 		    { STRnLEN ("no-ip6-dotint"), 0, RES_NOIP6DOTINT },
51f0aa
 		    { STRnLEN ("ip6-dotint"), 1, ~RES_NOIP6DOTINT },
51f0aa
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
51f0aa
new file mode 100644
51f0aa
index 0000000000000000..269758c416544cb4
51f0aa
--- /dev/null
51f0aa
+++ b/resolv/resolv-internal.h
51f0aa
@@ -0,0 +1,35 @@
51f0aa
+/* libresolv interfaces for internal use across glibc.
51f0aa
+   Copyright (C) 2016 Free Software Foundation, Inc.
51f0aa
+   This file is part of the GNU C Library.
51f0aa
+
51f0aa
+   The GNU C Library is free software; you can redistribute it and/or
51f0aa
+   modify it under the terms of the GNU Lesser General Public
51f0aa
+   License as published by the Free Software Foundation; either
51f0aa
+   version 2.1 of the License, or (at your option) any later version.
51f0aa
+
51f0aa
+   The GNU C Library is distributed in the hope that it will be useful,
51f0aa
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
51f0aa
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
51f0aa
+   Lesser General Public License for more details.
51f0aa
+
51f0aa
+   You should have received a copy of the GNU Lesser General Public
51f0aa
+   License along with the GNU C Library; if not, see
51f0aa
+   <http://www.gnu.org/licenses/>.  */
51f0aa
+
51f0aa
+#ifndef _RESOLV_INTERNAL_H
51f0aa
+#define _RESOLV_INTERNAL_H 1
51f0aa
+
51f0aa
+#include <resolv.h>
51f0aa
+#include <stdbool.h>
51f0aa
+
51f0aa
+/* Internal version of RES_USE_INET6 which does not trigger a
51f0aa
+   deprecation warning.  */
51f0aa
+#define DEPRECATED_RES_USE_INET6 0x00002000
51f0aa
+
51f0aa
+static inline bool
51f0aa
+res_use_inet6 (void)
51f0aa
+{
51f0aa
+  return _res.options & DEPRECATED_RES_USE_INET6;
51f0aa
+}
51f0aa
+
51f0aa
+#endif  /* _RESOLV_INTERNAL_H */
51f0aa
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
51f0aa
index a678d8d7e8b23d1d..7a6cf71c170ec42f 100644
51f0aa
--- a/sysdeps/posix/getaddrinfo.c
51f0aa
+++ b/sysdeps/posix/getaddrinfo.c
51f0aa
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51f0aa
 #include <ifaddrs.h>
51f0aa
 #include <netdb.h>
51f0aa
 #include <nss.h>
51f0aa
-#include <resolv.h>
51f0aa
+#include <resolv/resolv-internal.h>
51f0aa
 #include <stdbool.h>
51f0aa
 #include <stdio.h>
51f0aa
 #include <stdio_ext.h>
51f0aa
@@ -222,7 +222,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
51f0aa
       if (herrno == NETDB_INTERNAL)					      \
51f0aa
 	{								      \
51f0aa
 	  __set_h_errno (herrno);					      \
51f0aa
-	  _res.options |= old_res_options & RES_USE_INET6;		      \
51f0aa
+	  _res.options |= old_res_options & DEPRECATED_RES_USE_INET6;	      \
51f0aa
 	  result = -EAI_SYSTEM;						      \
51f0aa
 	  goto free_and_return;						      \
51f0aa
 	}								      \
51f0aa
@@ -839,7 +839,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
51f0aa
 	     addresses to IPv6 addresses.  Currently this is decided
51f0aa
 	     by setting the RES_USE_INET6 bit in _res.options.  */
51f0aa
 	  old_res_options = _res.options;
51f0aa
-	  _res.options &= ~RES_USE_INET6;
51f0aa
+	  _res.options &= ~DEPRECATED_RES_USE_INET6;
51f0aa
 
51f0aa
 	  size_t tmpbuflen = 1024 + sizeof(struct gaih_addrtuple);
51f0aa
 	  malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen);
51f0aa
@@ -900,7 +900,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
51f0aa
 						2 * tmpbuflen);
51f0aa
 			  if (newp == NULL)
51f0aa
 			    {
51f0aa
-			      _res.options |= old_res_options & RES_USE_INET6;
51f0aa
+			      _res.options |= old_res_options & DEPRECATED_RES_USE_INET6;
51f0aa
 			      result = -EAI_MEMORY;
51f0aa
 			      goto free_and_return;
51f0aa
 			    }
51f0aa
@@ -1021,7 +1021,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
51f0aa
 				      if (canonbuf == NULL)
51f0aa
 					{
51f0aa
 					  _res.options
51f0aa
-					    |= old_res_options & RES_USE_INET6;
51f0aa
+					    |= old_res_options
51f0aa
+					       & DEPRECATED_RES_USE_INET6;
51f0aa
 					  result = -EAI_MEMORY;
51f0aa
 					  goto free_and_return;
51f0aa
 					}
51f0aa
@@ -1082,7 +1083,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
51f0aa
 		nip = nip->next;
51f0aa
 	    }
51f0aa
 
51f0aa
-	  _res.options |= old_res_options & RES_USE_INET6;
51f0aa
+	  _res.options |= old_res_options & DEPRECATED_RES_USE_INET6;
51f0aa
 
51f0aa
 	  if (h_errno == NETDB_INTERNAL)
51f0aa
 	    {