about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorArjun Shankar <arjun@redhat.com>2023-10-02 14:55:27 +0200
committerArjun Shankar <arjun@redhat.com>2023-10-24 12:31:00 +0200
commit7f602256ab5b85db1dbfb5f40bd109c4b37b68c8 (patch)
tree88cf9fb3bc04eae6ae9ca3816fac75d78f691740 /posix
parent1d74d2f042a405982661267394e16126db70dc5f (diff)
downloadglibc-7f602256ab5b85db1dbfb5f40bd109c4b37b68c8.tar.gz
glibc-7f602256ab5b85db1dbfb5f40bd109c4b37b68c8.tar.xz
glibc-7f602256ab5b85db1dbfb5f40bd109c4b37b68c8.zip
Move getaddrinfo from 'posix' into 'nss'
getaddrinfo is an entry point for nss functionality.  This commit moves
it from 'sysdeps/posix' to 'nss', gets rid of the stub in 'posix', and
moves all associated tests as well.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'posix')
-rw-r--r--posix/Makefile10
-rw-r--r--posix/Versions2
-rw-r--r--posix/getaddrinfo.c38
-rw-r--r--posix/tst-getaddrinfo.c68
-rw-r--r--posix/tst-getaddrinfo2.c78
-rw-r--r--posix/tst-getaddrinfo3.c151
-rw-r--r--posix/tst-getaddrinfo4.c67
-rw-r--r--posix/tst-getaddrinfo5.c69
-rw-r--r--posix/tst-rfc3484-2.c189
-rw-r--r--posix/tst-rfc3484-3.c161
-rw-r--r--posix/tst-rfc3484.c153
11 files changed, 1 insertions, 985 deletions
diff --git a/posix/Makefile b/posix/Makefile
index be7d319394..3ab124d040 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -88,7 +88,6 @@ routines := \
   fpathconf \
   gai_strerror \
   get_child_max \
-  getaddrinfo \
   getegid \
   geteuid \
   getgid \
@@ -287,9 +286,6 @@ tests := \
   tst-fnmatch7 \
   tst-fork \
   tst-gai_strerror \
-  tst-getaddrinfo \
-  tst-getaddrinfo2 \
-  tst-getaddrinfo3 \
   tst-getopt_long1 \
   tst-glob-tilde \
   tst-glob_symlinks \
@@ -351,9 +347,6 @@ tests-internal := \
   bug-regex5 \
   bug-regex20 \
   bug-regex33 \
-  tst-rfc3484 \
-  tst-rfc3484-2 \
-  tst-rfc3484-3 \
   # tests-internal
 
 tests-container := \
@@ -368,8 +361,6 @@ tests-time64 := \
   # tests-time64
 
 xtests	:= \
-  tst-getaddrinfo4 \
-  tst-getaddrinfo5 \
   tst-sched_rr_get_interval \
   # xtests
 
@@ -556,7 +547,6 @@ $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
 	   '$(config-machine)-$(config-vendor)' > $@.new
 	mv -f $@.new $@
 
-CFLAGS-getaddrinfo.c += -fexceptions
 CFLAGS-pause.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes)
