netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Alexander Alemayhu <alexander@alemayhu.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH iptables] libxtables: fix wrong naddr when using localhost
Date: Wed, 8 Mar 2017 10:55:32 +0100	[thread overview]
Message-ID: <20170308095532.GA1723@salvia> (raw)
In-Reply-To: <20170307232813.17428-1-alexander@alemayhu.com>

On Wed, Mar 08, 2017 at 12:28:13AM +0100, Alexander Alemayhu wrote:
> $ iptables-translate -A INPUT -p tcp -s localhost --dport 8000 -j ACCEPT
> 
> gives
> 
>  nft add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept
>  add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept
> 
> with this patch we get
> 
>  nft add rule ip filter INPUT ip saddr 127.0.0.1 tcp dport 8000 counter accept

This is actually a generic problem:

# iptables -I INPUT -p tcp -s localhost

results in:

# iptables-save 
# Generated by iptables-save v1.6.1 on Wed Mar  8 10:53:07 2017
*filter
:INPUT ACCEPT [13:1628]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [4:317]
-A INPUT -s 127.0.0.1/32 -p tcp
-A INPUT -s 127.0.0.1/32 -p tcp
COMMIT
# Completed on Wed Mar  8 10:53:07 2017

Original problem was introduce at:

commit 2d2b5e046aa56a518160716a9ddf9df53fc79c1f
Author: Arpan Kapoor <rpnkpr@gmail.com>
Date:   Thu Mar 17 18:27:19 2016 +0530

    libxtables: Replace gethostbyname() with getaddrinfo()

Did you also run iptables tests? See iptables-test.py, although I
guess our test infrastructure is not catching up this case.

Thanks!

  reply	other threads:[~2017-03-08 10:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 23:28 [PATCH iptables] libxtables: fix wrong naddr when using localhost Alexander Alemayhu
2017-03-08  9:55 ` Pablo Neira Ayuso [this message]
2017-03-08 11:10   ` Alexander Alemayhu

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=20170308095532.GA1723@salvia \
    --to=pablo@netfilter.org \
    --cc=alexander@alemayhu.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).