From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 5/6] scanner: rt: move to own scope
Date: Mon, 8 Mar 2021 18:18:36 +0100 [thread overview]
Message-ID: <20210308171837.8542-6-fw@strlen.de> (raw)
In-Reply-To: <20210308171837.8542-1-fw@strlen.de>
classid and nexthop can be moved out of INIT scope.
Rest are still needed because tehy are used by other expressions as
well.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/parser.h | 1 +
src/parser_bison.y | 7 ++++---
src/scanner.l | 9 ++++++---
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/include/parser.h b/include/parser.h
index 001698db259b..2cdccaf5fb3d 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -32,6 +32,7 @@ enum startcond_type {
PARSER_SC_EXPR_IPSEC,
PARSER_SC_EXPR_NUMGEN,
PARSER_SC_EXPR_QUEUE,
+ PARSER_SC_EXPR_RT,
};
struct mnl_socket;
diff --git a/src/parser_bison.y b/src/parser_bison.y
index 83d78a23b2ac..0f4d51ad30bc 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -865,6 +865,7 @@ close_scope_hash : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_HASH);
close_scope_ipsec : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_IPSEC); };
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); };
+close_scope_rt : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_RT); };
common_block : INCLUDE QUOTED_STRING stmt_separator
{
@@ -4893,11 +4894,11 @@ nf_key_proto : IP { $$ = NFPROTO_IPV4; }
| IP6 { $$ = NFPROTO_IPV6; }
;
-rt_expr : RT rt_key
+rt_expr : RT rt_key close_scope_rt
{
$$ = rt_expr_alloc(&@$, $2, true);
}
- | RT nf_key_proto rt_key
+ | RT nf_key_proto rt_key close_scope_rt
{
enum nft_rt_keys rtk = $3;
@@ -5391,7 +5392,7 @@ hbh_hdr_field : NEXTHDR { $$ = HBHHDR_NEXTHDR; }
| HDRLENGTH { $$ = HBHHDR_HDRLENGTH; }
;
-rt_hdr_expr : RT rt_hdr_field
+rt_hdr_expr : RT rt_hdr_field close_scope_rt
{
$$ = exthdr_expr_alloc(&@$, &exthdr_rt, $2);
}
diff --git a/src/scanner.l b/src/scanner.l
index cf3d7d52b4c5..faf180ca4701 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -200,6 +200,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
%s SCANSTATE_EXPR_IPSEC
%s SCANSTATE_EXPR_NUMGEN
%s SCANSTATE_EXPR_QUEUE
+%s SCANSTATE_EXPR_RT
%%
@@ -494,7 +495,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"sctp" { return SCTP; }
"vtag" { return VTAG; }
-"rt" { return RT; }
+"rt" { scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_RT); return RT; }
"rt0" { return RT0; }
"rt2" { return RT2; }
"srh" { return RT4; }
@@ -536,8 +537,10 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"oifgroup" { return OIFGROUP; }
"cgroup" { return CGROUP; }
-"classid" { return CLASSID; }
-"nexthop" { return NEXTHOP; }
+<SCANSTATE_EXPR_RT>{
+ "classid" { return CLASSID; }
+ "nexthop" { return NEXTHOP; }
+}
"ct" { return CT; }
"l3proto" { return L3PROTOCOL; }
--
2.26.2
next prev parent reply other threads:[~2021-03-08 17:20 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 ` [PATCH nft 3/6] scanner: queue: move to own scope Florian Westphal
2021-03-08 17:18 ` [PATCH nft 4/6] scanner: ipsec: " Florian Westphal
2021-03-08 17:18 ` Florian Westphal [this message]
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-6-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).