ID needs to remain exposed as its used by ct, icmp, icmp6 and so on. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- include/parser.h | 1 + src/parser_bison.y | 5 +++-- src/scanner.l | 9 ++++++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/parser.h b/include/parser.h index 38039677cd1d..889f9418a864 100644 --- a/include/parser.h +++ b/include/parser.h @@ -33,6 +33,7 @@ enum startcond_type { PARSER_SC_ETH, PARSER_SC_IP, PARSER_SC_IP6, + PARSER_SC_VLAN, PARSER_SC_EXPR_FIB, PARSER_SC_EXPR_HASH, PARSER_SC_EXPR_IPSEC, diff --git a/src/parser_bison.y b/src/parser_bison.y index a22f61c4c99b..a6ce506bf5b5 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -868,6 +868,7 @@ close_scope_fib : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_FIB); } close_scope_hash : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_HASH); }; close_scope_ip : { scanner_pop_start_cond(nft->scanner, PARSER_SC_IP); }; close_scope_ip6 : { scanner_pop_start_cond(nft->scanner, PARSER_SC_IP6); }; +close_scope_vlan : { scanner_pop_start_cond(nft->scanner, PARSER_SC_VLAN); }; 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); }; @@ -4544,7 +4545,7 @@ boolean_expr : boolean_keys keyword_expr : ETHER close_scope_eth { $$ = symbol_value(&@$, "ether"); } | IP close_scope_ip { $$ = symbol_value(&@$, "ip"); } | IP6 close_scope_ip6 { $$ = symbol_value(&@$, "ip6"); } - | VLAN { $$ = symbol_value(&@$, "vlan"); } + | VLAN close_scope_vlan { $$ = symbol_value(&@$, "vlan"); } | ARP close_scope_arp { $$ = symbol_value(&@$, "arp"); } | DNAT { $$ = symbol_value(&@$, "dnat"); } | SNAT { $$ = symbol_value(&@$, "snat"); } @@ -5093,7 +5094,7 @@ eth_hdr_field : SADDR { $$ = ETHHDR_SADDR; } | TYPE { $$ = ETHHDR_TYPE; } ; -vlan_hdr_expr : VLAN vlan_hdr_field +vlan_hdr_expr : VLAN vlan_hdr_field close_scope_vlan { $$ = payload_expr_alloc(&@$, &proto_vlan, $2); } diff --git a/src/scanner.l b/src/scanner.l index 728b2c79b395..b664a794184f 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -201,6 +201,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %s SCANSTATE_ETH %s SCANSTATE_IP %s SCANSTATE_IP6 +%s SCANSTATE_VLAN %s SCANSTATE_EXPR_FIB %s SCANSTATE_EXPR_HASH %s SCANSTATE_EXPR_IPSEC @@ -403,10 +404,12 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "type" { return TYPE; } "typeof" { return TYPEOF; } -"vlan" { return VLAN; } +"vlan" { scanner_push_start_cond(yyscanner, SCANSTATE_VLAN); return VLAN; } "id" { return ID; } -"cfi" { return CFI; } -"pcp" { return PCP; } +<SCANSTATE_VLAN>{ + "cfi" { return CFI; } + "pcp" { return PCP; } +} "arp" { scanner_push_start_cond(yyscanner, SCANSTATE_ARP); return ARP; } <SCANSTATE_ARP>{ -- 2.26.2