netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iptables 1/2] iptables-translate: print nft command for each expand rules via dns names
@ 2017-03-08 13:16 Pablo Neira Ayuso
  2017-03-08 13:16 ` [PATCH iptables 2/2] libxtables: pass AI_ADDRCONFIG flag to getaddrinfo() Pablo Neira Ayuso
  2017-03-09  7:23 ` [PATCH iptables 1/2] iptables-translate: print nft command for each expand rules via dns names Alexander Alemayhu
  0 siblings, 2 replies; 5+ messages in thread
From: Pablo Neira Ayuso @ 2017-03-08 13:16 UTC (permalink / raw)
  To: netfilter-devel; +Cc: alexander

We have to print nft at the very beginning for each rule that rules from
the expansion, otherwise the output is not correct:

 # iptables-translate -I INPUT -s yahoo.com
 nft insert rule ip filter INPUT ip saddr 206.190.36.45 counter
 insert rule ip filter INPUT ip saddr 98.138.253.109 counter
 insert rule ip filter INPUT ip saddr 98.139.183.24 counter

After this patch:

 # iptables-translate -I INPUT -s yahoo.com
 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 insert rule ip filter INPUT ip saddr 98.139.183.24 counter

Reported-by: Alexander Alemayhu <alexander@alemayhu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 iptables/xtables-translate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index 153bd6503c59..1e35b90d77a2 100644
--- a/iptables/xtables-translate.c
+++ b/iptables/xtables-translate.c
@@ -195,6 +195,8 @@ static int xlate(struct nft_handle *h, struct nft_xt_cmd_parse *p,
 			}
 			break;
 		}
+		if (!cs->restore)
+			printf("nft ");
 	}
 
 	return ret;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-03-09  7:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-08 13:16 [PATCH iptables 1/2] iptables-translate: print nft command for each expand rules via dns names Pablo Neira Ayuso
2017-03-08 13:16 ` [PATCH iptables 2/2] libxtables: pass AI_ADDRCONFIG flag to getaddrinfo() Pablo Neira Ayuso
2017-03-08 13:56   ` Jan Engelhardt
2017-03-08 14:00     ` Pablo Neira Ayuso
2017-03-09  7:23 ` [PATCH iptables 1/2] iptables-translate: print nft command for each expand rules via dns names 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).