diff options
author | Phil Sutter <phil@nwl.cc> | 2022-03-01 18:59:31 +0100 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-03-10 17:38:15 +0100 |
commit | b5f2faea325a315bfb932ebc634f3298d4824cae (patch) | |
tree | 62ae892c17a740836aa89cd99fac7ea0688be030 /iptables/nft-ipv4.c | |
parent | 17534cb18ed0a5052dc45c117401251359dba6aa (diff) |
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 <phil@nwl.cc>
Acked-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'iptables/nft-ipv4.c')
-rw-r--r-- | iptables/nft-ipv4.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/iptables/nft-ipv4.c b/iptables/nft-ipv4.c index f374d468..bdb105f8 100644 --- a/iptables/nft-ipv4.c +++ b/iptables/nft-ipv4.c @@ -215,15 +215,9 @@ static void nft_ipv4_parse_payload(struct nft_xt_ctx *ctx, } } -static void nft_ipv4_parse_immediate(const char *jumpto, bool nft_goto, - void *data) +static void nft_ipv4_set_goto_flag(struct iptables_command_state *cs) { - struct iptables_command_state *cs = data; - - cs->jumpto = jumpto; - - if (nft_goto) - cs->fw.ip.flags |= IPT_F_GOTO; + cs->fw.ip.flags |= IPT_F_GOTO; } static void nft_ipv4_print_rule(struct nft_handle *h, struct nftnl_rule *r, @@ -450,7 +444,7 @@ struct nft_family_ops nft_family_ops_ipv4 = { .is_same = nft_ipv4_is_same, .parse_meta = nft_ipv4_parse_meta, .parse_payload = nft_ipv4_parse_payload, - .parse_immediate = nft_ipv4_parse_immediate, + .set_goto_flag = nft_ipv4_set_goto_flag, .print_header = print_header, .print_rule = nft_ipv4_print_rule, .save_rule = nft_ipv4_save_rule, |