]> git.ipfire.org Git - thirdparty/iptables.git/commit
nft: Simplify per table chain cache update
authorPhil Sutter <phil@nwl.cc>
Thu, 20 Dec 2018 15:09:08 +0000 (16:09 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 27 Dec 2018 18:29:43 +0000 (19:29 +0100)
commit402dac2190e6011d4f4ad81c2992b7126b3d79d9
tree6591cfc8e5225f09147b139a0f1c6f93e1408a3d
parentd4b0d248cc057e39608c7c1c1203dd3f1ea96645
nft: Simplify per table chain cache update

Previously, each table's chain cache was potentially unallocated until
nftnl_chain_list_cb() saw a chain for it. This means such callback had to
check the chain_cache pointer for each chain belonging to that table.

In addition to the above, nft_chain_list_get() had to cover for the
possibility that a given table didn't have any chains at all in kernel,
so check requested table's chain cache once more and allocate it if
NULL.

Instead, simply iterate over all tables and preallocate their chain
caches prior to requesting the chain list from kernel. The only caveat
is to flush the chain cache completely before retrying in case of EINTR.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c