summaryrefslogtreecommitdiffstats
path: root/iptables/xtables-translate.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2017-03-09 11:56:39 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-03-09 12:37:56 +0100
commit0e94eb2e0e38cb9df0784e5be530358c692701de (patch)
tree4898eb3d31ba8f04637db622c1a73ee87dbaff2a /iptables/xtables-translate.c
parent48ad179bfdfdcab2e742ddfc868d2abaae78dcd3 (diff)
iptables-translate: print nft iff there are more expanded rules to print
$ 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> Tested-by: Alexander Alemayhu <alexander@alemayhu.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/xtables-translate.c')
-rw-r--r--iptables/xtables-translate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/iptables/xtables-translate.c b/iptables/xtables-translate.c
index d9885f20..00de0190 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 ");
}