about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-14 06:58:35 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-14 06:58:35 +0000
commit773e79b3162dff01e080cb152ff77945244f5a17 (patch)
treec5b1f11c79b36c6c1d02e80b0f6e00274ea6e586 /posix
parente458144c99ddc00769ffa6bd367c21d37e879d83 (diff)
downloadglibc-773e79b3162dff01e080cb152ff77945244f5a17.tar.gz
glibc-773e79b3162dff01e080cb152ff77945244f5a17.tar.xz
glibc-773e79b3162dff01e080cb152ff77945244f5a17.zip
* include/ifaddrs.h: Remove in6ai_temporary.
	(struct in6addrinfo): Add index element.
	Declare __check_native.
	* inet/Makefile (aux): Add check_native.
	* sysdeps/unix/sysv/linux/check_native.c: New file.
	* sysdeps/unix/sysv/linux/check_pf.c: No need to recognize
	IFA_F_TEMPORARY.  Pass back ifa_index.
	* sysdeps/posix/getaddrinfo.c: Remove netlink compatibility code.
	(rfc3484_sort): Add new parameter.  Implement rule 7 correctly:
	call __check_native if necessary.
	(getaddrinfo): Fill in index field.  Use qsort_r instead of qsort
	to sort addresses.  Pass information about the results.
	* posix/tst-rfc3484.c: Adjust for addition of index field and change
	of rfc3484_sort interface.
	* posix/tst-rfc3484-2.c: Likewise.
Diffstat (limited to 'posix')
-rw-r--r--posix/tst-rfc3484-2.c15
-rw-r--r--posix/tst-rfc3484.c10
2 files changed, 22 insertions, 3 deletions
diff --git a/posix/tst-rfc3484-2.c b/posix/tst-rfc3484-2.c
index f9fffd5d05..6d60ccd3bc 100644
--- a/posix/tst-rfc3484-2.c
+++ b/posix/tst-rfc3484-2.c
@@ -18,6 +18,12 @@ __check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
   *in6ai = NULL;
   *in6ailen = 0;
 }
+void
+attribute_hidden
+__check_native (uint32_t a1_index, int *a1_native,
+		uint32_t a2_index, int *a2_native)
+{
+}
 int
 __idna_to_ascii_lz (const char *input, char **output, int flags)
 {
@@ -100,6 +106,7 @@ do_test (void)
   results[0].source_addr_flags = 0;
   results[0].service_order = 0;
   results[0].prefixlen = 16;
+  results[0].index = 0;
   memcpy (&results[0].source_addr, &so1, sizeof (so1));
 
   results[1].dest_addr = &ai2;
@@ -108,10 +115,12 @@ do_test (void)
   results[1].source_addr_flags = 0;
   results[1].service_order = 1;
   results[1].prefixlen = 16;
+  results[1].index = 0;
   memcpy (&results[1].source_addr, &so2, sizeof (so2));
 
 
-  qsort (results, 2, sizeof (results[0]), rfc3484_sort);
+  struct sort_result_combo combo = { .results = results, .nresults = 2 };
+  qsort_r (results, 2, sizeof (results[0]), rfc3484_sort, &combo);
 
   int result = 0;
   if (results[0].dest_addr->ai_family == AF_INET6)
@@ -128,6 +137,7 @@ do_test (void)
   results[1].source_addr_flags = 0;
   results[1].service_order = 1;
   results[1].prefixlen = 16;
+  results[1].index = 0;
   memcpy (&results[1].source_addr, &so1, sizeof (so1));
 
   results[0].dest_addr = &ai2;
@@ -136,10 +146,11 @@ do_test (void)
   results[0].source_addr_flags = 0;
   results[0].service_order = 0;
   results[0].prefixlen = 16;
+  results[0].index = 0;
   memcpy (&results[0].source_addr, &so2, sizeof (so2));
 
 
-  qsort (results, 2, sizeof (results[0]), rfc3484_sort);
+  qsort_r (results, 2, sizeof (results[0]), rfc3484_sort, &combo);
 
   if (results[0].dest_addr->ai_family == AF_INET6)
     {
diff --git a/posix/tst-rfc3484.c b/posix/tst-rfc3484.c
index 477e2b220d..c4dd04e023 100644
--- a/posix/tst-rfc3484.c
+++ b/posix/tst-rfc3484.c
@@ -18,6 +18,12 @@ __check_pf (bool *p1, bool *p2, struct in6addrinfo **in6ai, size_t *in6ailen)
   *in6ai = NULL;
   *in6ailen = 0;
 }
+void
+attribute_hidden
+__check_native (uint32_t a1_index, int *a1_native,
+		uint32_t a2_index, int *a2_native)
+{
+}
 int
 __idna_to_ascii_lz (const char *input, char **output, int flags)
 {
@@ -95,9 +101,11 @@ do_test (void)
       results[i].source_addr_flags = 0;
       results[i].service_order = i;
       results[i].prefixlen = 8;
+      results[i].index = 0;
     }
 
-  qsort (results, naddrs, sizeof (results[0]), rfc3484_sort);
+  struct sort_result_combo combo = { .results = results, .nresults = naddrs };
+  qsort_r (results, naddrs, sizeof (results[0]), rfc3484_sort, &combo);
 
   int result = 0;
   for (int i = 0; i < naddrs; ++i)