From patchwork Tue Aug 19 22:02:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 381500 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 9F0C2140081 for ; Wed, 20 Aug 2014 08:02:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751685AbaHSWCR (ORCPT ); Tue, 19 Aug 2014 18:02:17 -0400 Received: from mail.us.es ([193.147.175.20]:40295 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbaHSWCR (ORCPT ); Tue, 19 Aug 2014 18:02:17 -0400 Received: (qmail 2656 invoked from network); 20 Aug 2014 00:02:14 +0200 Received: from unknown (HELO us.es) (192.168.2.14) by us.es with SMTP; 20 Aug 2014 00:02:14 +0200 Received: (qmail 26375 invoked by uid 507); 19 Aug 2014 22:02:14 -0000 X-Qmail-Scanner-Diagnostics: from 127.0.0.1 by antivirus4 (envelope-from , uid 501) with qmail-scanner-2.10 (clamdscan: 0.98.4/19294. spamassassin: 3.3.2. Clear:RC:1(127.0.0.1):SA:0(-103.2/7.5):. Processed in 12.995448 secs); 19 Aug 2014 22:02:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on antivirus4 X-Spam-Level: X-Spam-Status: No, score=-103.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, SPF_HELO_FAIL,USER_IN_WHITELIST autolearn=disabled version=3.3.2 X-Spam-ASN: AS6079 216.80.64.0/18 X-Envelope-From: pneira@us.es Received: from unknown (HELO antivirus4) (127.0.0.1) by us.es with SMTP; 19 Aug 2014 22:02:01 -0000 Received: from 192.168.1.13 (192.168.1.13) by antivirus4 (F-Secure/fsigk_smtp/412/antivirus4); Wed, 20 Aug 2014 00:02:01 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/412/antivirus4) Received: (qmail 9158 invoked from network); 20 Aug 2014 00:02:01 +0200 Received: from sheratonips75.s.subnet.rcn.com (HELO us.es) (1984lsi@216.80.65.74) by mail.us.es with AES128-SHA encrypted SMTP; 20 Aug 2014 00:02:01 +0200 Date: Wed, 20 Aug 2014 00:02:36 +0200 From: Pablo Neira Ayuso To: Thomas Petazzoni Cc: netfilter-devel@vger.kernel.org Subject: Re: [libnftnl PATCH] Rename xfree() to libnftnl_xfree() to avoid symbol naming conflict Message-ID: <20140819220236.GA7136@salvia> References: <1408196389-15559-1-git-send-email-thomas.petazzoni@free-electrons.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1408196389-15559-1-git-send-email-thomas.petazzoni@free-electrons.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org On Sat, Aug 16, 2014 at 03:39:49PM +0200, Thomas Petazzoni wrote: > When ELF binaries and shared libraries are used, the internal > functions of libnftnl such as xfree() are not visible to the outside > world (their visibility is 'hidden'). Therefore, the fact that other > programs (especially nftables) may have symbols with the same name > does not cause any problem. > > However, when doing static linking on a non-ELF platform (such as > Blackfin, which uses the FLAT binary format), there is no way of > encoding this visibility. Therefore, the xfree() symbols of libnftnl > becomes visible to the outside world, causing a conflict with the > xfree() symbol defined by nftables. > > To solve this, this patch renames the libnftnl xfree() function to > libnftnl_xfree(). Would this small patch solve your problem too? diff --git a/src/internal.h b/src/internal.h index e76a5cb..c8dea7e 100644 --- a/src/internal.h +++ b/src/internal.h @@ -16,6 +16,8 @@ #include #include +#define xfree(ptr) free((void *)ptr); + #define BASE_DEC 10 #define BASE_HEX 16 @@ -144,8 +146,6 @@ int nft_event_footer_snprintf(char *buf, size_t bufsize, uint32_t format, uint32_t flags); int nft_event_footer_fprintf(FILE *fp, uint32_t format, uint32_t flags); -void xfree(const void *ptr); - struct expr_ops; struct nft_rule_expr { diff --git a/src/utils.c b/src/utils.c index 1878390..96c8bf2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -180,11 +180,6 @@ int nft_str2verdict(const char *verdict, int *verdict_num) return -1; } -void xfree(const void *ptr) -{ - free((void *)ptr); -} - int nft_fprintf(FILE *fp, void *obj, uint32_t type, uint32_t flags, int (*snprintf_cb)(char *buf, size_t bufsiz, void *obj, uint32_t type, uint32_t flags))