* [PATCH iptables] iptables-translate: print nft iff there are more expanded rules to print
@ 2017-03-09 11:00 Pablo Neira Ayuso
2017-03-09 11:27 ` Alexander Alemayhu
0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-03-09 11:00 UTC (permalink / raw)
To: netfilter-devel; +Cc: alexander
$ iptables-translate -I INPUT -s yahoo.com
nft insert rule ip filter INPUT ip saddr 98.139.183.24 counter
nft insert rule ip filter INPUT ip saddr 206.190.36.45 counter
nft insert rule ip filter INPUT ip saddr 98.138.253.109 counter
nft
This extra 'nft' print is incorrect, just print it if there are more
rules to be printed.
Reported-by: Alexander Alemayhu <alexander@alemayhu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
iptables/xtables-translate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index d9885f20dce6..00de019000f3 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -195,7 +195,7 @@ static int xlate(struct nft_handle *h, struct nft_xt_cmd_parse *p,
}
break;
}
- if (!cs->restore)
+ if (!cs->restore && i < args->s.naddrs - 1)
printf("nft ");
}
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH iptables] iptables-translate: print nft iff there are more expanded rules to print
2017-03-09 11:00 [PATCH iptables] iptables-translate: print nft iff there are more expanded rules to print Pablo Neira Ayuso
@ 2017-03-09 11:27 ` Alexander Alemayhu
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Alemayhu @ 2017-03-09 11:27 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On Thu, Mar 09, 2017 at 12:00:44PM +0100, Pablo Neira Ayuso wrote:
> $ iptables-translate -I INPUT -s yahoo.com
> nft insert rule ip filter INPUT ip saddr 98.139.183.24 counter
> nft insert rule ip filter INPUT ip saddr 206.190.36.45 counter
> nft insert rule ip filter INPUT ip saddr 98.138.253.109 counter
> nft
>
> This extra 'nft' print is incorrect, just print it if there are more
> rules to be printed.
>
> Reported-by: Alexander Alemayhu <alexander@alemayhu.com>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Tested-by: Alexander Alemayhu <alexander@alemayhu.com>
--
Mit freundlichen Grüßen
Alexander Alemayhu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-09 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-09 11:00 [PATCH iptables] iptables-translate: print nft iff there are more expanded rules to print Pablo Neira Ayuso
2017-03-09 11:27 ` Alexander Alemayhu
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).