From 1dc869d13c77297661bf7ba4bde4c879818149da Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 10 Jun 2003 08:58:05 +0000 Subject: 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. --- sysdeps/posix/getaddrinfo.c | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) (limited to 'sysdeps/posix') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 23f7122..0d6ac84 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) -- cgit v1.1