Skip to contentSkip to conversation

evaluate: provide a hint on missing dynamic flag

PATCH New Pablo Neira Ayuso 1 participant 1 message Sep 25, 2021 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 evaluate: provide a hint on missing dynamic flag

Provide a hint to users if they forget to set on the dynamic flag, if such set is updated from the packet path.

---
 src/evaluate.c | 5 +++++
 1 file changed, 5 insertions(+)
src/evaluate.c +5 -0
index 8ebc75617b1c..a0c67fb0e213 100644
@@ -3598,6 +3598,11 @@ static int stmt_evaluate_set(struct eval_ctx *ctx, struct stmt *stmt)
 		return expr_error(ctx->msgs, stmt->set.set,
 				  "Expression does not refer to a set");
 
+	if (!(stmt->set.set->set->flags & NFT_SET_EVAL))
+		return expr_error(ctx->msgs, stmt->set.set,
+				  "%s does not allow for dynamic updates, add 'flags dynamic' to your set declaration",
+				  stmt->set.set->set->flags & NFT_SET_MAP ? "map" : "set");
+
 	if (stmt_evaluate_arg(ctx, stmt,
 			      stmt->set.set->set->key->dtype,
 			      stmt->set.set->set->key->len,
Signature · 1 line
2.30.2