GROUP and PREFIX are used by igmp and nat, so they can't be moved out of INITIAL scope yet. Signed-off-by: Florian Westphal <fw@xxxxxxxxx> --- include/parser.h | 2 ++ src/parser_bison.y | 4 +++- src/scanner.l | 12 ++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/include/parser.h b/include/parser.h index 59eff16eac20..d890ab223c52 100644 --- a/include/parser.h +++ b/include/parser.h @@ -47,6 +47,8 @@ enum startcond_type { PARSER_SC_EXPR_QUEUE, PARSER_SC_EXPR_RT, PARSER_SC_EXPR_SOCKET, + + PARSER_SC_STMT_LOG, }; struct mnl_socket; diff --git a/src/parser_bison.y b/src/parser_bison.y index 805a38ab22ed..98fe4431c4f4 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -879,6 +879,8 @@ close_scope_rt : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_RT); }; close_scope_secmark : { scanner_pop_start_cond(nft->scanner, PARSER_SC_SECMARK); }; close_scope_socket : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_SOCKET); } +close_scope_log : { scanner_pop_start_cond(nft->scanner, PARSER_SC_STMT_LOG); } + common_block : INCLUDE QUOTED_STRING stmt_separator { if (scanner_include_file(nft, scanner, $2, &@$) < 0) { @@ -2695,7 +2697,7 @@ stmt : verdict_stmt | payload_stmt | stateful_stmt | meta_stmt - | log_stmt + | log_stmt close_scope_log | reject_stmt | nat_stmt | tproxy_stmt diff --git a/src/scanner.l b/src/scanner.l index 783436504326..0082b3eeca29 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -214,6 +214,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %s SCANSTATE_EXPR_RT %s SCANSTATE_EXPR_SOCKET +%s SCANSTATE_STMT_LOG + %% "==" { return EQ; } @@ -354,12 +356,14 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "limits" { return LIMITS; } "synproxys" { return SYNPROXYS; } -"log" { return LOG; } +"log" { scanner_push_start_cond(yyscanner, SCANSTATE_STMT_LOG); return LOG; } "prefix" { return PREFIX; } "group" { return GROUP; } -"snaplen" { return SNAPLEN; } -"queue-threshold" { return QUEUE_THRESHOLD; } -"level" { return LEVEL; } +<SCANSTATE_STMT_LOG>{ + "snaplen" { return SNAPLEN; } + "queue-threshold" { return QUEUE_THRESHOLD; } + "level" { return LEVEL; } +} "queue" { scanner_push_start_cond(yyscanner, SCANSTATE_EXPR_QUEUE); return QUEUE;} <SCANSTATE_EXPR_QUEUE>{ -- 2.26.2