]> git.ipfire.org Git - thirdparty/nftables.git/commit
cache: check for NFT_CACHE_REFRESH in current requested cache too
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 27 May 2024 16:12:05 +0000 (18:12 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 3 Jun 2024 18:17:49 +0000 (20:17 +0200)
commitbbb0e944b59d355085e8f50b4b7b5057ae0d33a4
tree2cfde3b2dddb7dc034e375655606747b6ac0671e
parentf6b579344eee17e5587b6a7fcc444fe997cd8cb6
cache: check for NFT_CACHE_REFRESH in current requested cache too

NFT_CACHE_REFRESH is set on inconditionally by ruleset list commands to
deal with stateful information in this ruleset. This flag results in
dropping the existing cache and fully fetching all objects from the
kernel.

Set on this flag for reset commands too, this is missing.

List/reset commands allow for filtering by specific family and object,
therefore, NFT_CACHE_REFRESH also signals that the cache is partially
populated.

Check if this flag is requested by the current list/reset command, as
well as cache->flags which represents the cache after the _previous_
list of commands.

A follow up patch allows to recycle the existing cache if the flags
report that the same objects are already available in the cache,
NFT_CACHE_REFRESH is useful to report that cache cannot be recycled.

Fixes: 407c54f71255 ("src: cache gets out of sync in interactive mode")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/cache.c