]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: get rid of nft_ipv{4,6}_save_counters()
authorPhil Sutter <phil@nwl.cc>
Thu, 19 Jul 2018 16:32:03 +0000 (18:32 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 19 Jul 2018 21:10:06 +0000 (23:10 +0200)
Just replace them by the shared save_counters() function after adjusting
it's signature to meet callback requirements.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
iptables/nft-ipv4.c
iptables/nft-ipv6.c
iptables/nft-shared.c
iptables/nft-shared.h

index 2ca3155eae69e92400d5c0163db6fa0b408f332d..f118dcb8a695d7684d2bf14c6a20572a1b4d83e3 100644 (file)
@@ -414,13 +414,6 @@ static void nft_ipv4_post_parse(int command,
                              " source or destination IP addresses");
 }
 
-static void nft_ipv4_save_counters(const void *data)
-{
-       const struct iptables_command_state *cs = data;
-
-       save_counters(cs->counters.pcnt, cs->counters.bcnt);
-}
-
 static int nft_ipv4_xlate(const void *data, struct xt_xlate *xl)
 {
        const struct iptables_command_state *cs = data;
@@ -492,7 +485,7 @@ struct nft_family_ops nft_family_ops_ipv4 = {
        .print_header           = print_header,
        .print_firewall         = nft_ipv4_print_firewall,
        .save_firewall          = nft_ipv4_save_firewall,
-       .save_counters          = nft_ipv4_save_counters,
+       .save_counters          = save_counters,
        .proto_parse            = nft_ipv4_proto_parse,
        .post_parse             = nft_ipv4_post_parse,
        .parse_target           = nft_ipv46_parse_target,
index 29b50878bef4756cc3fc033e65b3ef6c62bd4294..9e9049f393959cd8d3159237d7fd01e774f550de 100644 (file)
@@ -367,13 +367,6 @@ static void nft_ipv6_post_parse(int command, struct iptables_command_state *cs,
                              " source or destination IP addresses");
 }
 
-static void nft_ipv6_save_counters(const void *data)
-{
-       const struct iptables_command_state *cs = data;
-
-       save_counters(cs->counters.pcnt, cs->counters.bcnt);
-}
-
 static void xlate_ipv6_addr(const char *selector, const struct in6_addr *addr,
                            const struct in6_addr *mask,
                            int invert, struct xt_xlate *xl)
@@ -447,7 +440,7 @@ struct nft_family_ops nft_family_ops_ipv6 = {
        .print_header           = print_header,
        .print_firewall         = nft_ipv6_print_firewall,
        .save_firewall          = nft_ipv6_save_firewall,
-       .save_counters          = nft_ipv6_save_counters,
+       .save_counters          = save_counters,
        .proto_parse            = nft_ipv6_proto_parse,
        .post_parse             = nft_ipv6_post_parse,
        .parse_target           = nft_ipv46_parse_target,
index 45e308679925fcc84e4d26534a7fcfa33d4f5c46..1018b6319cb391bda323a38aa7db154660af5649 100644 (file)
@@ -794,10 +794,12 @@ void save_firewall_details(const struct iptables_command_state *cs,
        }
 }
 
-void save_counters(uint64_t pcnt, uint64_t bcnt)
+void save_counters(const void *data)
 {
-       printf("[%llu:%llu] ", (unsigned long long)pcnt,
-                              (unsigned long long)bcnt);
+       const struct iptables_command_state *cs = data;
+
+       printf("[%llu:%llu] ", (unsigned long long)cs->counters.pcnt,
+                              (unsigned long long)cs->counters.bcnt);
 }
 
 void save_matches_and_target(struct xtables_rule_match *m,
index e4c021e1ac69e4d94fb4e6869cb7b510b08d85d7..578726d040e2d36f8931be5453dd9ef5ce71cf9c 100644 (file)
@@ -165,7 +165,7 @@ void save_firewall_details(const struct iptables_command_state *cs,
                           unsigned const char *iniface_mask,
                           const char *outiface,
                           unsigned const char *outiface_mask);
-void save_counters(uint64_t pcnt, uint64_t bcnt);
+void save_counters(const void *data);
 void save_matches_and_target(struct xtables_rule_match *m,
                             struct xtables_target *target,
                             const char *jumpto,