diff options
author | Florian Westphal <fw@strlen.de> | 2021-03-08 18:18:37 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2021-03-11 13:43:34 +0100 |
commit | 281beafa5afad6e4bc0ac18d218f5d76f4973d92 (patch) | |
tree | 186ea234557de601415c5ceb1b81b589fb995260 | |
parent | 8861db1b771a69de91f0d17ea9b70a63b3c9504a (diff) |
scanner: socket: move to own scope
Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r-- | include/parser.h | 1 | ||||
-rw-r--r-- | src/parser_bison.y | 3 | ||||
-rw-r--r-- | src/scanner.l | 10 |
3 files changed, 9 insertions, 5 deletions
diff --git a/include/parser.h b/include/parser.h index 2cdccaf5..fd5006d3 100644 --- a/include/parser.h +++ b/include/parser.h @@ -33,6 +33,7 @@ enum startcond_type { PARSER_SC_EXPR_NUMGEN, PARSER_SC_EXPR_QUEUE, PARSER_SC_EXPR_RT, + PARSER_SC_EXPR_SOCKET, }; struct mnl_socket; diff --git a/src/parser_bison.y b/src/parser_bison.y index 0f4d51ad..2a8ac215 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -866,6 +866,7 @@ 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); }; +close_scope_socket : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_SOCKET); } common_block : INCLUDE QUOTED_STRING stmt_separator { @@ -4798,7 +4799,7 @@ meta_stmt : META meta_key SET stmt_expr } ; -socket_expr : SOCKET socket_key +socket_expr : SOCKET socket_key close_scope_socket { $$ = socket_expr_alloc(&@$, $2); } diff --git a/src/scanner.l b/src/scanner.l index faf180ca..6a909e92 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -201,6 +201,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %s SCANSTATE_EXPR_NUMGEN %s SCANSTATE_EXPR_QUEUE %s SCANSTATE_EXPR_RT +%s SCANSTATE_EXPR_SOCKET %% @@ -274,10 +275,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "ruleset" { return RULESET; } "trace" { return TRACE; } -"socket" { return SOCKET; } -"transparent" { return TRANSPARENT; } -"wildcard" { return WILDCARD; } - +"socket" { scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_SOCKET); return SOCKET; } +<SCANSTATE_EXPR_SOCKET>{ + "transparent" { return TRANSPARENT; } + "wildcard" { return WILDCARD; } +} "tproxy" { return TPROXY; } "accept" { return ACCEPT; } |