From patchwork Sun Dec 13 23:12:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 9997 Received: (qmail 94711 invoked by alias); 13 Dec 2015 23:12:37 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 94697 invoked by uid 89); 13 Dec 2015 23:12:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] Fix getifaddrs, freeifaddrs namespace on non-Linux Date: Mon, 14 Dec 2015 00:12:28 +0100 Message-Id: <1450048348-1536-1-git-send-email-aurelien@aurel32.net> Commit 7f994279 addressed the getifaddrs, freeifaddrs namespace issue on Linux, but this issue is also present on non-Linux via check_pf: freeaddrinfo -> [libc.a(getaddrinfo.o)] __check_pf -> libc.a(check_pf.o)] freeifaddrs This patch fixes this issue by fixing the generic check_pf version to call __getifaddrs and __freeifaddrs instead of getifaddrs and freeifaddrs. As check_pf.c is also included directly from nscd/gai.c, we need to use defines to revert this change there. --- ChangeLog | 9 +++++++++ include/ifaddrs.h | 2 ++ inet/check_pf.c | 4 ++-- nscd/gai.c | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13be8a8..3fb0b90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2015-12-12 Aurelien Jarno + + * include/ifaddrs.h (__getifaddrs): Declare. + (__freeifaddrs): Declare. + * inet/check_pf.c (__check_pf): Call __getifaddrs instead of + getifaddrs. Call __freeifaddrs instead of freeifaddrs. + * nscd/gai.c (__getifaddrs): Define to getifaddrs. + (__freeifaddrs): define to freeifaddrs. + 2015-12-11 Aurelien Jarno * sysdeps/unix/sysv/linux/arm/ioperm.c: Do not include diff --git a/include/ifaddrs.h b/include/ifaddrs.h index 2787f21..7c52ccf 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -3,7 +3,9 @@ #include #include +extern __typeof(getifaddrs) __getifaddrs; libc_hidden_proto (getifaddrs) +extern __typeof(freeifaddrs) __freeifaddrs; libc_hidden_proto (freeifaddrs) struct in6addrinfo diff --git a/inet/check_pf.c b/inet/check_pf.c index 3739a95..c49d6b5 100644 --- a/inet/check_pf.c +++ b/inet/check_pf.c @@ -32,7 +32,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6, /* Get the interface list via getifaddrs. */ struct ifaddrs *ifa = NULL; - if (getifaddrs (&ifa) != 0) + if (__getifaddrs (&ifa) != 0) { /* We cannot determine what interfaces are available. Be pessimistic. */ @@ -51,7 +51,7 @@ __check_pf (bool *seen_ipv4, bool *seen_ipv6, else if (runp->ifa_addr->sa_family == PF_INET6) *seen_ipv6 = true; - (void) freeifaddrs (ifa); + (void) __freeifaddrs (ifa); } diff --git a/nscd/gai.c b/nscd/gai.c index 9a52a97..dc289d6 100644 --- a/nscd/gai.c +++ b/nscd/gai.c @@ -29,6 +29,8 @@ #define __strchrnul strchrnul #define __getline getline #define __qsort_r qsort_r +#define __getifaddrs getifaddrs +#define __freeifaddrs freeifaddrs /* nscd uses 1MB or 2MB thread stacks. */ #define __libc_use_alloca(size) (size <= __MAX_ALLOCA_CUTOFF)