]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: Introduce helper function cache_flush
authorAnatole Denis <anatole@rezel.net>
Thu, 1 Dec 2016 10:50:16 +0000 (11:50 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 1 Dec 2016 11:30:56 +0000 (12:30 +0100)
cache_release empties the cache, and marks it as uninitialized. Add cache_flush,
which does the same, except it keeps the cache initialized, eg. after a "nft
flush ruleset" when empty is the correct state of the cache.

Signed-off-by: Anatole Denis <anatole@rezel.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/rule.h
src/rule.c

index 99e92ee8672819e364d4acdf24b2f09268a5f5f0..b9b4a19c9731a4a168730d733bba51fe6c76e406 100644 (file)
@@ -422,6 +422,7 @@ struct netlink_ctx;
 extern int do_command(struct netlink_ctx *ctx, struct cmd *cmd);
 
 extern int cache_update(enum cmd_ops cmd, struct list_head *msgs);
+extern void cache_flush(void);
 extern void cache_release(void);
 
 enum udata_type {
index 8c58bfa6280c273e50bd5458ad1e3d03312faf49..8710767bc33083214dd1e774875292b9af4a8091 100644 (file)
@@ -157,7 +157,7 @@ replay:
        return 0;
 }
 
-void cache_release(void)
+void cache_flush(void)
 {
        struct table *table, *next;
 
@@ -165,6 +165,11 @@ void cache_release(void)
                list_del(&table->list);
                table_free(table);
        }
+}
+
+void cache_release(void)
+{
+       cache_flush();
        cache_initialized = false;
 }