diff options
authorPhil Sutter <>2019-06-04 19:31:49 +0200
committerPablo Neira Ayuso <>2019-06-06 11:19:08 +0200
commit5c1c6028dbd54dd56e57fb8a18d1e7e61586e8bf (patch)
parent7df42800cf89e994b5179200825592d9b95c5fab (diff)
src: Fix cache_flush() in cache_needs_more() logic
Commit 34a20645d54fa enabled cache updates depending on command causing it. As a side-effect, this disabled measures in cache_flush() preventing a later cache update. Re-establish this by setting cache->cmd in addition to cache->genid after dropping cache entries. While being at it, set cache->cmd in cache_release() as well. This shouldn't be necessary since zeroing cache->genid should suffice for cache_update(), but better be consistent (and future-proof) here. Fixes: eeda228c2d17 ("src: update cache if cmd is more specific") Signed-off-by: Phil Sutter <> Signed-off-by: Pablo Neira Ayuso <>
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rule.c b/src/rule.c
index c87375d5..1e081c8f 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -299,12 +299,15 @@ void cache_flush(struct nft_ctx *nft, enum cmd_ops cmd, struct list_head *msgs)
cache->genid = mnl_genid_get(&ctx);
+ cache->cmd = CMD_LIST;
void cache_release(struct nft_cache *cache)
cache->genid = 0;
+ cache->cmd = CMD_INVALID;
/* internal ID to uniquely identify a set in the batch */