netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 3/6] scanner: queue: move to own scope
Date: Mon,  8 Mar 2021 18:18:34 +0100	[thread overview]
Message-ID: <20210308171837.8542-4-fw@strlen.de> (raw)
In-Reply-To: <20210308171837.8542-1-fw@strlen.de>

allows to remove 3 queue specific keywords from INITIAL scope.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 include/parser.h   |  1 +
 src/parser_bison.y |  5 +++--
 src/scanner.l      | 12 +++++++-----
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/include/parser.h b/include/parser.h
index b2ebd7aa226c..c3a85a4cf4c2 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -30,6 +30,7 @@ enum startcond_type {
 	PARSER_SC_BEGIN,
 	PARSER_SC_EXPR_HASH,
 	PARSER_SC_EXPR_NUMGEN,
+	PARSER_SC_EXPR_QUEUE,
 };
 
 struct mnl_socket;
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 1ac4dbe43c84..423dddfc2c6d 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -863,6 +863,7 @@ opt_newline		:	NEWLINE
 
 close_scope_hash	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_HASH); };
 close_scope_numgen	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_NUMGEN); };
+close_scope_queue	: { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_QUEUE); };
 
 common_block		:	INCLUDE		QUOTED_STRING	stmt_separator
 			{
@@ -3635,8 +3636,8 @@ nf_nat_flag		:	RANDOM		{ $$ = NF_NAT_RANGE_PROTO_RANDOM; }
 			|	PERSISTENT 	{ $$ = NF_NAT_RANGE_PERSISTENT; }
 			;
 
-queue_stmt		:	queue_stmt_alloc
-			|	queue_stmt_alloc	queue_stmt_args
+queue_stmt		:	queue_stmt_alloc	close_scope_queue
+			|	queue_stmt_alloc	queue_stmt_args	close_scope_queue
 			;
 
 queue_stmt_alloc	:	QUEUE
diff --git a/src/scanner.l b/src/scanner.l
index 94225c296a3b..893364b7b9e7 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -198,6 +198,7 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 %option stack
 %s SCANSTATE_EXPR_HASH
 %s SCANSTATE_EXPR_NUMGEN
+%s SCANSTATE_EXPR_QUEUE
 
 %%
 
@@ -346,11 +347,12 @@ addrstring	({macaddr}|{ip4addr}|{ip6addr})
 "queue-threshold"	{ return QUEUE_THRESHOLD; }
 "level"			{ return LEVEL; }
 
-"queue"			{ return QUEUE;}
-"num"			{ return QUEUENUM;}
-"bypass"		{ return BYPASS;}
-"fanout"		{ return FANOUT;}
-
+"queue"			{ scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_QUEUE); return QUEUE;}
+<SCANSTATE_EXPR_QUEUE>{
+	"num"		{ return QUEUENUM;}
+	"bypass"	{ return BYPASS;}
+	"fanout"	{ return FANOUT;}
+}
 "limit"			{ return LIMIT; }
 "rate"			{ return RATE; }
 "burst"			{ return BURST; }
-- 
2.26.2


  parent reply	other threads:[~2021-03-08 17:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08 17:18 [PATCH nft 0/6] scanner rework part 1 Florian Westphal
2021-03-08 17:18 ` [PATCH nft 1/6] scanner: remove unused tokens Florian Westphal
2021-03-08 17:18 ` [PATCH nft 2/6] scanner: introduce start condition stack Florian Westphal
2021-03-08 17:18 ` Florian Westphal [this message]
2021-03-08 17:18 ` [PATCH nft 4/6] scanner: ipsec: move to own scope Florian Westphal
2021-03-08 17:18 ` [PATCH nft 5/6] scanner: rt: " Florian Westphal
2021-03-08 17:18 ` [PATCH nft 6/6] scanner: socket: " Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210308171837.8542-4-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).