resolv: Remove support for RES_USE_INET6 and the inet6 option
diff mbox series

Message ID 87tvjxknpk.fsf@oldenburg.str.redhat.com
State New
Headers show
Series
  • resolv: Remove support for RES_USE_INET6 and the inet6 option
Related show

Commit Message

Florian Weimer Dec. 1, 2018, 8:15 p.m. UTC
This functionality was deprecated in glibc 2.25.

2018-12-01  Florian Weimer  <fweimer@redhat.com>

	resolv: Remove support for RES_USE_INET6 and the inet6 option.
	* nis/nss_nis/nis-hosts.c (_nss_nis_gethostent_r): Always pass
	AF_INET with no mapping flags to internal_nis_gethostent_r.
	(_nss_nis_gethostbyname2_r): Always pass no mapping flags to
	internal_nis_gethostent_r.
	(_nss_nis_gethostbyname_r): Do not attempt IPv6 query.
	(_nss_nis_gethostbyaddr_r): Do not request IPv4 address mapping
	from parse_line.
	* nis/nss_nisplis/nisplus-hosts.c (_nss_nisplus_parse_hostent):
	Remove flags argument.
	(internal_nisplus_gethostent_r): Adjust call to
	_nss_nisplus_parse_hostent.
	(internal_gethostbyname2_r): Remove flags argument.  Adjust call
	to _nss_nisplus_parse_hostent.
	(_nss_nisplus_gethostbyname2_r): Adjust call to
	internal_gethostbyname2_r.
	(_nss_nisplus_gethostbyname_r): Do not perform IPv6 lookup.
	(_nss_nisplus_gethostbyaddr_r): Adjust call to
	internal_gethostbyname2_r.
	* nscd/aicache.c (addhstaiX): Do not disable RES_USE_INET6.
	* nscd/nscd_gehst_r.c (__nscd_gethostbyname_r): Always use
	GETHOSTBYNAME.
	* nss/digits_dots.c (__nss_hostname_digits_dots_context): Do not
	call res_use_inet6.
	* nss/nss_files/files-hosts.c (EXTRA_ARGS_VALUE): Do not call
	res_use_inet6.
	(_nss_files_gethostbyname3_r): Do not perform IPv4 address mapping
	via internal_getent and gethostbyname3_multi.
	(_nss_files_gethostbyname_r): Always use AF_INET.
	* resolv/Makefile (tests): Remove tst-res_use_inet6.
	(tests-internal): Remove tst-resolv-res_init,
	tst-resolv-res_init-thread.
	(tst-res_use_inet6): Remove target.
	(CFLAGS-tst-res_use_inet6.c): Do not set.
	* resolv/compat-gethnamaddr.c (map_v4v6_address)
	(map_v4v6_hostent): Remove functions.
	(res_gethostbyname): Do not perform IPv6 lookup.
	(res_gethostbyname2_context): Do not map IPv4 addresses.
	(res_gethostbyaddr_context): Likewise.
	(_gethtent): Likewise.
	(_gethtbyname): Do not perform IPv6 lookup.
	(resolv/nss_dns/dns-host.c (gethostbyname3_context): Likewise.
	(_nss_dns_gethostbyname_r): Do not request IPv4 address mapping
	from gethostbyname3_context.
	* resolv/res_debug.c (p_option): Remove "inet6" support.
	* resolv/res_init.c (res_setoptions): Likewise.
	* resolv/res_use_inet6.h: Remove file.
	* resolv/resolv-internal.h (DEPRECATED_RES_USE_INET6): Remove
	definition.
	(res_use_inet6): Remove function.
	* resolv/resolv.h (RES_USE_INET6): Remove definition.
	* resolv/resolv_context.h: Adjust file comment.
	(struct resolv_context): Update comment on __next field.
	(__resolv_context_put): Update comment.
	* resolv/tst-res_use_inet6.c: Remove file.
	* resolv/tst-resolv-res_init-skeleton.c (print_resp): Remove
	"inet6" support.
	(test_cases): Adjust test case.
	* resolv/tst-resolv-threads.c (byname_inet6) Remove function.
	(thread_byname2_af_inet6): Use old byname_inet6 code.
	(thread_byname_inet6, thread_byname2_af_inet6): Remove functions.
	(gai): Remove do_inet6 argument.
	(thread_gai_inet, thread_gai_inet6, thread_gai_unspec): Adjust.
	(thread_gai_inet_inet6, thread_gai_inet6_inet6)
	(thread_gai_unspec_inet6): Remove functions.
	(do_test): Adjust thread_funcs.
	* sysdeps/posix/getaddrinfo.c (gethosts): Do not restore
	RES_USE_INET6 flag.
	(gaih_inet): Do not disable RES_USE_INET6 flag.

Comments

Florian Weimer Dec. 5, 2018, 1:22 p.m. UTC | #1
* Florian Weimer:

> This functionality was deprecated in glibc 2.25.

Do you think we can remove the functionality, or should we wait some
more time?

Thanks,
Florian
Florian Weimer Feb. 11, 2019, 9:23 a.m. UTC | #2
* Florian Weimer:

> * Florian Weimer:
>
>> This functionality was deprecated in glibc 2.25.
>
> Do you think we can remove the functionality, or should we wait some
> more time?

I'm going to commit this to master soon.  I asked on dns-operations, and
no one wants to keep this interface:

<https://lists.dns-oarc.net/pipermail/dns-operations/2019-February/018384.html>

Thanks,
Florian
Adhemerval Zanella Feb. 11, 2019, 12:31 p.m. UTC | #3
On 11/02/2019 07:23, Florian Weimer wrote:
> * Florian Weimer:
> 
>> * Florian Weimer:
>>
>>> This functionality was deprecated in glibc 2.25.
>>
>> Do you think we can remove the functionality, or should we wait some
>> more time?
> 
> I'm going to commit this to master soon.  I asked on dns-operations, and
> no one wants to keep this interface:
> 
> <https://lists.dns-oarc.net/pipermail/dns-operations/2019-February/018384.html>
> 
> Thanks,
> Florian
> 

Should we  should keep tst-res_use_inet6 to check if RES_USE_INET6 
is really not supported?
Florian Weimer Feb. 11, 2019, 12:34 p.m. UTC | #4
* Adhemerval Zanella:

> Should we  should keep tst-res_use_inet6 to check if RES_USE_INET6
> is really not supported?

No, I don't think so.  It may make sense to have a test that checks that
with all supported options enabled, none of the legacy bits are set (of
which RES_USE_INET6 is just one).

Thanks,
Florian
Florian Weimer Feb. 18, 2019, 3:42 p.m. UTC | #5
* Florian Weimer:

> This functionality was deprecated in glibc 2.25.
>
> 2018-12-01  Florian Weimer  <fweimer@redhat.com>
>
> 	resolv: Remove support for RES_USE_INET6 and the inet6 option.

This patch is too large.  I missed some cleanups in the NIS and
nss_files code, so it is getting even larger.

I will post some of the changes separately, as smaller patches.

Thanks,
Florian

Patch
diff mbox series

diff --git a/NEWS b/NEWS
index 30b9d8975a..e401aaedfc 100644
--- a/NEWS
+++ b/NEWS
@@ -61,6 +61,9 @@  Deprecated and removed features, and other changes affecting compatibility:
   fp_query, and p_query have been removed.  Printing of DNS queries is no
   longer support.
 
+* Support for the "inet6" option in /etc/resolv.conf and the RES_USE_INET6
+  resolver flag (deprecated in glibc 2.25) has been removed.
+
 Changes to build and runtime requirements:
 
 * Python 3.4 or later is required to build the GNU C Library.
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index a6d56bc725..5c3efe84a4 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -231,8 +231,7 @@  _nss_nis_gethostent_r (struct hostent *host, char *buffer, size_t buflen,
   __libc_lock_lock (lock);
 
   status = internal_nis_gethostent_r (host, buffer, buflen, errnop, h_errnop,
-			(res_use_inet6 () ? AF_INET6 : AF_INET),
-			(res_use_inet6 () ? AI_V4MAPPED : 0 ));
+				      AF_INET, 0);
 
   __libc_lock_unlock (lock);
 
@@ -350,8 +349,7 @@  _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
     }
 
   return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
