netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft 1/2] rule: Introduce helper function cache_flush
@ 2016-12-01 10:50 Anatole Denis
  2016-12-01 10:50 ` [PATCH nft 2/2] evaluate: Update cache on flush ruleset Anatole Denis
  2016-12-01 11:41 ` [PATCH nft 1/2] rule: Introduce helper function cache_flush Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Anatole Denis @ 2016-12-01 10:50 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Anatole Denis

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>
---
 include/rule.h | 1 +
 src/rule.c     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/rule.h b/include/rule.h
index 99e92ee..b9b4a19 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -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 {
diff --git a/src/rule.c b/src/rule.c
index 8c58bfa..8710767 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -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;
 }
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-01 11:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-01 10:50 [PATCH nft 1/2] rule: Introduce helper function cache_flush Anatole Denis
2016-12-01 10:50 ` [PATCH nft 2/2] evaluate: Update cache on flush ruleset Anatole Denis
2016-12-01 11:42   ` Pablo Neira Ayuso
2016-12-01 11:41 ` [PATCH nft 1/2] rule: Introduce helper function cache_flush Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).