All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Hani Benhabiles <kroosec@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables] libxtables: Call ipaddr_to_network before ipaddr_to_host.
Date: Mon, 30 Dec 2013 18:46:03 +0100	[thread overview]
Message-ID: <20131230174603.GA21372@localhost> (raw)
In-Reply-To: <20131209200223.GC2970@Inspiron-3521>

On Mon, Dec 09, 2013 at 09:02:23PM +0100, Hani Benhabiles wrote:
> Call ipaddr_to_network before ipaddr_to_host.
> 
> This saves waiting for a reverse DNS lookup query when the entry is present in
> /etc/networks. This also follows the same order as in rules creation.

This saves time and it makes sense to me to check local file before
name resolution via network, but...

> Signed-off-by: Hani Benhabiles <kroosec@gmail.com>
> ---
>  libxtables/xtables.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libxtables/xtables.c b/libxtables/xtables.c
> index fb60c01..bb25262 100644
> --- a/libxtables/xtables.c
> +++ b/libxtables/xtables.c
> @@ -1207,8 +1207,8 @@ const char *xtables_ipaddr_to_anyname(const struct in_addr *addr)
>  {
>  	const char *name;
>  
> -	if ((name = ipaddr_to_host(addr)) != NULL ||
> -	    (name = ipaddr_to_network(addr)) != NULL)
> +	if ((name = ipaddr_to_network(addr)) != NULL ||
> +	    (name = ipaddr_to_host(addr)) != NULL)

My only concern is the remote case in which you may have a network
name that overlaps with some existing host name, in that case the
expected output different.


  reply	other threads:[~2013-12-30 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09 20:02 [PATCH iptables] libxtables: Call ipaddr_to_network before ipaddr_to_host Hani Benhabiles
2013-12-30 17:46 ` Pablo Neira Ayuso [this message]
2013-12-31 17:50   ` Hani Benhabiles

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=20131230174603.GA21372@localhost \
    --to=pablo@netfilter.org \
    --cc=kroosec@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.