]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: Fix cache_flush() in cache_needs_more() logic
authorPhil Sutter <phil@nwl.cc>
Tue, 4 Jun 2019 17:31:49 +0000 (19:31 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 6 Jun 2019 09:19:08 +0000 (11:19 +0200)
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 <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/rule.c

index c87375d51cccd78d37d9379f438e65739acc3e7a..1e081c8fe862161d368089094cb5001a34bf6461 100644 (file)
@@ -299,12 +299,15 @@ void cache_flush(struct nft_ctx *nft, enum cmd_ops cmd, struct list_head *msgs)
 
        __cache_flush(&cache->list);
        cache->genid = mnl_genid_get(&ctx);
+       cache->cmd = CMD_LIST;
 }
 
 void cache_release(struct nft_cache *cache)
 {
        __cache_flush(&cache->list);
        cache->genid = 0;
+       cache->cmd = CMD_INVALID;
+
 }
 
 /* internal ID to uniquely identify a set in the batch */