From 528cbf99ff6062420270e637df4d40a77514fe56 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 7 Aug 2018 12:29:35 +0200 Subject: xtables: Fix for wrong counter format in -S output Legacy iptables uses '-c PCNT BCNT' format in listed rules, nft-variant used '[PCNT BCNT]' prefix like with iptables-save. In order to pass the counter format preference along, FMT_C_COUNTS is introduced and related 'format' checks adjusted. Since legacy iptables prints the counters between matches and target, this change affects save_matches_and_target() function. In order to get access to the rule counters, it's declaration is adjusted to receive iptables_command_state pointer instead of match, target and jumpto pointers from the same object. While being at it, integrate jump to user-defined chain into it as well since the related code in both callers was almost identical. Though since different rule flags are used between iptables and ip6tables, pass a 'goto_flag' boolean instead of the actual 'flags' bitfield. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- iptables/nft-shared.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'iptables/nft-shared.h') diff --git a/iptables/nft-shared.h b/iptables/nft-shared.h index 1f5c8a81..49e2fa10 100644 --- a/iptables/nft-shared.h +++ b/iptables/nft-shared.h @@ -166,10 +166,9 @@ void save_rule_details(const struct iptables_command_state *cs, unsigned const char *outiface_mask); void save_counters(const void *data); void nft_ipv46_save_chain(const struct nftnl_chain *c, const char *policy); -void save_matches_and_target(struct xtables_rule_match *m, - struct xtables_target *target, - const char *jumpto, - uint8_t flags, const void *fw); +void save_matches_and_target(const struct iptables_command_state *cs, + bool goto_flag, const void *fw, + unsigned int format); struct nft_family_ops *nft_family_ops_lookup(int family); -- cgit v1.2.3