diff options
author | Florian Westphal <fw@strlen.de> | 2016-06-17 14:27:39 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2016-06-17 17:42:58 +0200 |
commit | 5d7cbf6e6c66d20129320a9b57ce56c868542816 (patch) | |
tree | 6ef70d9e838b3b835d9c25f40433a885e0fc6ff3 /extensions/libip6t_NETMAP.c | |
parent | c513cc3dd10231f267548d644dcb7632516a2348 (diff) |
extensions: NETMAP: fix iptables-save output
NETMAP_print is also used by its .save hook so this change
broke iptables-save output.
Revert the patch, rename NETMAP_print to __NETMAP_print and
use that as the workhorse for both xtables -L and xtables-save.
The addition of the 'to' prefix is done in the .print hook only.
Reported-by: Shivani Bhardwaj <shivanib134@gmail.com>
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Fixes: 90becf12bd5823b6d59d32d ("extensions: NETMAP: add ' to:' prefix when printing NETMAP target")
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'extensions/libip6t_NETMAP.c')
-rw-r--r-- | extensions/libip6t_NETMAP.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/extensions/libip6t_NETMAP.c b/extensions/libip6t_NETMAP.c index 8d2913fe..579ed04e 100644 --- a/extensions/libip6t_NETMAP.c +++ b/extensions/libip6t_NETMAP.c @@ -49,8 +49,8 @@ static void NETMAP_parse(struct xt_option_call *cb) } } -static void NETMAP_print(const void *ip, const struct xt_entry_target *target, - int numeric) +static void __NETMAP_print(const void *ip, const struct xt_entry_target *target, + int numeric) { const struct nf_nat_range *r = (const void *)target->data; struct in6_addr a; @@ -58,7 +58,7 @@ static void NETMAP_print(const void *ip, const struct xt_entry_target *target, int bits; a = r->min_addr.in6; - printf(" to:%s", xtables_ip6addr_to_numeric(&a)); + printf("%s", xtables_ip6addr_to_numeric(&a)); for (i = 0; i < 4; i++) a.s6_addr32[i] = ~(r->min_addr.ip6[i] ^ r->max_addr.ip6[i]); bits = xtables_ip6mask_to_cidr(&a); @@ -68,10 +68,17 @@ static void NETMAP_print(const void *ip, const struct xt_entry_target *target, printf("/%d", bits); } +static void NETMAP_print(const void *ip, const struct xt_entry_target *target, + int numeric) +{ + printf(" to:"); + __NETMAP_print(ip, target, numeric); +} + static void NETMAP_save(const void *ip, const struct xt_entry_target *target) { printf(" --%s ", NETMAP_opts[0].name); - NETMAP_print(ip, target, 0); + __NETMAP_print(ip, target, 0); } static struct xtables_target netmap_tg_reg = { |