From patchwork Mon Dec 19 23:38:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 707275 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 3tjHR438lpz9t2T for ; Tue, 20 Dec 2016 10:38:08 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932410AbcLSXiG (ORCPT ); Mon, 19 Dec 2016 18:38:06 -0500 Received: from mail.us.es ([193.147.175.20]:36692 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932110AbcLSXiF (ORCPT ); Mon, 19 Dec 2016 18:38:05 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 367607643 for ; Tue, 20 Dec 2016 00:38:04 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 28CDEDA865 for ; Tue, 20 Dec 2016 00:38:04 +0100 (CET) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id 1E535DA861; Tue, 20 Dec 2016 00:38:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-107.2 required=7.5 tests=BAYES_50, HEADER_FROM_DIFFERENT_DOMAINS, SMTPAUTH_US, SPF_HELO_FAIL, USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id E7301DA85D for ; Tue, 20 Dec 2016 00:38:01 +0100 (CET) Received: from 192.168.1.13 (192.168.1.13) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/540/antivirus1-rhel7.int); Tue, 20 Dec 2016 00:38:01 +0100 (CET) X-Virus-Status: clean(F-Secure/fsigk_smtp/540/antivirus1-rhel7.int) Received: (qmail 25194 invoked from network); 20 Dec 2016 00:38:01 +0100 Received: from 77.166.216.87.static.jazztel.es (HELO us.es) (1984lsi@87.216.166.77) by mail.us.es with AES128-SHA encrypted SMTP; 20 Dec 2016 00:38:01 +0100 Date: Tue, 20 Dec 2016 00:38:00 +0100 From: Pablo Neira Ayuso To: Shyam Saini Cc: netfilter-devel@vger.kernel.org Subject: Re: [PATCH 2/2] libxtables: xtables: Use getnameinfo() Message-ID: <20161219233800.GB4610@salvia> References: <1481554437-20319-1-git-send-email-mayhs11saini@gmail.com> <1481554437-20319-2-git-send-email-mayhs11saini@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1481554437-20319-2-git-send-email-mayhs11saini@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org On Mon, Dec 12, 2016 at 08:23:57PM +0530, Shyam Saini wrote: > Replace gethostbyaddr() with getnameinfo() as getnameinfo() > deprecates the former and allows programs to > eliminate IPv4-versus-IPv6 dependencies Also applied, thanks. > Signed-off-by: Shyam Saini > --- > libxtables/xtables.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/libxtables/xtables.c b/libxtables/xtables.c > index 6e75c15..e1512b1 100644 > --- a/libxtables/xtables.c > +++ b/libxtables/xtables.c > @@ -1210,13 +1210,18 @@ const char *xtables_ipaddr_to_numeric(const struct in_addr *addrp) > > static const char *ipaddr_to_host(const struct in_addr *addr) > { > - struct hostent *host; > + static char hostname[NI_MAXHOST]; > + struct sockaddr_in saddr = { .sin_family = AF_INET, }; > + saddr.sin_addr = *addr; I collapsed this small update, so this is full C99 initialization. Thanks. --- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/libxtables/xtables.c b/libxtables/xtables.c index bed43480d589..d43f97066ea9 100644 --- a/libxtables/xtables.c +++ b/libxtables/xtables.c @@ -1211,8 +1211,10 @@ const char *xtables_ipaddr_to_numeric(const struct in_addr *addrp) static const char *ipaddr_to_host(const struct in_addr *addr) { static char hostname[NI_MAXHOST]; - struct sockaddr_in saddr = { .sin_family = AF_INET, }; - saddr.sin_addr = *addr; + struct sockaddr_in saddr = { + .sin_family = AF_INET, + .sin_addr = *addr, + }; int err;