Skip to contentSkip to conversation

evaluate: flag fwd and queue statements as terminal

PATCH In review Florian Westphal 2 participants 2 messages Sep 6, 2019 – Sep 7, 2019 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 evaluate: flag fwd and queue statements as terminal

Both queue and fwd statement end evaluation of a rule:

in
... fwd to "eth0" accept
... queue accept

"accept" is redundant and never evaluated in the kernel. Add the missing "TERMINAL" flag so the evaluation step will catch any trailing expressions:

nft add rule filter input queue counter
Error: Statement after terminal statement has no effect

---
 src/evaluate.c | 2 ++
 1 file changed, 2 insertions(+)
src/evaluate.c +2 -0
index b8bcf4866d8d..29fe966008b1 100644
@@ -2963,6 +2963,7 @@ static int stmt_evaluate_fwd(struct eval_ctx *ctx, struct stmt *stmt)
 	default:
 		return stmt_error(ctx, stmt, "unsupported family");
 	}
+	stmt->flags |= STMT_F_TERMINAL;
 	return 0;
 }
 
@@ -2982,6 +2983,7 @@ static int stmt_evaluate_queue(struct eval_ctx *ctx, struct stmt *stmt)
 					  "fanout requires a range to be "
 					  "specified");
 	}
+	stmt->flags |= STMT_F_TERMINAL;
 	return 0;
 }
 
Signature · 1 line
2.21.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Florian Westphal

Both queue and fwd statement end evaluation of a rule:

in
... fwd to "eth0" accept
... queue accept

Quoted 8 lines

"accept" is redundant and never evaluated in the kernel. Add the missing "TERMINAL" flag so the evaluation step will catch any trailing expressions:

nft add rule filter input queue counter
Error: Statement after terminal statement has no effect