]> git.ipfire.org Git - thirdparty/nftables.git/commit
cache: chain listing implicitly sets on terse option
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 22 Aug 2023 09:33:27 +0000 (11:33 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 1 Sep 2025 20:47:56 +0000 (22:47 +0200)
commit5ad7a3b3ac89aaa45ac0d49a33f012c122862074
tree847011db53b952398e9682b7363ac3c65e570333
parentce7833a3bfee91081c7b70d3b30c5bddc3bf947b
cache: chain listing implicitly sets on terse option

commit 70d99ce8bf8bd3dab84ea0a6249812b04ec95b8c upstream.

If user specifies a chain to be listed (which is internally handled via
filtering options), then toggle NFT_CACHE_TERSE to skip fetching set
content from kernel for non-anonymous sets.

With a large IPv6 set with bogons, before this patch:

 # time nft list chain inet raw x
 table inet raw {
        chain x {
                ip6 saddr @bogons6
                ip6 saddr { aaaa::, bbbb:: }
        }
 }

 real    0m2,913s
 user    0m1,345s
 sys     0m1,568s

After this patch:

 # time nft list chain inet raw prerouting
 table inet raw {
        chain x {
                ip6 saddr @bogons6
                ip6 saddr { aaaa::, bbbb:: }
        }
 }

 real    0m0,056s
 user    0m0,018s
 sys     0m0,039s

This speeds up chain listing in the presence of a large set.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/cache.c