path: root/iptables/nft-cache.h
diff options
authorPhil Sutter <>2021-03-25 16:24:39 +0100
committerPhil Sutter <>2021-04-06 10:52:42 +0200
commitfdf64dcdace989589bac441805082e3b1fe6a915 (patch)
tree37fcc128d5f5c9030dc4a5ea4d377f2ef5afb3df /iptables/nft-cache.h
parentc5d9a723b5159a28f547b577711787295a14fd84 (diff)
nft: cache: Sort chains on demand only
Mandatory sorted insert of chains into cache significantly slows down restoring of large rulesets. Since the sorted list of user-defined chains is needed for listing and verbose output only, introduce nft_cache_sort_chains() and call it where needed. Signed-off-by: Phil Sutter <>
Diffstat (limited to 'iptables/nft-cache.h')
1 files changed, 1 insertions, 0 deletions
diff --git a/iptables/nft-cache.h b/iptables/nft-cache.h
index 20d96bee..58a01526 100644
--- a/iptables/nft-cache.h
+++ b/iptables/nft-cache.h
@@ -16,6 +16,7 @@ int flush_rule_cache(struct nft_handle *h, const char *table,
void nft_cache_build(struct nft_handle *h);
int nft_cache_add_chain(struct nft_handle *h, const struct builtin_table *t,
struct nftnl_chain *c);
+int nft_cache_sort_chains(struct nft_handle *h, const char *table);
struct nft_chain *
nft_chain_find(struct nft_handle *h, const char *table, const char *chain);