At least isolates 'mrt' and 'group' keywords, the latter is shared with log statement. Signed-off-by: Phil Sutter <phil@xxxxxx> --- include/parser.h | 1 + src/parser_bison.y | 3 ++- src/scanner.l | 10 +++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/parser.h b/include/parser.h index ba955c9160581..16e02a1ffe129 100644 --- a/include/parser.h +++ b/include/parser.h @@ -35,6 +35,7 @@ enum startcond_type { PARSER_SC_COUNTER, PARSER_SC_ETH, PARSER_SC_ICMP, + PARSER_SC_IGMP, PARSER_SC_IP, PARSER_SC_IP6, PARSER_SC_LIMIT, diff --git a/src/parser_bison.y b/src/parser_bison.y index ca5140ade098e..6340bda6cc585 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -936,6 +936,7 @@ 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_icmp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_ICMP); }; +close_scope_igmp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_IGMP); }; close_scope_ipsec : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_IPSEC); }; close_scope_list : { scanner_pop_start_cond(nft->scanner, PARSER_SC_CMD_LIST); }; close_scope_limit : { scanner_pop_start_cond(nft->scanner, PARSER_SC_LIMIT); }; @@ -5395,7 +5396,7 @@ icmp_hdr_field : TYPE { $$ = ICMPHDR_TYPE; } | MTU { $$ = ICMPHDR_MTU; } ; -igmp_hdr_expr : IGMP igmp_hdr_field +igmp_hdr_expr : IGMP igmp_hdr_field close_scope_igmp { $$ = payload_expr_alloc(&@$, &proto_igmp, $2); } diff --git a/src/scanner.l b/src/scanner.l index e8ec352f88698..a584b5fba39b4 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -201,6 +201,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %s SCANSTATE_COUNTER %s SCANSTATE_ETH %s SCANSTATE_ICMP +%s SCANSTATE_IGMP %s SCANSTATE_IP %s SCANSTATE_IP6 %s SCANSTATE_LIMIT @@ -369,11 +370,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "log" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_LOG); return LOG; } "prefix" { return PREFIX; } -"group" { return GROUP; } <SCANSTATE_STMT_LOG>{ "snaplen" { return SNAPLEN; } "queue-threshold" { return QUEUE_THRESHOLD; } "level" { return LEVEL; } + "group" { return GROUP; } } "queue" { scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_QUEUE); return QUEUE;} @@ -508,8 +509,11 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) } "sequence" { return SEQUENCE; } -"igmp" { return IGMP; } -"mrt" { return MRT; } +"igmp" { scanner_push_start_cond(yyscanner, SCANSTATE_IGMP); return IGMP; } +<SCANSTATE_IGMP>{ + "mrt" { return MRT; } + "group" { return GROUP; } +} "ip6" { scanner_push_start_cond(yyscanner, SCANSTATE_IP6); return IP6; } "priority" { return PRIORITY; } -- 2.34.1