diff mbox series

[nftables] evaluate: add set to cache once

Message ID 20210614122454.27902-1-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nftables] evaluate: add set to cache once | expand

Commit Message

Pablo Neira Ayuso June 14, 2021, 12:24 p.m. UTC
67d3969a7244 ("evaluate: add set to the cache") re-adds the set into the
cache again.

This bug was hidden behind 5ec5c706d993 ("cache: add hashtable cache for
table") which broken set_evaluate() for anonymous sets.

Phil reported a gcc compilation warning which uncovered this problem.

Reported-by: Phil Sutter <phil@nwl.cc>
Fixes: 67d3969a7244 ("evaluate: add set to the cache")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/evaluate.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Phil Sutter June 14, 2021, 12:41 p.m. UTC | #1
On Mon, Jun 14, 2021 at 02:24:54PM +0200, Pablo Neira Ayuso wrote:
> 67d3969a7244 ("evaluate: add set to the cache") re-adds the set into the
> cache again.
> 
> This bug was hidden behind 5ec5c706d993 ("cache: add hashtable cache for
> table") which broken set_evaluate() for anonymous sets.
> 
> Phil reported a gcc compilation warning which uncovered this problem.
> 
> Reported-by: Phil Sutter <phil@nwl.cc>
> Fixes: 67d3969a7244 ("evaluate: add set to the cache")
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Thanks for the quick fix!

Out of curiosity, did you not use set_is_anonymous() in commit
bbcc5eda7e588 on purpose?

Cheers, Phil
diff mbox series

Patch

diff --git a/src/evaluate.c b/src/evaluate.c
index 5311963a20c5..92cc8994c809 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -3867,9 +3867,6 @@  static int set_evaluate(struct eval_ctx *ctx, struct set *set)
 	}
 	ctx->set = NULL;
 
-	if (set_cache_find(table, set->handle.set.name) == NULL)
-		set_cache_add(set_get(set), table);
-
 	return 0;
 }