diff --git a/posix/Versions b/posix/Versions
index 2eedbc3e79..b24c7c87ff 100644
--- a/posix/Versions
+++ b/posix/Versions
@@ -34,7 +34,7 @@ libc {
     fnmatch; fork; fpathconf; freeaddrinfo;
 
     # g*
-    getaddrinfo; getdtablesize; getegid; geteuid; getgid; getopt; getopt_long;
+    getdtablesize; getegid; geteuid; getgid; getopt; getopt_long;
     getopt_long_only; getpgid; getpgrp; getpid; getppid; getsid; getuid; glob;
     glob_pattern_p; globfree; group_member;
 
diff --git a/posix/getaddrinfo.c b/posix/getaddrinfo.c
deleted file mode 100644
index 0e36a4564c..0000000000
--- a/posix/getaddrinfo.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Stub version of getaddrinfo function.
-   Copyright (C) 1996-2023 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <errno.h>
-#include <netdb.h>
-
-int
-getaddrinfo (const char *name, const char *service, const struct addrinfo *req,
-	     struct addrinfo **pai)
-{
-  __set_errno (ENOSYS);
-  return EAI_SYSTEM;
-}
-stub_warning (getaddrinfo)
-libc_hidden_def (getaddrinfo)
-
-void
-freeaddrinfo (struct addrinfo *ai)
-{
-  /* Nothing.  */
-}
-stub_warning (freeaddrinfo)
-libc_hidden_def (freeaddrinfo)
diff --git a/posix/tst-getaddrinfo.c b/posix/tst-getaddrinfo.c
deleted file mode 100644
index eff92a7856..0000000000
--- a/posix/tst-getaddrinfo.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Copyright (C) 1999-2023 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-static int
-do_test (void)
-{
-  const int family[2] = { AF_INET, AF_INET6 };
-  int result = 0;
-  int gaierr;
-  size_t index;
-  struct addrinfo hints, *ai, *aitop;
-
-  for (index = 0; index < sizeof (family) / sizeof (family[0]); ++index)
-    {
-      memset (&hints, '\0', sizeof (hints));
-      hints.ai_family = family[index];
-      hints.ai_socktype = SOCK_STREAM;
-
-      gaierr = getaddrinfo (NULL, "54321", &hints, &aitop);
-      if (gaierr != 0)
-	{
-	  gai_strerror (gaierr);
-	  result = 1;
-	}
-      else
-	{
-	  for (ai = aitop; ai != NULL; ai = ai->ai_next)
-	    {
-	      printf ("Should return family: %d. Returned: %d\n",
-		      family[index], ai->ai_family);
-	      result |= family[index] != ai->ai_family;
-	    }
-
-	  while (aitop != NULL)
-	    {
-	      ai = aitop;
-	      aitop = aitop->ai_next;
-	      freeaddrinfo (ai);
-	    }
-	}
-    }
-
-  return result;
-}
-#define TEST_FUNCTION do_test ()
-
-#include "../test-skeleton.c"
diff --git a/posix/tst-getaddrinfo2.c b/posix/tst-getaddrinfo2.c
deleted file mode 100644
index d8be4a8e8f..0000000000
--- a/posix/tst-getaddrinfo2.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Test by David L Stevens <dlstevens@us.ibm.com> [BZ #358] */
-#include <errno.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-
-static int
-do_test (void)
-{
-  const char portstr[] = "583";
-  int port = atoi (portstr);
-  struct addrinfo hints, *aires, *pai;
-  int rv;
-  int res = 1;
-
-  memset (&hints, 0, sizeof (hints));
-  hints.ai_family = AF_INET;
-  rv = getaddrinfo (NULL, portstr, &hints, &aires);
-  if (rv == 0)
-    {
-      struct sockaddr_in *psin = 0;
-      int got_tcp, got_udp;
-      int err = 0;
-
-      got_tcp = got_udp = 0;
-      for (pai = aires; pai; pai = pai->ai_next)
-        {
-          printf ("ai_family=%d, ai_addrlen=%d, ai_socktype=%d",
-                  (int) pai->ai_family, (int) pai->ai_addrlen,
-                  (int) pai->ai_socktype);
-          if (pai->ai_family == AF_INET)
-            printf (", port=%d",
-                    ntohs (((struct sockaddr_in *) pai->ai_addr)->sin_port));
-          puts ("");
-
-          err |= pai->ai_family != AF_INET;
-          err |= pai->ai_addrlen != sizeof (struct sockaddr_in);
-          err |= pai->ai_addr == 0;
-          if (pai->ai_family == AF_INET)
-            err |=
-              ntohs (((struct sockaddr_in *) pai->ai_addr)->sin_port) != port;
-          got_tcp |= pai->ai_socktype == SOCK_STREAM;
-          got_udp |= pai->ai_socktype == SOCK_DGRAM;
-          if (err)
-            break;
-        }
-      if (err)
-        {
-          printf ("FAIL getaddrinfo IPv4 socktype 0,513: "
-                  "fam %d alen %d addr %p addr/fam %d "
-                  "addr/port %d H[%d]\n",
-                  pai->ai_family, pai->ai_addrlen, psin,
-                  psin ? psin->sin_family : 0,
-                  psin ? psin->sin_port : 0,
-                  psin ? htons (psin->sin_port) : 0);
-        }
-      else if (got_tcp && got_udp)
-        {
-          printf ("SUCCESS getaddrinfo IPv4 socktype 0,513\n");
-          res = 0;
-        }
-      else
-        printf ("FAIL getaddrinfo IPv4 socktype 0,513 TCP %d"
-                " UDP %d\n", got_tcp, got_udp);
-      freeaddrinfo (aires);
-    }
-  else
-    printf ("FAIL getaddrinfo IPv4 socktype 0,513 returns %d "
-            "(\"%s\")\n", rv, gai_strerror (rv));
-
-  return res;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-getaddrinfo3.c b/posix/tst-getaddrinfo3.c
deleted file mode 100644
index 5077f311fc..0000000000
--- a/posix/tst-getaddrinfo3.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include <mcheck.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-
-
-static int
-do_test (void)
-{
-  mtrace ();
-
-  int result = 0;
-  struct addrinfo hints;
-  struct addrinfo *ai_res;
-  int s;
-
-#define T(no, fail, addr, fam, coraddr)					      \
-  s = getaddrinfo (addr, NULL, &hints, &ai_res);			      \
-  if (s != 0)								      \
-    {									      \
-      if (s != fail)							      \
-	{								      \
-	  printf ("getaddrinfo test %d failed: %s\n", no, gai_strerror (s));  \
-	  result = 1;							      \
-	}								      \
-      ai_res = NULL;							      \
-    }									      \
-  else if (fail)							      \
-    {									      \
-      printf ("getaddrinfo test %d should have failed but did not\n", no);    \
-      result = 1;							      \
-    }									      \
-  else if (ai_res->ai_family != fam)					      \
-    {									      \
-      printf ("\
-getaddrinfo test %d return address of family %d, expected %d\n",	      \
-	      no, ai_res->ai_family, fam);				      \
-      result = 1;							      \
-    }									      \
-  else if (fam == AF_INET)						      \
-    {									      \
-      if (ai_res->ai_addrlen != sizeof (struct sockaddr_in))		      \
-	{								      \
-	  printf ("getaddrinfo test %d: address size %zu, expected %zu\n",    \
-		  no, (size_t) ai_res->ai_addrlen,			      \
-		  sizeof (struct sockaddr_in));				      \
-	  result = 1;							      \
-	}								      \
-      else if (strcmp (coraddr, \
-		       inet_ntoa (((struct sockaddr_in *) ai_res->ai_addr)->sin_addr))\
-	       != 0)							      \
-	{								      \
-	  printf ("getaddrinfo test %d: got value %s, expected %s\n",	      \
-		  no,							      \
-		  inet_ntoa (((struct sockaddr_in *) ai_res->ai_addr)->sin_addr), \
-		  coraddr);						      \
-	  result = 1;							      \
-	}								      \
-    }									      \
-  else									      \
-    {									      \
-      char buf[100];							      \
-									      \
-      if (ai_res->ai_addrlen != sizeof (struct sockaddr_in6))		      \
-	{								      \
-	  printf ("getaddrinfo test %d: address size %zu, expected %zu\n",    \
-		  no, (size_t) ai_res->ai_addrlen,			      \
-		  sizeof (struct sockaddr_in6));			      \
-	  result = 1;							      \
-	}								      \
-      else if (strcmp (coraddr, \
-		       inet_ntop (AF_INET6,				      \
-				  &((struct sockaddr_in6 *) ai_res->ai_addr)->sin6_addr,\
-				  buf, sizeof (buf)))			      \
-	       != 0)							      \
-	{								      \
-	  printf ("getaddrinfo test %d: got value %s, expected %s\n",	      \
-		  no,							      \
-		  inet_ntop (AF_INET6,					      \
-			     & ((struct sockaddr_in6 *) ai_res->ai_addr)->sin6_addr, \
-			     buf, sizeof (buf)),			      \
-		  coraddr);						      \
-	  result = 1;							      \
-	}								      \
-    }									      \
-  if (ai_res != NULL && ai_res->ai_next != NULL)			      \
-    {									      \
-      puts ("expected only one result");				      \
-      result = 1;							      \
-    }									      \
-  freeaddrinfo (ai_res)
-
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_UNSPEC;
-  hints.ai_socktype = SOCK_STREAM;
-  T (1, 0, "127.0.0.1", AF_INET, "127.0.0.1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET;
-  hints.ai_socktype = SOCK_STREAM;
-  T (2, 0, "127.0.0.1", AF_INET, "127.0.0.1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET6;
-  hints.ai_socktype = SOCK_STREAM;
-  hints.ai_flags = AI_V4MAPPED;
-  T (3, 0, "127.0.0.1", AF_INET6, "::ffff:127.0.0.1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET6;
-  hints.ai_socktype = SOCK_STREAM;
-  T (4, EAI_ADDRFAMILY, "127.0.0.1", AF_INET6, "");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_UNSPEC;
-  hints.ai_socktype = SOCK_STREAM;
-  T (5, 0, "::1", AF_INET6, "::1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET;
-  hints.ai_socktype = SOCK_STREAM;
-  T (6, EAI_ADDRFAMILY, "::1", AF_INET6, "");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET6;
-  hints.ai_socktype = SOCK_STREAM;
-  T (7, 0, "::1", AF_INET6, "::1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_UNSPEC;
-  hints.ai_socktype = SOCK_STREAM;
-  T (8, 0, "::ffff:127.0.0.1", AF_INET6, "::ffff:127.0.0.1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET;
-  hints.ai_socktype = SOCK_STREAM;
-  T (9, 0, "::ffff:127.0.0.1", AF_INET, "127.0.0.1");
-
-  memset (&hints, '\0', sizeof (hints));
-  hints.ai_family = AF_INET6;
-  hints.ai_socktype = SOCK_STREAM;
-  T (10, 0, "::ffff:127.0.0.1", AF_INET6, "::ffff:127.0.0.1");
-
-  return result;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-getaddrinfo4.c b/posix/tst-getaddrinfo4.c
deleted file mode 100644
index a5f1f628e9..0000000000
--- a/posix/tst-getaddrinfo4.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Test getaddrinfo return value, [BZ #15339].
-   Copyright (C) 2013-2023 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <string.h>
-#include <stdio.h>
-#include <errno.h>
-#include <netdb.h>
-
-static int
-try (const char *service, int family, int flags)
-{
-  struct addrinfo hints, *h, *ai;
-  int res;
-
-  memset (&hints, 0, sizeof hints);
-  hints.ai_family = family;
-  hints.ai_flags = flags;
-
-  errno = 0;
-  h = (family || flags) ? &hints : NULL;
-  res = getaddrinfo ("example.net", service, h, &ai);
-  switch (res)
-    {
-    case 0:
-    case EAI_AGAIN:
-    case EAI_NONAME:
-      printf ("SUCCESS getaddrinfo(service=%s, family=%d, flags=%d): %s: %m\n",
-              service ?: "NULL", family, flags, gai_strerror (res));
-      return 0;
-    }
-  printf ("FAIL getaddrinfo(service=%s, family=%d, flags=%d): %s: %m\n",
-          service ?: "NULL", family, flags, gai_strerror (res));
-  return 1;
-}
-
-static int
-do_test (void)
-{
-  int err = 0;
-  err |= try (NULL, 0, 0);
-  err |= try (NULL, AF_UNSPEC, AI_ADDRCONFIG);
-  err |= try (NULL, AF_INET, 0);
-  err |= try (NULL, AF_INET6, 0);
-  err |= try ("http", 0, 0);
-  err |= try ("http", AF_UNSPEC, AI_ADDRCONFIG);
-  err |= try ("http", AF_INET, 0);
-  err |= try ("http", AF_INET6, 0);
-  return err;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-getaddrinfo5.c b/posix/tst-getaddrinfo5.c
deleted file mode 100644
index 26a16436ab..0000000000
--- a/posix/tst-getaddrinfo5.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Test host lookup with double dots at the end, [BZ #16469].
-   Copyright (C) 2014-2023 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
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <string.h>
-
-static int
-test (void)
-{
-  static char host1[] = "localhost..";
-  static char host2[] = "www.gnu.org..";
-  static char *hosts[] = { host1, host2 };
-  int i;
-  int pass = 0;
-
-  for (i = 0; i < sizeof (hosts) / sizeof (*hosts); i++)
-    {
-      char *host = hosts[i];
-      size_t len = strlen (host);
-      struct addrinfo *ai;
-
-      /* If the name doesn't resolve with a single dot at the
-	 end, skip it.  */
-      host[len-1] = 0;
-      if (getaddrinfo (host, NULL, NULL, &ai) != 0)
-	{
-	  printf ("resolving \"%s\" failed, skipping this hostname\n", host);
-	  continue;
-	}
-      printf ("resolving \"%s\" worked, proceeding to test\n", host);
-      freeaddrinfo (ai);
-
-      /* If it resolved with a single dot, check that it doesn't with
-	 a second trailing dot.  */
-      host[len-1] = '.';
-      if (getaddrinfo (host, NULL, NULL, &ai) == 0)
-	{
-	  printf ("resolving \"%s\" worked, test failed\n", host);
-	  return 1;
-	}
-      printf ("resolving \"%s\" failed, test passed\n", host);
-      pass = 1;
-    }
-
-  /* We want at least one successful name resolution for the test to
-     succeed.  */
-  return pass ? 0 : 2;
-}
-
-#define TEST_FUNCTION test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
deleted file mode 100644
index ce8ccd5f38..0000000000
--- a/posix/tst-rfc3484-2.c
+++ /dev/null
@@ -1,189 +0,0 @@
-#include <stdbool.h>
-#include <stdio.h>
-#include <ifaddrs.h>
-#include <stdint.h>
-
-/* Internal definitions used in the libc code.  */
-#define __getservbyname_r getservbyname_r
-#define __socket socket
-#define __getsockname getsockname
-#define __inet_aton inet_aton
-#define __gethostbyaddr_r gethostbyaddr_r
-#define __gethostbyname2_r gethostbyname2_r
-#define __qsort_r qsort_r
-#define __stat64 stat64
-
-void
-attribute_hidden
-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
-{
-  *p1 = *p2 = true;
-  *in6ai = NULL;
-  *in6ailen = 0;
-}
-
-void
-attribute_hidden
-__free_in6ai (struct in6addrinfo *ai)
-{
-}
-
-void
-attribute_hidden
-__check_native (uint32_t a1_index, int *a1_native,
-		uint32_t a2_index, int *a2_native)
-{
-}
-
-int
-attribute_hidden
-__idna_to_ascii_lz (const char *input, char **output, int flags)
-{
-  return 0;
-}
-
-int
-attribute_hidden
-__idna_to_unicode_lzlz (const char *input, char **output, int flags)
-{
-  *output = NULL;
-  return 0;
-}
-
-void
-attribute_hidden
-_res_hconf_init (void)
-{
-}
-
-#undef	USE_NSCD
-#include "../sysdeps/posix/getaddrinfo.c"
-
-nss_action_list __nss_hosts_database attribute_hidden;
-
-/* This is the beginning of the real test code.  The above defines
-   (among other things) the function rfc3484_sort.  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define h(n) n
-#else
-# define h(n) __bswap_constant_32 (n)
-#endif
-
-
-ssize_t
-__getline (char **lineptr, size_t *n, FILE *s)
-{
-  *lineptr = NULL;
-  *n = 0;
-  return 0;
-}
-
-
-static int
-do_test (void)
-{
-  labels = default_labels;
-  precedence = default_precedence;
-  scopes = default_scopes;
-
-  struct sockaddr_in so1;
-  so1.sin_family = AF_INET;
-  so1.sin_addr.s_addr = h (0xc0a85f19);
-  /* Clear the rest of the structure to avoid warnings.  */
-  memset (so1.sin_zero, '\0', sizeof (so1.sin_zero));
-
-  struct sockaddr_in sa1;
-  sa1.sin_family = AF_INET;
-  sa1.sin_addr.s_addr = h (0xe0a85f19);
-
-  struct addrinfo ai1;
-  ai1.ai_family = AF_INET;
-  ai1.ai_addr = (struct sockaddr *) &sa1;
-
-  struct sockaddr_in6 so2;
-  so2.sin6_family = AF_INET6;
-  so2.sin6_addr.s6_addr32[0] = h (0xfec01234);
-  so2.sin6_addr.s6_addr32[1] = 1;
-  so2.sin6_addr.s6_addr32[2] = 1;
-  so2.sin6_addr.s6_addr32[3] = 1;
-
-  struct sockaddr_in6 sa2;
-  sa2.sin6_family = AF_INET6;
-  sa2.sin6_addr.s6_addr32[0] = h (0x07d10001);
-  sa2.sin6_addr.s6_addr32[1] = 1;
-  sa2.sin6_addr.s6_addr32[2] = 1;
-  sa2.sin6_addr.s6_addr32[3] = 1;
-
-  struct addrinfo ai2;
-  ai2.ai_family = AF_INET6;
-  ai2.ai_addr = (struct sockaddr *) &sa2;
-
-
-  struct sort_result results[2];
-  size_t order[2];
-
-  results[0].dest_addr = &ai1;
-  results[0].got_source_addr = true;
-  results[0].source_addr_len = sizeof (so1);
-  results[0].source_addr_flags = 0;
-  results[0].prefixlen = 16;
-  results[0].index = 0;
-  memcpy (&results[0].source_addr, &so1, sizeof (so1));
-  order[0] = 0;
-
-  results[1].dest_addr = &ai2;
-  results[1].got_source_addr = true;
-  results[1].source_addr_len = sizeof (so2);
-  results[1].source_addr_flags = 0;
-  results[1].prefixlen = 16;
-  results[1].index = 0;
-  memcpy (&results[1].source_addr, &so2, sizeof (so2));
-  order[1] = 1;
-
-
-  struct sort_result_combo combo = { .results = results, .nresults = 2 };
-  qsort_r (order, 2, sizeof (order[0]), rfc3484_sort, &combo);
-
-  int result = 0;
-  if (results[order[0]].dest_addr->ai_family == AF_INET6)
-    {
-      puts ("wrong order in first test");
-      result |= 1;
-    }
-
-
-  /* And again, this time with the reverse starting order.  */
-  results[1].dest_addr = &ai1;
-  results[1].got_source_addr = true;
-  results[1].source_addr_len = sizeof (so1);
-  results[1].source_addr_flags = 0;
-  results[1].prefixlen = 16;
-  results[1].index = 0;
-  memcpy (&results[1].source_addr, &so1, sizeof (so1));
-  order[1] = 1;
-
-  results[0].dest_addr = &ai2;
-  results[0].got_source_addr = true;
-  results[0].source_addr_len = sizeof (so2);
-  results[0].source_addr_flags = 0;
-  results[0].prefixlen = 16;
-  results[0].index = 0;
-  memcpy (&results[0].source_addr, &so2, sizeof (so2));
-  order[0] = 0;
-
-
-  qsort_r (order, 2, sizeof (order[0]), rfc3484_sort, &combo);
-
-  if (results[order[0]].dest_addr->ai_family == AF_INET6)
-    {
-      puts ("wrong order in second test");
-      result |= 1;
-    }
-
-  return result;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-rfc3484-3.c b/posix/tst-rfc3484-3.c
deleted file mode 100644
index ecb163963f..0000000000
--- a/posix/tst-rfc3484-3.c
+++ /dev/null
@@ -1,161 +0,0 @@
-#include <stdbool.h>
-#include <stdio.h>
-#include <ifaddrs.h>
-#include <stdint.h>
-
-/* Internal definitions used in the libc code.  */
-#define __getservbyname_r getservbyname_r
-#define __socket socket
-#define __getsockname getsockname
-#define __inet_aton inet_aton
-#define __gethostbyaddr_r gethostbyaddr_r
-#define __gethostbyname2_r gethostbyname2_r
-#define __qsort_r qsort_r
-#define __stat64 stat64
-
-void
-attribute_hidden
-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
-{
-  *p1 = *p2 = true;
-  *in6ai = NULL;
-  *in6ailen = 0;
-}
-
-void
-attribute_hidden
-__free_in6ai (struct in6addrinfo *ai)
-{
-}
-
-void
-attribute_hidden
-__check_native (uint32_t a1_index, int *a1_native,
-		uint32_t a2_index, int *a2_native)
-{
-}
-
-int
-attribute_hidden
-__idna_to_ascii_lz (const char *input, char **output, int flags)
-{
-  return 0;
-}
-
-int
-attribute_hidden
-__idna_to_unicode_lzlz (const char *input, char **output, int flags)
-{
-  *output = NULL;
-  return 0;
-}
-
-void
-attribute_hidden
-_res_hconf_init (void)
-{
-}
-
-#undef	USE_NSCD
-#include "../sysdeps/posix/getaddrinfo.c"
-
-nss_action_list __nss_hosts_database attribute_hidden;
-
-/* This is the beginning of the real test code.  The above defines
-   (among other things) the function rfc3484_sort.  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define h(n) n
-#else
-# define h(n) __bswap_constant_32 (n)
-#endif
-
-struct sockaddr_in addrs[] =
-{
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a86d1d) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a85d03) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a82c3d) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a86002) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a802f3) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a80810) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xa0a85e02) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xac162311) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0x0a324572) } }
-};
-#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
-static struct addrinfo ais[naddrs];
-static struct sort_result results[naddrs];
-static size_t order[naddrs];
-
-static const int expected[naddrs] =
-  {
-    8, 0, 1, 2, 3, 4, 5, 6, 7
-  };
-
-static const struct scopeentry new_scopes[] =
-  {
-    { { { 169, 254, 0, 0 } }, h (0xffff0000), 2 },
-    { { { 127, 0, 0, 0 } }, h (0xff000000), 2 },
-    { { { 10, 0, 0, 0 } }, h (0xff000000), 5 },
-    { { { 192, 168, 0, 0 } }, h(0xffff0000), 5 },
-    { { { 0, 0, 0, 0 } }, h (0x00000000), 14 }
-  };
-
-
-ssize_t
-__getline (char **lineptr, size_t *n, FILE *s)
-{
-  *lineptr = NULL;
-  *n = 0;
-  return 0;
-}
-
-
-static int
-do_test (void)
-{
-  labels = default_labels;
-  precedence = default_precedence;
-  scopes= new_scopes;
-
-  struct sockaddr_in so;
-  so.sin_family = AF_INET;
-  so.sin_addr.s_addr = h (0x0aa85f19);
-  /* Clear the rest of the structure to avoid warnings.  */
-  memset (so.sin_zero, '\0', sizeof (so.sin_zero));
-
-  for (int i = 0; i < naddrs; ++i)
-    {
-      ais[i].ai_family = AF_INET;
-      ais[i].ai_addr = (struct sockaddr *) &addrs[i];
-      results[i].dest_addr = &ais[i];
-      results[i].got_source_addr = true;
-      memcpy(&results[i].source_addr, &so, sizeof (so));
-      results[i].source_addr_len = sizeof (so);
-      results[i].source_addr_flags = 0;
-      results[i].prefixlen = 8;
-      results[i].index = 0;
-
-      order[i] = i;
-    }
-
-  struct sort_result_combo combo = { .results = results, .nresults = naddrs };
-  qsort_r (order, naddrs, sizeof (order[0]), rfc3484_sort, &combo);
-
-  int result = 0;
-  for (int i = 0; i < naddrs; ++i)
-    {
-      struct in_addr addr = ((struct sockaddr_in *) (results[order[i]].dest_addr->ai_addr))->sin_addr;
-
-      int here = memcmp (&addr, &addrs[expected[i]].sin_addr,
-			 sizeof (struct in_addr));
-      printf ("[%d] = %s: %s\n", i, inet_ntoa (addr), here ? "FAIL" : "OK");
-      result |= here;
-    }
-
-  return result;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
deleted file mode 100644
index 3b2052eb54..0000000000
--- a/posix/tst-rfc3484.c
+++ /dev/null
@@ -1,153 +0,0 @@
-#include <stdbool.h>
-#include <stdio.h>
-#include <ifaddrs.h>
-#include <stdint.h>
-
-/* Internal definitions used in the libc code.  */
-#define __getservbyname_r getservbyname_r
-#define __socket socket
-#define __getsockname getsockname
-#define __inet_aton inet_aton
-#define __gethostbyaddr_r gethostbyaddr_r
-#define __gethostbyname2_r gethostbyname2_r
-#define __qsort_r qsort_r
-#define __stat64 stat64
-
-void
-attribute_hidden
-__check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
-{
-  *p1 = *p2 = true;
-  *in6ai = NULL;
-  *in6ailen = 0;
-}
-
-void
-attribute_hidden
-__free_in6ai (struct in6addrinfo *ai)
-{
-}
-
-void
-attribute_hidden
-__check_native (uint32_t a1_index, int *a1_native,
-		uint32_t a2_index, int *a2_native)
-{
-}
-
-int
-attribute_hidden
-__idna_to_ascii_lz (const char *input, char **output, int flags)
-{
-  return 0;
-}
-
-int
-attribute_hidden
-__idna_to_unicode_lzlz (const char *input, char **output, int flags)
-{
-  *output = NULL;
-  return 0;
-}
-
-void
-attribute_hidden
-_res_hconf_init (void)
-{
-}
-
-#undef	USE_NSCD
-#include "../sysdeps/posix/getaddrinfo.c"
-
-nss_action_list __nss_hosts_database attribute_hidden;
-
-/* This is the beginning of the real test code.  The above defines
-   (among other things) the function rfc3484_sort.  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-# define h(n) n
-#else
-# define h(n) __bswap_constant_32 (n)
-#endif
-
-struct sockaddr_in addrs[] =
-{
-  { .sin_family = AF_INET, .sin_addr = { h (0x0aa85f19) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xac105f19) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0000219) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a86d1d) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a85d03) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a82c3d) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a86002) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a802f3) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a80810) } },
-  { .sin_family = AF_INET, .sin_addr = { h (0xc0a85e02) } }
-};
-#define naddrs (sizeof (addrs) / sizeof (addrs[0]))
-static struct addrinfo ais[naddrs];
-static struct sort_result results[naddrs];
-static size_t order[naddrs];
-
-static int expected[naddrs] =
-  {
-    9, 4, 3, 6, 5, 7, 8, 2, 0, 1
-  };
-
-
-ssize_t
-__getline (char **lineptr, size_t *n, FILE *s)
-{
-  *lineptr = NULL;
-  *n = 0;
-  return 0;
-}
-
-
-static int
-do_test (void)
-{
-  labels = default_labels;
-  precedence = default_precedence;
-  scopes= default_scopes;
-
-  struct sockaddr_in so;
-  so.sin_family = AF_INET;
-  so.sin_addr.s_addr = h (0xc0a85f19);
-  /* Clear the rest of the structure to avoid warnings.  */
-  memset (so.sin_zero, '\0', sizeof (so.sin_zero));
-
-  for (int i = 0; i < naddrs; ++i)
-    {
-      ais[i].ai_family = AF_INET;
-      ais[i].ai_addr = (struct sockaddr *) &addrs[i];
-      results[i].dest_addr = &ais[i];
-      results[i].got_source_addr = true;
-      memcpy(&results[i].source_addr, &so, sizeof (so));
-      results[i].source_addr_len = sizeof (so);
-      results[i].source_addr_flags = 0;
-      results[i].prefixlen = 8;
-      results[i].index = 0;
-
-      order[i] = i;
-    }
-
-  struct sort_result_combo combo = { .results = results, .nresults = naddrs };
-  qsort_r (order, naddrs, sizeof (order[0]), rfc3484_sort, &combo);
-
-  int result = 0;
-  for (int i = 0; i < naddrs; ++i)
-    {
-      struct in_addr addr = ((struct sockaddr_in *) (results[order[i]].dest_addr->ai_addr))->sin_addr;
-
-      int here = memcmp (&addr, &addrs[expected[i]].sin_addr,
-			 sizeof (struct in_addr));
-      printf ("[%d] = %s: %s\n", i, inet_ntoa (addr), here ? "FAIL" : "OK");
-      result |= here;
-    }
-
-  return result;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"