netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Guruswamy Basavaiah <guru2018@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] iptables-translate: Moving printing of nft to individual commands.
Date: Thu, 31 Mar 2016 12:37:27 +0200	[thread overview]
Message-ID: <20160331103727.GA3104@salvia> (raw)
In-Reply-To: <20160331102654.GA14649@inbhdhcp21574.apac.nsn-net.net>

On Thu, Mar 31, 2016 at 03:56:55PM +0530, Guruswamy Basavaiah wrote:
> Moving printing of "nft" to individual commands.
> 
> At present the "nft" is not printed, if iptables command is translated into
> multiple commads.
> 
> Before this patch:
> sudo ./iptables-translate -A INPUT --source "40.0.0.1, 30.0.0.1" --dest "20.0.0.1, 60.0.0.1" -j ACCEPT
> nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 20.0.0.1 counter accept
> add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter accept
> add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter accept
> add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 60.0.0.1 counter accept
> 
> After this patch:
> sudo ./iptables-translate -A INPUT --source "40.0.0.1, 30.0.0.1" --dest "20.0.0.1, 60.0.0.1" -j ACCEPT
> nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 20.0.0.1 counter accept
> nft add rule ip filter INPUT ip saddr 40.0.0.1 ip daddr 60.0.0.1 counter accept
> nft add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 20.0.0.1 counter accept
> nft add rule ip filter INPUT ip saddr 30.0.0.1 ip daddr 60.0.0.1 counter accept
> 
> Signed-off-by: Guruswamy Basavaiah <guru2018@gmail.com>
> ---
>  iptables/xtables-translate.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
> index 354357c..569c26e 100644
> --- a/iptables/xtables-translate.c
> +++ b/iptables/xtables-translate.c
> @@ -107,10 +107,10 @@ static int nft_rule_xlate_add(struct nft_handle *h,
>  	int ret;
>  
>  	if (append) {
> -		xt_xlate_add(xl, "add rule %s %s %s ",
> +		xt_xlate_add(xl, "nft add rule %s %s %s ",
>  			   family2str[h->family], p->table, p->chain);

This breaks iptables-restore-translate:

# iptables-restore-translate -f my-iptables-ruleset

Actually this is currently broken, could you send a patch that fixes
this in first place.

Thanks.

      reply	other threads:[~2016-03-31 10:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 10:26 [PATCH] iptables-translate: Moving printing of nft to individual commands Guruswamy Basavaiah
2016-03-31 10:37 ` Pablo Neira Ayuso [this message]

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=20160331103727.GA3104@salvia \
    --to=pablo@netfilter.org \
    --cc=guru2018@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).