summaryrefslogtreecommitdiffstats
path: root/include/nftables/nftables.h
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-10-25 13:40:29 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-10-26 20:14:24 +0200
commit94a945ffa81b7f1db250e519f0b4b808428ab223 (patch)
tree869b5960a682e6379762db0cd385b4aec52b6c4b /include/nftables/nftables.h
parentf8596968a650c66e0b4d5895b700d03d7518b245 (diff)
libnftables: Get rid of explicit cache flushes
In the past, CLI as a potentially long running process had to make sure it kept it's cache up to date with kernel's rule set. A simple test case is this: | shell a | shell b | | # nft -i | # nft add table ip t | | | nft> list ruleset | | table ip t { | | } | # nft flush ruleset | | | nft> list ruleset | | nft> In order to make sure interactive CLI wouldn't incorrectly list the table again in the second 'list' command, it immediately flushed it's cache after every command execution. This patch eliminates the need for that by making cache updates depend on kernel's generation ID: A cache update stores the current rule set's ID in struct nft_cache, consecutive calls to cache_update() compare that stored value to the current generation ID received from kernel - if the stored value is zero (i.e. no previous cache update did happen) or if it doesn't match the kernel's value (i.e. cache is outdated) the cache is flushed and fully initialized again. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/nftables/nftables.h')
-rw-r--r--include/nftables/nftables.h2
1 files changed, 0 insertions, 2 deletions
diff --git a/include/nftables/nftables.h b/include/nftables/nftables.h
index 449f9e4e..4211be76 100644
--- a/include/nftables/nftables.h
+++ b/include/nftables/nftables.h
@@ -70,8 +70,6 @@ FILE *nft_ctx_set_output(struct nft_ctx *ctx, FILE *fp);
int nft_ctx_add_include_path(struct nft_ctx *ctx, const char *path);
void nft_ctx_clear_include_paths(struct nft_ctx *ctx);
-void nft_ctx_flush_cache(struct nft_ctx *ctx);
-
int nft_run_cmd_from_buffer(struct nft_ctx *nft, char *buf, size_t buflen);
int nft_run_cmd_from_filename(struct nft_ctx *nft, const char *filename);