From b5f2faea325a315bfb932ebc634f3298d4824cae Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 1 Mar 2022 18:59:31 +0100 Subject: nft: Simplify immediate parsing Implementations of parse_immediate callback are mostly trivial, the only relevant part is access to family-specific parts of struct iptables_command_state when setting goto flag for iptables and ip6tables. Refactor them into simple set_goto_flag callbacks. Signed-off-by: Phil Sutter Acked-by: Florian Westphal --- iptables/nft-ipv6.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'iptables/nft-ipv6.c') diff --git a/iptables/nft-ipv6.c b/iptables/nft-ipv6.c index 9ecc754f..a5323171 100644 --- a/iptables/nft-ipv6.c +++ b/iptables/nft-ipv6.c @@ -180,15 +180,9 @@ static void nft_ipv6_parse_payload(struct nft_xt_ctx *ctx, } } -static void nft_ipv6_parse_immediate(const char *jumpto, bool nft_goto, - void *data) +static void nft_ipv6_set_goto_flag(struct iptables_command_state *cs) { - struct iptables_command_state *cs = data; - - cs->jumpto = jumpto; - - if (nft_goto) - cs->fw6.ipv6.flags |= IP6T_F_GOTO; + cs->fw6.ipv6.flags |= IP6T_F_GOTO; } static void nft_ipv6_print_rule(struct nft_handle *h, struct nftnl_rule *r, @@ -418,7 +412,7 @@ struct nft_family_ops nft_family_ops_ipv6 = { .is_same = nft_ipv6_is_same, .parse_meta = nft_ipv6_parse_meta, .parse_payload = nft_ipv6_parse_payload, - .parse_immediate = nft_ipv6_parse_immediate, + .set_goto_flag = nft_ipv6_set_goto_flag, .print_header = print_header, .print_rule = nft_ipv6_print_rule, .save_rule = nft_ipv6_save_rule, -- cgit v1.2.3