netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Shyam Saini <mayhs11saini@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] libxtables: xtables: Use getnameinfo()
Date: Tue, 20 Dec 2016 00:38:00 +0100	[thread overview]
Message-ID: <20161219233800.GB4610@salvia> (raw)
In-Reply-To: <1481554437-20319-2-git-send-email-mayhs11saini@gmail.com>

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 <mayhs11saini@gmail.com>
> ---
>  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;

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;

I collapsed this small update, so this is full C99 initialization.
Thanks.

  reply	other threads:[~2016-12-19 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-12 14:53 [PATCH 1/2] libxtables: xtables: remove unnecessary debug code Shyam Saini
2016-12-12 14:53 ` [PATCH 2/2] libxtables: xtables: Use getnameinfo() Shyam Saini
2016-12-19 23:38   ` Pablo Neira Ayuso [this message]
2016-12-19 23:37 ` [PATCH 1/2] libxtables: xtables: remove unnecessary debug code Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161219233800.GB4610@salvia \
    --to=pablo@netfilter.org \
    --cc=mayhs11saini@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).