Skip to contentSkip to conversation

netfilter: nft_set_hash: GC reaps elements with conncount for dynamic sets only

PATCH New Pablo Neira Ayuso 1 participant 1 message Apr 1, 2025

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nft_set_hash: GC reaps elements with conncount for dynamic sets only

conncount has its own GC handler which determines when to reap stale elements, this convenient for dynamic sets. However, this also reaps non-dynamic sets with static configurations coming from control plane. Always run connlimit gc handler but honor feedback to reap element if this set is dynamic.

Fixes 290180e2448c ("netfilter: nf_tables: add connlimit support")
---
 net/netfilter/nft_set_hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/netfilter/nft_set_hash.c +2 -1
index 8bfac4185ac7..abb0c8ec6371 100644
@@ -309,7 +309,8 @@ static bool nft_rhash_expr_needs_gc_run(const struct nft_set *set,
 
 	nft_setelem_expr_foreach(expr, elem_expr, size) {
 		if (expr->ops->gc &&
-		    expr->ops->gc(read_pnet(&set->net), expr))
+		    expr->ops->gc(read_pnet(&set->net), expr) &&
+		    set->flags & NFT_SET_EVAL)
 			return true;
 	}
 
Signature · 1 line
2.30.2