]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
cache: honor filter in set listing commands
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 25 Oct 2021 21:34:07 +0000 (23:34 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 26 Oct 2021 22:37:46 +0000 (00:37 +0200)
Fetch table, set and set elements only for set listing commands, e.g.
nft list set inet filter ipv4_bogons.

Fixes: 635ee1cad8aa ("cache: filter out sets and maps that are not requested")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/cache.c

index 3cbf99e8e124ef40b9449e062d6856a671ea957e..691e8131c49436b54f5043ff68a5101f37772fb6 100644 (file)
@@ -146,6 +146,8 @@ static unsigned int evaluate_cache_list(struct nft_ctx *nft, struct cmd *cmd,
                }
                if (nft_output_terse(&nft->output))
                        flags |= (NFT_CACHE_FULL & ~NFT_CACHE_SETELEM);
+               else if (filter->table && filter->set)
+                       flags |= NFT_CACHE_TABLE | NFT_CACHE_SET | NFT_CACHE_SETELEM;
                else
                        flags |= NFT_CACHE_FULL;
                break;