Skip to contentSkip to conversation

rule: skip CMD_OBJ_SETELEMS with no elements after set flush

PATCH New Pablo Neira Ayuso 1 participant 1 message Nov 19, 2025 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 rule: skip CMD_OBJ_SETELEMS with no elements after set flush

Set declaration + set flush results in a crash because CMD_OBJ_SETELEMS does not expect no elements. This internal command only shows up if set contains elements, however, evaluation flushes set content after the set expansion. Skip this command CMD_OBJ_SETELEMS if set is empty.

Fixes d3c8051cb767 ("rule: rework CMD_OBJ_SETELEMS logic")
---
 src/rule.c | 3 +++
 1 file changed, 3 insertions(+)
src/rule.c +3 -0
index 05b570cda279..bede68fa1549 100644
@@ -1504,6 +1504,9 @@ static int do_add_setelems(struct netlink_ctx *ctx, struct cmd *cmd,
 {
 	struct set *set = cmd->set;
 
+	if (!set->init)
+		return 0;
+
 	return __do_add_elements(ctx, cmd, set, set->init, flags);
 }
 
Signature · 1 line
2.30.2