From 2a459ebc0ee53a57a92631fa07f6bf2b4f3fbc8c Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Wed, 25 Sep 2019 11:29:59 +0200 Subject: xtables-restore: Minimize caching when flushing Unless --noflush was given, xtables-restore merely needs the list of tables to decide whether to delete it or not. Introduce nft_fake_cache() function which populates table list, initializes chain lists (so nft_chain_list_get() returns an empty list instead of NULL) and sets 'have_cache' to turn any later calls to nft_build_cache() into nops. If --noflush was given, call nft_build_cache() just once instead of for each table line in input. Signed-off-by: Phil Sutter Acked-by: Florian Westphal --- iptables/nft.h | 1 + 1 file changed, 1 insertion(+) (limited to 'iptables/nft.h') diff --git a/iptables/nft.h b/iptables/nft.h index 43463d7f..bcac8e22 100644 --- a/iptables/nft.h +++ b/iptables/nft.h @@ -73,6 +73,7 @@ int mnl_talk(struct nft_handle *h, struct nlmsghdr *nlh, void *data); int nft_init(struct nft_handle *h, const struct builtin_table *t); void nft_fini(struct nft_handle *h); +void nft_fake_cache(struct nft_handle *h); void nft_build_cache(struct nft_handle *h); /* -- cgit v1.2.3