From 026109dbece39ad27c43ebc31a17a22e5b581987 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 2 Oct 2019 21:13:47 +0200 Subject: nft-cache: Support partial rule cache per chain Accept an additional chain name pointer in __nft_build_cache() and pass it along to fetch only that specific chain and its rules. Enhance nft_build_cache() to take an optional nftnl_chain pointer to fetch rules for. Enhance nft_chain_list_get() to take an optional chain name. If cache level doesn't include chains already, it will fetch only the specified chain from kernel (if existing) and add that to table's chain list which is returned. This keeps operations for all chains of a table or a specific one within the same code path in nft.c. Signed-off-by: Phil Sutter Acked-by: Pablo Neira Ayuso --- iptables/nft-cache.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'iptables/nft-cache.h') diff --git a/iptables/nft-cache.h b/iptables/nft-cache.h index 423c6516..793a85f4 100644 --- a/iptables/nft-cache.h +++ b/iptables/nft-cache.h @@ -4,14 +4,14 @@ struct nft_handle; void nft_fake_cache(struct nft_handle *h); -void nft_build_cache(struct nft_handle *h); +void nft_build_cache(struct nft_handle *h, struct nftnl_chain *c); void nft_rebuild_cache(struct nft_handle *h); void nft_release_cache(struct nft_handle *h); void flush_chain_cache(struct nft_handle *h, const char *tablename); void flush_rule_cache(struct nftnl_chain *c); -struct nftnl_chain_list *nft_chain_list_get(struct nft_handle *h, - const char *table); +struct nftnl_chain_list * +nft_chain_list_get(struct nft_handle *h, const char *table, const char *chain); struct nftnl_table_list *nftnl_table_list_get(struct nft_handle *h); #endif /* _NFT_CACHE_H_ */ -- cgit v1.2.3