-				    h_errnop,
-			(res_use_inet6 () ? AI_V4MAPPED : 0));
+				    h_errnop, 0);
 }
 
 
@@ -359,16 +357,6 @@  enum nss_status
 _nss_nis_gethostbyname_r (const char *name, struct hostent *host, char *buffer,
 			  size_t buflen, int *errnop, int *h_errnop)
 {
-  if (res_use_inet6 ())
-    {
-      enum nss_status status;
-
-      status = internal_gethostbyname2_r (name, AF_INET6, host, buffer, buflen,
-					  errnop, h_errnop, AI_V4MAPPED);
-      if (status == NSS_STATUS_SUCCESS)
-	return status;
-    }
-
   return internal_gethostbyname2_r (name, AF_INET, host, buffer, buflen,
 				    errnop, h_errnop, 0);
 }
@@ -432,8 +420,7 @@  _nss_nis_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
     ++p;
   free (result);
 
-  int parse_res = parse_line (p, host, data, buflen, errnop, af,
-			      (res_use_inet6 () ? AI_V4MAPPED : 0));
+  int parse_res = parse_line (p, host, data, buflen, errnop, af, 0);
   if (__glibc_unlikely (parse_res < 1))
     {
       if (parse_res == -1)
diff --git a/nis/nss_nisplus/nisplus-hosts.c b/nis/nss_nisplus/nisplus-hosts.c
index 3165d560fa..d7c45b8e4c 100644
--- a/nis/nss_nisplus/nisplus-hosts.c
+++ b/nis/nss_nisplus/nisplus-hosts.c
@@ -49,8 +49,7 @@  static u_long tablename_len;
 
 static int
 _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
-			    char *buffer, size_t buflen, int *errnop,
-			    int flags)
+			    char *buffer, size_t buflen, int *errnop)
 {
   unsigned int i;
   char *first_unused = buffer;
@@ -67,8 +66,7 @@  _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
 
   char *data = first_unused;
 
-  if (room_left < (af != AF_INET || (flags & AI_V4MAPPED) != 0
-		   ? IN6ADDRSZ : INADDRSZ))
+  if (room_left < (af != AF_INET ? IN6ADDRSZ : INADDRSZ))
     {
     no_more_room:
       *errnop = ERANGE;
@@ -79,18 +77,8 @@  _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
   if (af != AF_INET6
       && inet_pton (AF_INET, NISENTRYVAL (0, 2, result), data) > 0)
     {
-      assert ((flags & AI_V4MAPPED) == 0 || af != AF_UNSPEC);
-      if (flags & AI_V4MAPPED)
-	{
-	  map_v4v6_address (data, data);
-	  host->h_addrtype = AF_INET6;
-	  host->h_length = IN6ADDRSZ;
-	}
-      else
-	{
-	  host->h_addrtype = AF_INET;
-	  host->h_length = INADDRSZ;
-	}
+      host->h_addrtype = AF_INET;
+      host->h_length = INADDRSZ;
     }
   else if (af != AF_INET
 	   && inet_pton (AF_INET6, NISENTRYVAL (0, 2, result), data) > 0)
@@ -322,12 +310,8 @@  internal_nisplus_gethostent_r (struct hostent *host, char *buffer,
 	    }
 	}
 
-      if (res_use_inet6 ())
-	parse_res = _nss_nisplus_parse_hostent (result, AF_INET6, host, buffer,
-						buflen, errnop, AI_V4MAPPED);
-      else
-	parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer,
-						buflen, errnop, 0);
+      parse_res = _nss_nisplus_parse_hostent (result, AF_INET, host, buffer,
+					      buflen, errnop);
 
       if (parse_res == -1)
 	{
@@ -382,7 +366,7 @@  get_tablename (int *herrnop)
 static enum nss_status
 internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
 			   char *buffer, size_t buflen, int *errnop,
-			   int *herrnop, int flags)
+			   int *herrnop)
 {
   if (tablename_val == NULL)
     {
@@ -457,7 +441,7 @@  internal_gethostbyname2_r (const char *name, int af, struct hostent *host,
     }
 
   int parse_res = _nss_nisplus_parse_hostent (result, af, host, buffer,
-					      buflen, errnop, flags);
+					      buflen, errnop);
 
   nis_freeresult (result);
 
@@ -488,8 +472,7 @@  _nss_nisplus_gethostbyname2_r (const char *name, int af, struct hostent *host,
     }
 
   return internal_gethostbyname2_r (name, af, host, buffer, buflen, errnop,
-				    herrnop,
-				    (res_use_inet6 () ? AI_V4MAPPED : 0));
+				    herrnop, 0);
 }
 
 
@@ -498,17 +481,6 @@  _nss_nisplus_gethostbyname_r (const char *name, struct hostent *host,
 			      char *buffer, size_t buflen, int *errnop,
 			      int *h_errnop)
 {
-  if (res_use_inet6 ())
-    {
-      enum nss_status status;
-
-      status = internal_gethostbyname2_r (name, AF_INET6, host, buffer,
-					  buflen, errnop, h_errnop,
-					  AI_V4MAPPED);
-      if (status == NSS_STATUS_SUCCESS)
-	return status;
-    }
-
   return internal_gethostbyname2_r (name, AF_INET, host, buffer,
 				   buflen, errnop, h_errnop, 0);
 }
@@ -558,9 +530,7 @@  _nss_nisplus_gethostbyaddr_r (const void *addr, socklen_t addrlen, int af,
     }
 
   parse_res = _nss_nisplus_parse_hostent (result, af, host,
-					  buffer, buflen, errnop,
-					  (res_use_inet6 ()
-					   ? AI_V4MAPPED : 0));
+					  buffer, buflen, errnop, 0);
   nis_freeresult (result);
 
   if (parse_res > 0)
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 439e0ea126..bf6c471ed3 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -27,7 +27,6 @@ 
 #include <sys/mman.h>
 #include <resolv/resolv-internal.h>
 #include <resolv/resolv_context.h>
-#include <resolv/res_use_inet6.h>
 #include <scratch_buffer.h>
 
 #include "dbg_log.h"
@@ -100,12 +99,8 @@  addhstaiX (struct database_dyn *db, int fd, request_header *req,
     no_more = 0;
   nip = hosts_database;
 
-  /* Initialize configurations.  If we are looking for both IPv4 and
-     IPv6 address we don't want the lookup functions to automatically
-     promote IPv4 addresses to IPv6 addresses.  Therefore, use the
-     _no_inet6 variant.  */
+  /* Initialize configurations.  */
   struct resolv_context *ctx = __resolv_context_get ();
-  bool enable_inet6 = __resolv_context_disable_inet6 (ctx);
   if (ctx == NULL)
     no_more = 1;
 
@@ -513,7 +508,6 @@  next_nip:
    }
 
  out:
