]> git.ipfire.org Git - thirdparty/iptables.git/commit
nft: cache: Fetch cache for specific chains
authorPhil Sutter <phil@nwl.cc>
Thu, 19 Mar 2020 17:58:29 +0000 (18:58 +0100)
committerPhil Sutter <phil@nwl.cc>
Mon, 11 May 2020 12:28:28 +0000 (14:28 +0200)
commitf806ee67b5178342d18c8cd3e9201190d8a82c41
tree0637a644191fc0ecc7e99f0ebb794442539cb674
parent0e1b72a6d7b6c1c13f5603a916d3847fbe1a3ee3
nft: cache: Fetch cache for specific chains

Iterate over command list and collect chains to cache. Insert them into
a sorted list to pass to __nft_build_cache().

If a command is interested in all chains (e.g., --list), cmd->chain
remains unset. To record this case reliably, use a boolean
('all_chains'). Otherwise, it is hard to distinguish between first call
to nft_cache_level_set() and previous command with NULL cmd->chain
value.

When caching only specific chains, manually add builtin ones for the
given table as well - otherwise nft_xt_builtin_init() will act as if
they don't exist and possibly override non-default chain policies.

Signed-off-by: Phil Sutter <phil@nwl.cc>
iptables/nft-cache.c
iptables/nft.c
iptables/nft.h