Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH nft] evaluate: flag fwd and queue statements as terminal
@ 2019-09-06 14:43 Florian Westphal
  2019-09-07  9:18 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2019-09-06 14:43 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

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

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/evaluate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/evaluate.c b/src/evaluate.c
index b8bcf4866d8d..29fe966008b1 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -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;
 }
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH nft] evaluate: flag fwd and queue statements as terminal
  2019-09-06 14:43 [PATCH nft] evaluate: flag fwd and queue statements as terminal Florian Westphal
@ 2019-09-07  9:18 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-09-07  9:18 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Fri, Sep 06, 2019 at 04:43:37PM +0200, Florian Westphal wrote:
> 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
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 14:43 [PATCH nft] evaluate: flag fwd and queue statements as terminal Florian Westphal
2019-09-07  9:18 ` Pablo Neira Ayuso

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org netfilter-devel@archiver.kernel.org
	public-inbox-index netfilter-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox