about summary refs log tree commit diff
path: root/sysdeps/posix/getaddrinfo.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-10 08:58:05 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-10 08:58:05 +0000
commit1dc869d13c77297661bf7ba4bde4c879818149da (patch)
tree286fc8327a3a4fdc742d90b8ca8bd278f3616b8d /sysdeps/posix/getaddrinfo.c
parent06120d793a3ae31f8f510f220c8a0a8e23b6a177 (diff)
downloadglibc-1dc869d13c77297661bf7ba4bde4c879818149da.tar.gz
glibc-1dc869d13c77297661bf7ba4bde4c879818149da.tar.xz
glibc-1dc869d13c77297661bf7ba4bde4c879818149da.zip
Update.
	* inet/Makefile (aux): Add check_fd.
	* include/ifaddrs.h: Add prototype for __check_fd.
	* sysdeps/generic/check_fd.c: New file.
	* sysdeps/unix/sysv/linux/check_fd.c: New file.
	* sysdeps/unix/sysv/linux/ifaddrs.h (__no_netlink_support): Renamed
	from no_netlink_support.  Export.
	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Don't call getifaddrs,
	call __check_pf.

	* sysdeps/generic/ifaddrs.h: Add libc_hidden_def.
Diffstat (limited to 'sysdeps/posix/getaddrinfo.c')
-rw-r--r--sysdeps/posix/getaddrinfo.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 23f7122ae1..0d6ac84ade 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -925,32 +925,10 @@ getaddrinfo (const char *name, const char *service,
     {
       /* Determine whether we have IPv4 or IPv6 interfaces or both.
 	 We cannot cache the results since new interfaces could be
-	 added at any time.
-
-	 XXX We are using getifaddrs here which is more costly than
-	 it is really necessary.  Once things are stable we will have
-	 a special function which performs the task with less overhead.  */
-      struct ifaddrs *ifa = NULL;
-
-      if (getifaddrs (&ifa) != 0)
-	/* Cannot get the interface list, very bad.  */
-	return EAI_SYSTEM;
-
-      bool seen_ipv4 = false;
-      bool seen_ipv6 = false;
-
-      struct ifaddrs *runp = ifa;
-      while (runp != NULL)
-	{
-	  if (runp->ifa_addr->sa_family == PF_INET)
-	    seen_ipv4 = true;
-	  else if (runp->ifa_addr->sa_family == PF_INET6)
-	    seen_ipv6 = true;
-
-	  runp = runp->ifa_next;
-	}
-
-      (void) freeifaddrs (ifa);
+	 added at any time.  */
+      bool seen_ipv4;
+      bool seen_ipv6;
+      __check_pf (&seen_ipv4, &seen_ipv6);
 
       /* Now make a decision on what we return, if anything.  */
       if (hints->ai_family == PF_UNSPEC)