-  __resolv_context_enable_inet6 (ctx, enable_inet6);
   __resolv_context_put (ctx);
 
   if (dataset != NULL && !alloca_used)
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index edff48eac4..3af5ec2fe8 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -40,11 +40,7 @@  __nscd_gethostbyname_r (const char *name, struct hostent *resultbuf,
 			char *buffer, size_t buflen, struct hostent **result,
 			int *h_errnop)
 {
-  request_type reqtype;
-
-  reqtype = res_use_inet6 () ? GETHOSTBYNAMEv6 : GETHOSTBYNAME;
-
-  return nscd_gethst_r (name, strlen (name) + 1, reqtype, resultbuf,
+  return nscd_gethst_r (name, strlen (name) + 1, GETHOSTBYNAME, resultbuf,
 			buffer, buflen, result, h_errnop);
 }
 
diff --git a/nss/digits_dots.c b/nss/digits_dots.c
index 39bff38865..e5613572f7 100644
--- a/nss/digits_dots.c
+++ b/nss/digits_dots.c
@@ -84,20 +84,12 @@  __nss_hostname_digits_dots_context (struct resolv_context *ctx,
       size_t size_needed;
       int addr_size;
 
-      switch (af)
+      if (af == AF_INET6)
+	addr_size = IN6ADDRSZ;
+      else
 	{
-	case AF_INET:
+	  af = AF_INET;
 	  addr_size = INADDRSZ;
-	  break;
-
-	case AF_INET6:
-	  addr_size = IN6ADDRSZ;
-	  break;
-
-	default:
-	  af = res_use_inet6 () ? AF_INET6 : AF_INET;
-	  addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
-	  break;
 	}
 
       size_needed = (sizeof (*host_addr)
@@ -182,31 +174,8 @@  __nss_hostname_digits_dots_context (struct resolv_context *ctx,
 		  (*h_addr_ptrs)[0] = (char *) host_addr;
 		  (*h_addr_ptrs)[1] = NULL;
 		  resbuf->h_addr_list = *h_addr_ptrs;
-		  if (af == AF_INET && res_use_inet6 ())
-		    {
-		      /* We need to change the IP v4 address into the
-			 IP v6 address.  */
-		      char tmp[INADDRSZ];
-		      char *p = (char *) host_addr;
-		      int i;
-
-		      /* Save a copy of the IP v4 address. */
-		      memcpy (tmp, host_addr, INADDRSZ);
-		      /* Mark this ipv6 addr as a mapped ipv4. */
-		      for (i = 0; i < 10; i++)
-			*p++ = 0x00;
-		      *p++ = 0xff;
-		      *p++ = 0xff;
-		      /* Copy the IP v4 address. */
-		      memcpy (p, tmp, INADDRSZ);
-		      resbuf->h_addrtype = AF_INET6;
-		      resbuf->h_length = IN6ADDRSZ;
-		    }
-		  else
-		    {
-		      resbuf->h_addrtype = af;
-		      resbuf->h_length = addr_size;
-		    }
+		  resbuf->h_addrtype = af;
+		  resbuf->h_length = addr_size;
 		  if (h_errnop != NULL)
 		    *h_errnop = NETDB_SUCCESS;
 		  if (buffer_size == NULL)
@@ -226,12 +195,7 @@  __nss_hostname_digits_dots_context (struct resolv_context *ctx,
 	  switch (af)
 	    {
 	    default:
-	      af = res_use_inet6 () ? AF_INET6 : AF_INET;
-	      if (af == AF_INET6)
-		{
-		  addr_size = IN6ADDRSZ;
-		  break;
-		}
+	      af = AF_INET;
 	      /* FALLTHROUGH */
 
 	    case AF_INET:
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
index 87c0af8cfe..9ccef3e290 100644
--- a/nss/nss_files/files-hosts.c
+++ b/nss/nss_files/files-hosts.c
@@ -99,9 +99,7 @@  LINE_PARSER
    STRING_FIELD (result->h_name, isspace, 1);
  })
 
-#define EXTRA_ARGS_VALUE \
-  , (res_use_inet6 () ? AF_INET6 : AF_INET),		      \
-  (res_use_inet6 () ? AI_V4MAPPED : 0)
+#define EXTRA_ARGS_VALUE , AF_INET, 0
 #include "files-XXX.c"
 #undef EXTRA_ARGS_VALUE
 
@@ -345,12 +343,8 @@  _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
 
   if (status == NSS_STATUS_SUCCESS)
     {
-      /* XXX Is using _res to determine whether we want to convert IPv4
-         addresses to IPv6 addresses really the right thing to do?  */
-      int flags = (res_use_inet6 () ? AI_V4MAPPED : 0);
-
       while ((status = internal_getent (stream, result, buffer, buflen, errnop,
-					herrnop, af, flags))
+					herrnop, af, 0))
 	     == NSS_STATUS_SUCCESS)
 	{
 	  LOOKUP_NAME_CASE (h_name, h_aliases)
@@ -359,7 +353,7 @@  _nss_files_gethostbyname3_r (const char *name, int af, struct hostent *result,
       if (status == NSS_STATUS_SUCCESS
 	  && _res_hconf.flags & HCONF_FLAG_MULTI)
 	status = gethostbyname3_multi
-	  (stream, name, af, result, buffer, buflen, errnop, herrnop, flags);
+	  (stream, name, af, result, buffer, buflen, errnop, herrnop, 0);
 
       internal_endent (&stream);
     }
@@ -375,9 +369,7 @@  _nss_files_gethostbyname_r (const char *name, struct hostent *result,
 			    char *buffer, size_t buflen, int *errnop,
 			    int *herrnop)
 {
-  int af = (res_use_inet6 () ? AF_INET6 : AF_INET);
-
-  return _nss_files_gethostbyname3_r (name, af, result, buffer, buflen,
+  return _nss_files_gethostbyname3_r (name, AF_INET, result, buffer, buflen,
 				      errnop, herrnop, NULL, NULL);
 }
 
diff --git a/resolv/Makefile b/resolv/Makefile
index ea395ac3eb..3a9452fe1b 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -49,7 +49,6 @@  tests += \
   tst-ns_name_pton \
   tst-res_hconf_reorder \
   tst-res_hnok \
-  tst-res_use_inet6 \
   tst-resolv-basic \
   tst-resolv-binary \
   tst-resolv-edns \
@@ -65,11 +64,6 @@  tests += \
   tst-resolv-ai_idn-nolibidn2 \
   tst-resolv-canonname \
 
-# uses DEPRECATED_RES_USE_INET6 from <resolv-internal.h>.
-tests-internal += \
-  tst-resolv-res_init \
-  tst-resolv-res_init-thread \
-
 # Needs resolv_context.
 tests-internal += \
   tst-resolv-res_ninit \
@@ -170,7 +164,6 @@  $(objpfx)mtrace-tst-resolv-res_ninit.out: $(objpfx)tst-resolv-res_ninit.out
 
 $(objpfx)tst-bug18665-tcp: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-bug18665: $(objpfx)libresolv.so $(shared-thread-library)
-$(objpfx)tst-res_use_inet6: $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-ai_idn: \
   $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
 $(objpfx)tst-resolv-ai_idn-latin1: \
@@ -204,7 +197,3 @@  $(objpfx)tst-ns_name_compress: $(objpfx)libresolv.so
 $(objpfx)tst-ns_name_pton: $(objpfx)libresolv.so
 $(objpfx)tst-res_hnok: $(objpfx)libresolv.so
 $(objpfx)tst-p_secstodate: $(objpfx)libresolv.so
-
-
-# This test case uses the deprecated RES_USE_INET6 resolver option.
-CFLAGS-tst-res_use_inet6.c += -Wno-error
diff --git a/resolv/compat-gethnamaddr.c b/resolv/compat-gethnamaddr.c
index cddda2b353..261a3b43bf 100644
--- a/resolv/compat-gethnamaddr.c
+++ b/resolv/compat-gethnamaddr.c
@@ -88,9 +88,6 @@  static int stayopen = 0;
 static struct hostent *res_gethostbyname2_context (struct resolv_context *,
 						   const char *name, int af);
 
-static void map_v4v6_address (const char *src, char *dst) __THROW;
-static void map_v4v6_hostent (struct hostent *hp, char **bp, int *len) __THROW;
-
 # if PACKETSZ > 65536
 #  define	MAXPACKET	PACKETSZ
 # else
@@ -386,8 +383,6 @@  getanswer (const querybuf *answer, int anslen, const char *qname, int qtype)
 			bp += n;
 			buflen -= n;
 		}
-		if (res_use_inet6 ())
-			map_v4v6_hostent(&host, &bp, &buflen);
 		__set_h_errno (NETDB_SUCCESS);
 		return (&host);
 	}
@@ -409,15 +404,6 @@  res_gethostbyname (const char *name)
       return NULL;
     }
 
-  if (res_use_inet6 ())
-    {
-      struct hostent *hp = res_gethostbyname2_context (ctx, name, AF_INET6);
-      if (hp != NULL)
-	{
-	  __resolv_context_put (ctx);
-	  return hp;
-	}
-    }
   struct hostent *hp = res_gethostbyname2_context (ctx, name, AF_INET);
   __resolv_context_put (ctx);
   return hp;
@@ -435,8 +421,7 @@  res_gethostbyname2_context (struct resolv_context *ctx,
 	} buf;
 	querybuf *origbuf;
 	const char *cp;
-	char *bp;
-	int n, size, type, len;
+	int n, size, type;
 	struct hostent *ret;
 
 	switch (af) {
@@ -487,16 +472,12 @@  res_gethostbyname2_context (struct resolv_context *ctx,
 				}
 				strncpy(hostbuf, name, MAXDNAME);
 				hostbuf[MAXDNAME] = '\0';
-				bp = hostbuf + MAXDNAME;
-				len = sizeof hostbuf - MAXDNAME;
 				host.h_name = hostbuf;
 				host.h_aliases = host_aliases;
 				host_aliases[0] = NULL;
 				h_addr_ptrs[0] = (char *)host_addr;
 				h_addr_ptrs[1] = NULL;
 				host.h_addr_list = h_addr_ptrs;
-				if (res_use_inet6 ())
-					map_v4v6_hostent(&host, &bp, &len);
 				__set_h_errno (NETDB_SUCCESS);
 				return (&host);
 			}
@@ -520,8 +501,6 @@  res_gethostbyname2_context (struct resolv_context *ctx,
 				}
 				strncpy(hostbuf, name, MAXDNAME);
 				hostbuf[MAXDNAME] = '\0';
-				bp = hostbuf + MAXDNAME;
-				len = sizeof hostbuf - MAXDNAME;
 				host.h_name = hostbuf;
 				host.h_aliases = host_aliases;
 				host_aliases[0] = NULL;
@@ -654,11 +633,6 @@  res_gethostbyaddr_context (struct resolv_context *ctx,
 	memmove(host_addr, addr, len);
 	h_addr_ptrs[0] = (char *)host_addr;
 	h_addr_ptrs[1] = NULL;
-	if (af == AF_INET && res_use_inet6 ()) {
-		map_v4v6_address((char*)host_addr, (char*)host_addr);
-		hp->h_addrtype = AF_INET6;
-		hp->h_length = IN6ADDRSZ;
-	}
 	__set_h_errno (NETDB_SUCCESS);
 	return (hp);
 }
@@ -727,14 +701,7 @@  _gethtent (void)
 		af = AF_INET6;
 		len = IN6ADDRSZ;
 	} else if (inet_pton(AF_INET, p, host_addr) > 0) {
-		if (res_use_inet6 ()) {
-			map_v4v6_address((char*)host_addr, (char*)host_addr);
-			af = AF_INET6;
-			len = IN6ADDRSZ;
-		} else {
-			af = AF_INET;
-			len = INADDRSZ;
-		}
+		af = AF_INET;
 	} else {
 		goto again;
 	}
@@ -769,13 +736,6 @@  compat_symbol (libresolv, _gethtent, _gethtent, GLIBC_2_0);
 struct hostent *
 _gethtbyname (const char *name)
 {
-	struct hostent *hp;
-
-	if (res_use_inet6 ()) {
-		hp = _gethtbyname2(name, AF_INET6);
-		if (hp)
-			return (hp);
-	}
 	return (_gethtbyname2(name, AF_INET));
 }
 compat_symbol (libresolv, _gethtbyname, _gethtbyname, GLIBC_2_0);
@@ -818,48 +778,4 @@  _gethtbyaddr (const char *addr, size_t len, int af)
 libresolv_hidden_def (_gethtbyaddr)
 compat_symbol (libresolv, _gethtbyaddr, _gethtbyaddr, GLIBC_2_0);
 
-static void
-map_v4v6_address (const char *src, char *dst)
-{
-	u_char *p = (u_char *)dst;
-	char tmp[INADDRSZ];
-	int i;
-
-	/* Stash a temporary copy so our caller can update in place. */
-	memcpy(tmp, src, INADDRSZ);
-	/* Mark this ipv6 addr as a mapped ipv4. */
-	for (i = 0; i < 10; i++)
-		*p++ = 0x00;
-	*p++ = 0xff;
-	*p++ = 0xff;
-	/* Retrieve the saved copy and we're done. */
-	memcpy((void*)p, tmp, INADDRSZ);
-}
-
-static void
-map_v4v6_hostent (struct hostent *hp, char **bpp, int *lenp)
-{
-	char **ap;
-
-	if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
-		return;
-	hp->h_addrtype = AF_INET6;
-	hp->h_length = IN6ADDRSZ;
-	for (ap = hp->h_addr_list; *ap; ap++) {
-		int i = sizeof(align) - ((u_long)*bpp % sizeof(align));
-
-		if (*lenp < (i + IN6ADDRSZ)) {
-			/* Out of memory.  Truncate address list here.  XXX */
-			*ap = NULL;
-			return;
-		}
-		*bpp += i;
-		*lenp -= i;
-		map_v4v6_address(*ap, *bpp);
-		*ap = *bpp;
-		*bpp += IN6ADDRSZ;
-		*lenp -= IN6ADDRSZ;
-	}
-}
-
 #endif	/* SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_25) */
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 5dc2829cd1..f640036f31 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -244,15 +244,6 @@  gethostbyname3_context (struct resolv_context *ctx,
       else
 	__set_errno (olderr);
 
-      /* If we are looking for an IPv6 address and mapping is enabled
-	 by having the RES_USE_INET6 bit in _res.options set, we try
-	 another lookup.  */
-      if (af == AF_INET6 && res_use_inet6 ())
-	n = __res_context_search (ctx, name, C_IN, T_A, host_buffer.buf->buf,
-				  host_buffer.buf != orig_host_buffer
-				  ? MAXPACKET : 1024, &host_buffer.ptr,
-				  NULL, NULL, NULL, NULL);
-
       if (n < 0)
 	{
 	  if (host_buffer.buf != orig_host_buffer)
@@ -296,13 +287,9 @@  _nss_dns_gethostbyname_r (const char *name, struct hostent *result,
       *h_errnop = NETDB_INTERNAL;
       return NSS_STATUS_UNAVAIL;
     }
-  enum nss_status status = NSS_STATUS_NOTFOUND;
-  if (res_use_inet6 ())
-    status = gethostbyname3_context (ctx, name, AF_INET6, result, buffer,
-				     buflen, errnop, h_errnop, NULL, NULL);
-  if (status == NSS_STATUS_NOTFOUND)
-    status = gethostbyname3_context (ctx, name, AF_INET, result, buffer,
-				     buflen, errnop, h_errnop, NULL, NULL);
+  enum nss_status status
+    = gethostbyname3_context (ctx, name, AF_INET, result, buffer,
+			      buflen, errnop, h_errnop, NULL, NULL);
   __resolv_context_put (ctx);
   return status;
 }
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 0c8056a679..f7895fc33e 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -443,7 +443,6 @@  p_option(u_long option) {
 	case RES_INSECURE1:	return "insecure1";
 	case RES_INSECURE2:	return "insecure2";
 	case RES_NOALIASES:	return "noaliases";
-	case DEPRECATED_RES_USE_INET6:	return "inet6";
 	case RES_ROTATE:	return "rotate";
 	case RES_USE_EDNS0:	return "edns0";
 	case RES_SNGLKUP:	return "single-request";
diff --git a/resolv/res_init.c b/resolv/res_init.c
index f5e52cbbb9..95af63fc42 100644
--- a/resolv/res_init.c
+++ b/resolv/res_init.c
@@ -667,7 +667,6 @@  res_setoptions (struct resolv_conf_parser *parser, const char *options)
             unsigned long int flag;
           } options[] = {
 #define STRnLEN(str) str, sizeof (str) - 1
-            { STRnLEN ("inet6"), 0, DEPRECATED_RES_USE_INET6 },
             { STRnLEN ("rotate"), 0, RES_ROTATE },
             { STRnLEN ("edns0"), 0, RES_USE_EDNS0 },
             { STRnLEN ("single-request-reopen"), 0, RES_SNGLKUPREOP },
diff --git a/resolv/res_use_inet6.h b/resolv/res_use_inet6.h
deleted file mode 100644
index dd5a31c54c..0000000000
--- a/resolv/res_use_inet6.h
+++ /dev/null
@@ -1,49 +0,0 @@ 
-/* Support functions for handling RES_USE_INET6 in getaddrinfo/nscd.
-   Copyright (C) 2017-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _RES_USE_INET6_H
-#define _RES_USE_INET6_H
-
-#include <resolv/resolv_context.h>
-#include <resolv/resolv-internal.h>
-
-/* Ensure that RES_USE_INET6 is disabled in *CTX.  Return true if
-   __resolv_context_enable_inet6 below should enable RES_USE_INET6
-   again.  */
-static inline bool
-__resolv_context_disable_inet6 (struct resolv_context *ctx)
-{
-  if (ctx != NULL && ctx->resp->options & DEPRECATED_RES_USE_INET6)
-    {
-      ctx->resp->options &= ~DEPRECATED_RES_USE_INET6;
-      return true;
-    }
-  else
-    return false;
-}
-
-/* If ENABLE, re-enable RES_USE_INET6 in *CTX.  To be paired with
-   __resolv_context_disable_inet6.  */
-static inline void
-__resolv_context_enable_inet6 (struct resolv_context *ctx, bool enable)
-{
-  if (ctx != NULL && enable)
-    ctx->resp->options |= DEPRECATED_RES_USE_INET6;
-}
-
-#endif
diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h
index b8e447c726..1e3d2ef9cb 100644
--- a/resolv/resolv-internal.h
+++ b/resolv/resolv-internal.h
@@ -27,17 +27,6 @@ 
 #define RES_F_CONN      0x00000002 /* Socket is connected.  */
 #define RES_F_EDNS0ERR  0x00000004 /* EDNS0 caused errors.  */
 
-
-/* Internal version of RES_USE_INET6 which does not trigger a
-   deprecation warning.  */
-#define DEPRECATED_RES_USE_INET6 0x00002000
-
-static inline bool
-res_use_inet6 (void)
-{
-  return _res.options & DEPRECATED_RES_USE_INET6;
-}
-
 enum
   {
     /* The advertized EDNS buffer size.  The value 1200 is derived
diff --git a/resolv/resolv.h b/resolv/resolv.h
index eff86cd456..4b09a5e9e7 100644
--- a/resolv/resolv.h
+++ b/resolv/resolv.h
@@ -118,8 +118,6 @@  struct res_sym {
 #define	RES_INSECURE1	0x00000400	/* type 1 security disabled */
 #define	RES_INSECURE2	0x00000800	/* type 2 security disabled */
 #define	RES_NOALIASES	0x00001000	/* shuts off HOSTALIASES feature */
-#define	RES_USE_INET6	\
-  __glibc_macro_warning ("RES_USE_INET6 is deprecated") 0x00002000
 #define RES_ROTATE	0x00004000	/* rotate ns list after each query */
 #define	RES_NOCHECKNAME \
   __glibc_macro_warning ("RES_NOCHECKNAME is deprecated") 0x00008000
diff --git a/resolv/resolv_context.h b/resolv/resolv_context.h
index c1dff76cb9..414578a61e 100644
--- a/resolv/resolv_context.h
+++ b/resolv/resolv_context.h
@@ -26,9 +26,7 @@ 
    allocating a new context.  This prevents unexpected reloading of
    the resolver configuration.  Care is taken to keep the context in
    sync with the thread-local _res object.  (This does not happen with
-   __resolv_context_get_override, and __resolv_context_get_no_inet6 may
-   also interpose another context object if RES_USE_INET6 needs to be
-   disabled.)
+   __resolv_context_get_override.)
 
    In contrast to struct __res_state, struct resolv_context is not
    affected by ABI compatibility concerns.
@@ -62,8 +60,8 @@  struct resolv_context
   size_t __refcount;            /* Count of reusages by the get functions.  */
   bool __from_res;              /* True if created from _res.  */
 
-  /* If RES_USE_INET6 was disabled at this level, this field points to
-     the previous context.  */
+  /* Single-linked list of resolver contexts.  Used for memory
+     deallocation on thread cancellation.  */
   struct resolv_context *__next;
 };
 
@@ -75,8 +73,7 @@  struct resolv_context *__resolv_context_get (void)
 libc_hidden_proto (__resolv_context_get)
 
 /* Deallocate the temporary resolver context.  Converse of
-   __resolv_context_get.  Restore the RES_USE_INET6 flag if necessary.
-   Do nothing if CTX is NULL.  */
+   __resolv_context_get.  Do nothing if CTX is NULL.  */
 void __resolv_context_put (struct resolv_context *ctx);
 libc_hidden_proto (__resolv_context_put)
 
diff --git a/resolv/tst-res_use_inet6.c b/resolv/tst-res_use_inet6.c
deleted file mode 100644
index 0170335741..0000000000
--- a/resolv/tst-res_use_inet6.c
+++ /dev/null
@@ -1,509 +0,0 @@ 
-/* Basic functionality tests for inet6 option processing.
-   Copyright (C) 2016-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#include <ctype.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <support/check.h>
-#include <support/check_nss.h>
-#include <support/resolv_test.h>
-#include <support/support.h>
-#include <support/xthread.h>
-
-/* Handle IPv4 reverse lookup responses.  Product a PTR record
-   A-B-C-D.v4.example.  */
-static void
-response_ptr_v4 (const struct resolv_response_context *ctx,
-                 struct resolv_response_builder *b,
-                 const char *qname, uint16_t qclass, uint16_t qtype)
-{
-  int bytes[4];
-  int offset = -1;
-  TEST_VERIFY (sscanf (qname, "%d.%d.%d.%d.in-addr.arpa%n",
-                       bytes + 0, bytes + 1, bytes + 2, bytes + 3,
-                       &offset) == 4);
-  TEST_VERIFY (offset == strlen (qname));
-  resolv_response_init (b, (struct resolv_response_flags) {});
-  resolv_response_add_question (b, qname, qclass, qtype);
-  resolv_response_section (b, ns_s_an);
-  resolv_response_open_record (b, qname, qclass, T_PTR, 0);
-  char *name = xasprintf ("%d-%d-%d-%d.v4.example",
-                          bytes[3], bytes[2], bytes[1], bytes[0]);
-  resolv_response_add_name (b, name);
-  free (name);
-  resolv_response_close_record (b);
-}
-
-/* Handle IPv6 reverse lookup responses.  Produce a PTR record
-   <32 hex digits>.v6.example. */
-static void
-response_ptr_v6 (const struct resolv_response_context *ctx,
-                 struct resolv_response_builder *b,
-                 const char *qname, uint16_t qclass, uint16_t qtype)
-{
-
-  TEST_VERIFY_EXIT (strlen (qname) > 64);
-
-  char bytes[33];
-  for (int i = 0; i < 64; ++i)
-    if ((i % 2) == 0)
-      {
-        TEST_VERIFY (isxdigit ((unsigned char) qname[i]));
-        bytes[31 - i / 2] = qname[i];
-      }
-    else
-      TEST_VERIFY_EXIT (qname[i] == '.');
-  bytes[32] = '\0';
-
-    resolv_response_init (b, (struct resolv_response_flags) {});
-  resolv_response_add_question (b, qname, qclass, qtype);
-  resolv_response_section (b, ns_s_an);
-  resolv_response_open_record (b, qname, qclass, T_PTR, 0);
-  char *name = xasprintf ("%s.v6.example", bytes);
-  resolv_response_add_name (b, name);
-  free (name);
-  resolv_response_close_record (b);
-}
-
-/* Produce a response based on QNAME: Certain characters in the first
-   label of QNAME trigger the inclusion of resource records:
-
-   'a'   A record (IPv4 address)
-   'q'   AAAA record (quad A record, IPv6 address)
-   'p'   PTR record
-   'm'   record type must match QTYPE (no additional records)
-   '6'   stop flag processing if QTYPE == AAAA
-
-   For 'a' and 'q', QTYPE is ignored for record type selection if 'm'
-   is not specified.
-
-   in-addr.arpa and ip6.arpa queries are handled separately in
-   response_ptr_v4 and response_ptr_v6.  */
-static void
-response (const struct resolv_response_context *ctx,
-          struct resolv_response_builder *b,
-          const char *qname, uint16_t qclass, uint16_t qtype)
-{
-  if (strstr (qname, ".in-addr.arpa") != NULL)
-    return response_ptr_v4 (ctx, b, qname, qclass, qtype);
-  else if (strstr (qname, ".ip6.arpa") != NULL)
-    return response_ptr_v6 (ctx, b, qname, qclass, qtype);
-
-  bool include_a = false;
-  bool include_aaaa = false;
-  bool include_match = false;
-  bool include_ptr = false;
-  for (const char *p = qname; *p != '.' && *p != '\0'; ++p)
-    {
-      if (*p == 'a')
-        include_a = true;
-      else if (*p == 'q')
-        include_aaaa = true;
-      else if (*p == 'm')
-        include_match = true;
-      else if (*p == 'p')
-        include_ptr = true;
-      else if (*p == '6' && qtype == T_AAAA)
-        break;
-    }
-  if (include_match)
-    {
-      if (qtype == T_A)
-        include_aaaa = false;
-      else if (qtype == T_AAAA)
-        include_a = false;
-    }
-
-  resolv_response_init (b, (struct resolv_response_flags) {});
-  resolv_response_add_question (b, qname, qclass, qtype);
-  resolv_response_section (b, ns_s_an);
-  if (include_a)
-    {
-      char ipv4[4] = {192, 0, 2, 17};
-      resolv_response_open_record (b, qname, qclass, T_A, 0);
-      resolv_response_add_data (b, &ipv4, sizeof (ipv4));
-      resolv_response_close_record (b);
-    }
-  if (include_aaaa)
-    {
-      char ipv6[16]
-        = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
-      resolv_response_open_record (b, qname, qclass, T_AAAA, 0);
-      resolv_response_add_data (b, &ipv6, sizeof (ipv6));
-      resolv_response_close_record (b);
-    }
-  if (include_ptr)
-    {
-      resolv_response_open_record (b, qname, qclass, T_PTR, 0);
-      resolv_response_add_name (b, "ptr-target.example");
-      resolv_response_close_record (b);
-    }
-}
-
-/* Test that getaddrinfo is not influenced by RES_USE_INET6.  */
-static void
-test_gai (void)
-{
-  {
-    struct addrinfo hints =
-      {
-        .ai_family = AF_UNSPEC,
-        .ai_socktype = SOCK_STREAM,
-        .ai_protocol = IPPROTO_TCP,
-      };
-    struct addrinfo *ai;
-    int ret = getaddrinfo ("qam.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_UNSPEC qam.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n"
-                    "address: STREAM/TCP 2001:db8::1 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("am.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_UNSPEC am.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("qa.example", "80", &hints, &ai);
-    /* Combined A/AAAA responses currently result in address
-       duplication.  */
-    check_addrinfo ("getaddrinfo AF_UNSPEC qa.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n"
-                    "address: STREAM/TCP 192.0.2.17 80\n"
-                    "address: STREAM/TCP 2001:db8::1 80\n"
-                    "address: STREAM/TCP 2001:db8::1 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-  }
-  {
-    struct addrinfo hints =
-      {
-        .ai_family = AF_INET,
-        .ai_socktype = SOCK_STREAM,
-        .ai_protocol = IPPROTO_TCP,
-      };
-    struct addrinfo *ai;
-    int ret = getaddrinfo ("qam.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_INET qam.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("am.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_INET am.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("qa.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_INET qa.example", ai, ret,
-                    "address: STREAM/TCP 192.0.2.17 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-  }
-  {
-    struct addrinfo hints =
-      {
-        .ai_family = AF_INET6,
-        .ai_socktype = SOCK_STREAM,
-        .ai_protocol = IPPROTO_TCP,
-      };
-    struct addrinfo *ai;
-    int ret = getaddrinfo ("qa.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo (AF_INET6)", ai, ret,
-                    "address: STREAM/TCP 2001:db8::1 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("am.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_INET6 am.example", ai, ret,
-                    "error: No address associated with hostname\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-    ret = getaddrinfo ("qam.example", "80", &hints, &ai);
-    check_addrinfo ("getaddrinfo AF_INET6 qam.example", ai, ret,
-                    "address: STREAM/TCP 2001:db8::1 80\n");
-    if (ret == 0)
-      freeaddrinfo (ai);
-  }
-}
-
-/* Test gethostbyaddr and getnameinfo.  The results are independent of
-   RES_USE_INET6.  */
-static void
-test_reverse (void)
-{
-  {
-    char ipv4[4] = { 192, 0, 2, 17 };
-    check_hostent ("gethostbyaddr AF_INET",
-                   gethostbyaddr (ipv4, sizeof (ipv4), AF_INET),
-                   "name: 192-0-2-17.v4.example\n"
-                   "address: 192.0.2.17\n");
-  }
-  {
-    char ipv6[16]
-      = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
-    check_hostent ("gethostbyaddr AF_INET",
-                   gethostbyaddr (ipv6, sizeof (ipv6), AF_INET6),
-                   "name: 20010db8000000000000000000000001.v6.example\n"
-                   "address: 2001:db8::1\n");
-  }
-
-  {
-    struct sockaddr_in addr =
-      {
-        .sin_family = AF_INET,
-        .sin_addr = { .s_addr = htonl (0xc0000211) },
-        .sin_port = htons (80)
-      };
-    char host[NI_MAXHOST];
-    char service[NI_MAXSERV];
-    int ret = getnameinfo ((struct sockaddr *) &addr, sizeof (addr),
-                           host, sizeof (host), service, sizeof (service),
-                           NI_NUMERICSERV);
-    TEST_VERIFY (ret == 0);
-    TEST_VERIFY (strcmp (host, "192-0-2-17.v4.example") == 0);
-    TEST_VERIFY (strcmp (service, "80") == 0);
-  }
-  {
-    char ipv6[16]
-      = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
-    struct sockaddr_in6 addr =
-      {
-        .sin6_family = AF_INET6,
-        .sin6_port = htons (80),
-      };
-    TEST_VERIFY (sizeof (ipv6) == sizeof (addr.sin6_addr));
-    memcpy (&addr.sin6_addr, ipv6, sizeof (addr.sin6_addr));
-    char host[NI_MAXHOST];
-    char service[NI_MAXSERV];
-    int ret = getnameinfo ((struct sockaddr *) &addr, sizeof (addr),
-                           host, sizeof (host), service, sizeof (service),
-                           NI_NUMERICSERV);
-    TEST_VERIFY (ret == 0);
-    TEST_VERIFY
-      (strcmp (host, "20010db8000000000000000000000001.v6.example") == 0);
-    TEST_VERIFY (strcmp (service, "80") == 0);
-  }
-}
-
-/* Test that gethostbyname2 is mostly not influenced by
-   RES_USE_INET6.  */
-static void
-test_get2_any (void)
-{
-  check_hostent ("gethostbyname2 AF_INET am.example",
-                 gethostbyname2 ("am.example", AF_INET),
-                 "name: am.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname2 AF_INET a.example",
-                 gethostbyname2 ("a.example", AF_INET),
-                 "name: a.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname2 AF_INET qm.example",
-                 gethostbyname2 ("qm.example", AF_INET),
-                 "error: NO_ADDRESS\n");
-  check_hostent ("gethostbyname2 AF_INET q.example",
-                 gethostbyname2 ("q.example", AF_INET),
-                 "error: NO_RECOVERY\n");
-  check_hostent ("gethostbyname2 AF_INET qam.example",
-                 gethostbyname2 ("qam.example", AF_INET),
-                 "name: qam.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname2 AF_INET qa.example",
-                 gethostbyname2 ("qa.example", AF_INET),
-                 "name: qa.example\n"
-                 "address: 192.0.2.17\n");
-
-  check_hostent ("gethostbyname2 AF_INET6 qm.example",
-                 gethostbyname2 ("qm.example", AF_INET6),
-                 "name: qm.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname2 AF_INET6 q.example",
-                 gethostbyname2 ("q.example", AF_INET6),
-                 "name: q.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname2 AF_INET6 qam.example",
-                 gethostbyname2 ("qam.example", AF_INET6),
-                 "name: qam.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname2 AF_INET6 qa.example",
-                 gethostbyname2 ("qa.example", AF_INET6),
-                 "name: qa.example\n"
-                 "address: 2001:db8::1\n");
-  /* Additional AF_INET6 tests depend on RES_USE_INET6; see below.  */
-
-  test_reverse ();
-}
-
-/* gethostbyname2 tests with RES_USE_INET6 disabled.  */
-static void
-test_get2_no_inet6 (void)
-{
-  test_get2_any ();
-
-  check_hostent ("gethostbyname2 AF_INET6 am.example",
-                 gethostbyname2 ("am.example", AF_INET6),
-                 "error: NO_ADDRESS\n");
-  check_hostent ("gethostbyname2 AF_INET6 a.example",
-                 gethostbyname2 ("a.example", AF_INET6),
-                 "error: NO_RECOVERY\n");
-}
-
-/* gethostbyname2 tests with RES_USE_INET6 enabled.  */
-static void
-test_get2_inet6 (void)
-{
-  test_get2_any ();
-
-  check_hostent ("gethostbyname2 AF_INET6 am.example",
-                 gethostbyname2 ("am.example", AF_INET6),
-                 "name: am.example\n"
-                 "address: ::ffff:192.0.2.17\n");
-  check_hostent ("gethostbyname2 AF_INET6 a.example",
-                 gethostbyname2 ("a.example", AF_INET6),
-                 "error: NO_RECOVERY\n");
-}
-
-/* Collection of tests which assume no RES_USE_INET6 flag.  */
-static void
-test_no_inet6 (void)
-{
-  check_hostent ("gethostbyname (\"a.example\")",
-                 gethostbyname ("a.example"),
-                 "name: a.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname (\"qa.example\")",
-                 gethostbyname ("qa.example"),
-                 "name: qa.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname (\"am.example\")",
-                 gethostbyname ("am.example"),
-                 "name: am.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname (\"amp.example\")",
-                 gethostbyname ("amp.example"),
-                 "name: amp.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname (\"qam.example\")",
-                 gethostbyname ("qam.example"),
-                 "name: qam.example\n"
-                 "address: 192.0.2.17\n");
-  check_hostent ("gethostbyname (\"q.example\")",
-                 gethostbyname ("q.example"),
-                 "error: NO_RECOVERY\n");
-  check_hostent ("gethostbyname (\"qm.example\")",
-                 gethostbyname ("qm.example"),
-                 "error: NO_ADDRESS\n");
-  test_get2_no_inet6 ();
-  test_get2_no_inet6 ();
-  test_gai ();
-  test_get2_no_inet6 ();
-  test_get2_no_inet6 ();
-}
-
-static void *
-threadfunc (void *ignored)
-{
-  struct resolv_test *obj = resolv_test_start
-    ((struct resolv_redirect_config)
-     {
-       .response_callback = response
-     });
-
-  TEST_VERIFY ((_res.options & RES_USE_INET6) == 0);
-  test_no_inet6 ();
-
-  _res.options |= RES_USE_INET6;
-  check_hostent ("gethostbyname (\"a.inet6.example\")",
-                 gethostbyname ("a.inet6.example"),
-                 "error: NO_RECOVERY\n");
-  check_hostent ("gethostbyname (\"am.inet6.example\")",
-                 gethostbyname ("am.inet6.example"),
-                 "name: am.inet6.example\n"
-                 "address: ::ffff:192.0.2.17\n");
-  check_hostent ("gethostbyname (\"qa.inet6.example\")",
-                 gethostbyname ("qa.inet6.example"),
-                 "name: qa.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname (\"qam.inet6.example\")",
-                 gethostbyname ("qam.inet6.example"),
-                 "name: qam.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname (\"q.inet6.example\")",
-                 gethostbyname ("q.inet6.example"),
-                 "name: q.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname (\"qm.inet6.example\")",
-                 gethostbyname ("qm.inet6.example"),
-                 "name: qm.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname (\"amp.inet6.example\")",
-                 gethostbyname ("amp.inet6.example"),
-                 "error: NO_RECOVERY\n");
-  check_hostent ("gethostbyname (\"qmp.inet6.example\")",
-                 gethostbyname ("qmp.inet6.example"),
-                 "name: qmp.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  check_hostent ("gethostbyname (\"ap.inet6.example\")",
-                 gethostbyname ("ap.inet6.example"),
-                 "error: NO_RECOVERY\n");
-  check_hostent ("gethostbyname (\"6ap.inet6.example\")",
-                 gethostbyname ("6ap.inet6.example"),
-                 "name: 6ap.inet6.example\n"
-                 "address: ::ffff:192.0.2.17\n");
-  check_hostent ("gethostbyname (\"am6p.inet6.example\")",
-                 gethostbyname ("am6p.inet6.example"),
-                 "name: am6p.inet6.example\n"
-                 "address: ::ffff:192.0.2.17\n");
-  check_hostent ("gethostbyname (\"qp.inet6.example\")",
-                 gethostbyname ("qp.inet6.example"),
-                 "name: qp.inet6.example\n"
-                 "address: 2001:db8::1\n");
-  test_get2_inet6 ();
-  test_get2_inet6 ();
-  test_gai ();
-  test_get2_inet6 ();
-  test_get2_inet6 ();
-
-  TEST_VERIFY (_res.options & RES_USE_INET6);
-  _res.options &= ~RES_USE_INET6;
-  test_no_inet6 ();
-
-  resolv_test_end (obj);
-
-  return NULL;
-}
-
-static int
-do_test (void)
-{
-  resolv_test_init ();
-
-  /* Attempt to run on a non-main thread first.  */
-  {
-    pthread_t thr = xpthread_create (NULL, threadfunc, NULL);
-    xpthread_join (thr);
-  }
-
-  /* Try the main thread next.  */
-  threadfunc (NULL);
-
-  return 0;
-}
-
-#include <support/test-driver.c>
diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
index a5061e6d4f..492e4a1586 100644
--- a/resolv/tst-resolv-res_init-skeleton.c
+++ b/resolv/tst-resolv-res_init-skeleton.c
@@ -24,7 +24,6 @@ 
 #include <errno.h>
 #include <gnu/lib-names.h>
 #include <netdb.h>
-#include <resolv/resolv-internal.h> /* For DEPRECATED_RES_USE_INET6.  */
 #include <resolv/resolv_context.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -120,7 +119,6 @@  print_resp (FILE *fp, res_state resp)
         if (resp->retry != RES_DFLRETRY)
           fprintf (fp, " attempts:%d", resp->retry);
         print_option_flag (fp, &options, RES_USEVC, "use-vc");
-        print_option_flag (fp, &options, DEPRECATED_RES_USE_INET6, "inet6");
         print_option_flag (fp, &options, RES_ROTATE, "rotate");
         print_option_flag (fp, &options, RES_USE_EDNS0, "edns0");
         print_option_flag (fp, &options, RES_SNGLKUP,
@@ -560,7 +558,7 @@  struct test_case test_cases[] =
      "nameserver 192.0.2.1\n"
      "nameserver ::1\n"
      "nameserver 192.0.2.2\n",
-     .expected = "options ndots:3 timeout:19 attempts:5 inet6 edns0\n"
+     .expected = "options ndots:3 timeout:19 attempts:5 edns0\n"
      "search corp.example.com example.com\n"
      "; search[0]: corp.example.com\n"
      "; search[1]: example.com\n"
diff --git a/resolv/tst-resolv-threads.c b/resolv/tst-resolv-threads.c
index 4222331d71..ad480e0141 100644
--- a/resolv/tst-resolv-threads.c
+++ b/resolv/tst-resolv-threads.c
@@ -276,68 +276,34 @@  thread_byname2 (void *closure)
   return byname (true);
 }
 
-/* Call gethostbyname_r with RES_USE_INET6 (if do_2 is false), or
-   gethostbyname_r with AF_INET6 (if do_2 is true).  */
-static void *
-byname_inet6 (bool do_2)
-{
-  int this_thread = get_thread_number ();
-  xpthread_barrier_wait (&barrier);
-  if (!do_2)
-    {
-      res_init ();
-      _res.options |= DEPRECATED_RES_USE_INET6;
-      TEST_VERIFY (strcmp (_res.defdname, "example.com") == 0);
-    }
-  for (int i = 0; i < queries_per_thread; ++i)
-    {
-      char qname[100];
-      snprintf (qname, sizeof (qname), "counter%d.thread%d.example.com",
-                i, this_thread);
-      struct hostent storage;
-      char buf[1000];
-      struct hostent *e = NULL;
-      int herrno;
-      int ret;
-      if (do_2)
-        ret = gethostbyname2_r (qname, AF_INET6, &storage, buf, sizeof (buf),
-                                &e, &herrno);
-      else
-        ret = gethostbyname_r (qname, &storage, buf, sizeof (buf),
-                               &e, &herrno);
-      check_hostent (__func__,
-                     do_2 ? "gethostbyname2_r" : "gethostbyname_r",
-                     qname, ret, e, AF_INET6, i);
-    }
-  return NULL;
-}
-
-/* Test gethostbyname_r with AF_INET6.  */
-static void *
-thread_byname_inet6 (void *closure)
-{
-  return byname_inet6 (false);
-}
-
 /* Test gethostbyname2_r with AF_INET6.  */
 static void *
 thread_byname2_af_inet6 (void *closure)
 {
-  return byname_inet6 (true);
+  int this_thread = get_thread_number ();
+  xpthread_barrier_wait (&barrier);
+  for (int i = 0; i < queries_per_thread; ++i)
+    {
+      char qname[100];
+      snprintf (qname, sizeof (qname), "counter%d.thread%d.example.com",
+                i, this_thread);
+      struct hostent storage;
+      char buf[1000];
+      struct hostent *e = NULL;
+      int herrno;
+      int ret = gethostbyname2_r (qname, AF_INET6, &storage, buf, sizeof (buf),
+                                  &e, &herrno);
+      check_hostent (__func__, "gethostbyname2_r", qname, ret, e, AF_INET6, i);
+    }
+  return NULL;
 }
 
 /* Run getaddrinfo tests for FAMILY.  */
 static void *
-gai (int family, bool do_inet6)
+gai (int family)
 {
   int this_thread = get_thread_number ();
   xpthread_barrier_wait (&barrier);
-  if (do_inet6)
-    {
-      res_init ();
-      _res.options |= DEPRECATED_RES_USE_INET6;
-      check_have_conf ();
-    }
   for (int i = 0; i < queries_per_thread; ++i)
     {
       char qname[100];
@@ -362,42 +328,21 @@  gai (int family, bool do_inet6)
 static void *
 thread_gai_inet (void *closure)
 {
-  return gai (AF_INET, false);
+  return gai (AF_INET);
 }
 
 /* Test getaddrinfo with AF_INET6.  */
 static void *
 thread_gai_inet6 (void *closure)
 {
-  return gai (AF_INET6, false);
+  return gai (AF_INET6);
 }
 
 /* Test getaddrinfo with AF_UNSPEC.  */
 static void *
 thread_gai_unspec (void *closure)
 {
-  return gai (AF_UNSPEC, false);
-}
-
-/* Test getaddrinfo with AF_INET.  */
-static void *
-thread_gai_inet_inet6 (void *closure)
-{
-  return gai (AF_INET, true);
-}
-
-/* Test getaddrinfo with AF_INET6.  */
-static void *
-thread_gai_inet6_inet6 (void *closure)
-{
-  return gai (AF_INET6, true);
-}
-
-/* Test getaddrinfo with AF_UNSPEC.  */
-static void *
-thread_gai_unspec_inet6 (void *closure)
-{
-  return gai (AF_UNSPEC, true);
+  return gai (AF_UNSPEC);
 }
 
 /* Description of the chroot environment used to run the tests.  */
@@ -451,7 +396,7 @@  do_test (void)
        .server_address_overrides = server_addresses,
      });
 
-  enum { thread_count = 10 };
+  enum { thread_count = 6 };
   xpthread_barrier_init (&barrier, NULL, thread_count + 1);
   pthread_t threads[thread_count];
   typedef void *(*thread_func) (void *);
@@ -459,14 +404,10 @@  do_test (void)
     {
       thread_byname,
       thread_byname2,
-      thread_byname_inet6,
       thread_byname2_af_inet6,
       thread_gai_inet,
       thread_gai_inet6,
       thread_gai_unspec,
-      thread_gai_inet_inet6,
-      thread_gai_inet6_inet6,
-      thread_gai_unspec_inet6,
     };
   for (int i = 0; i < thread_count; ++i)
     threads[i] = xpthread_create (NULL, thread_funcs[i], NULL);
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 553833d1f2..ddc3083018 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -61,7 +61,6 @@  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <nss.h>
 #include <resolv/resolv-internal.h>
 #include <resolv/resolv_context.h>
-#include <resolv/res_use_inet6.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -255,7 +254,6 @@  convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
 	break;								      \
       if (!scratch_buffer_grow (tmpbuf))				      \
 	{								      \
-	  __resolv_context_enable_inet6 (res_ctx, res_enable_inet6);	      \
 	  __resolv_context_put (res_ctx);				      \
 	  result = -EAI_MEMORY;						      \
 	  goto free_and_return;						      \
@@ -266,7 +264,6 @@  convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
     {									      \
       if (h_errno == NETDB_INTERNAL)					      \
 	{								      \
-	  __resolv_context_enable_inet6 (res_ctx, res_enable_inet6);	      \
 	  __resolv_context_put (res_ctx);				      \
 	  result = -EAI_SYSTEM;						      \
 	  goto free_and_return;						      \
@@ -280,7 +277,6 @@  convert_hostent_to_gaih_addrtuple (const struct addrinfo *req,
     {									      \
       if (!convert_hostent_to_gaih_addrtuple (req, _family, &th, &addrmem))   \
 	{								      \
-	  __resolv_context_enable_inet6 (res_ctx, res_enable_inet6);	      \
 	  __resolv_context_put (res_ctx);				      \
 	  result = -EAI_SYSTEM;						      \
 	  goto free_and_return;						      \
@@ -558,7 +554,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 	  enum nss_status status = NSS_STATUS_UNAVAIL;
 	  int no_more;
 	  struct resolv_context *res_ctx = NULL;
-	  bool res_enable_inet6 = false;
 
 	  /* If we do not have to look for IPv6 addresses or the canonical
 	     name, use the simple, old functions, which do not support
@@ -749,7 +744,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 	     addresses to IPv6 addresses, so we use the no_inet6
 	     function variant.  */
 	  res_ctx = __resolv_context_get ();
-	  res_enable_inet6 = __resolv_context_disable_inet6 (res_ctx);
 	  if (res_ctx == NULL)
 	    no_more = 1;
 
@@ -785,8 +779,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 
 		      if (!scratch_buffer_grow (tmpbuf))
 			{
-			  __resolv_context_enable_inet6
-			    (res_ctx, res_enable_inet6);
 			  __resolv_context_put (res_ctx);
 			  result = -EAI_MEMORY;
 			  goto free_and_return;
@@ -886,8 +878,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 			      canonbuf = getcanonname (nip, at, name);
 			      if (canonbuf == NULL)
 				{
-				  __resolv_context_enable_inet6
-				    (res_ctx, res_enable_inet6);
 				  __resolv_context_put (res_ctx);
 				  result = -EAI_MEMORY;
 				  goto free_and_return;
@@ -932,7 +922,6 @@  gaih_inet (const char *name, const struct gaih_service *service,
 		nip = nip->next;
 	    }
 
-	  __resolv_context_enable_inet6 (res_ctx, res_enable_inet6);
 	  __resolv_context_put (res_ctx);
 
 	  /* If we have a failure which sets errno, report it using