src: use start condition with new destroy command
Pablo Neira Ayuso
maintainerPATCH 1/1 src: use start condition with new destroy command
tests/py reports the following problem:
any/ct.t: ERROR: line 116: add rule ip test-ip4 output ct event set new | related | destroy | label: This rule should not have failed. any/ct.t: ERROR: line 117: add rule ip test-ip4 output ct event set new,related,destroy,label: This rule should not have failed. any/ct.t: ERROR: line 118: add rule ip test-ip4 output ct event set new,destroy: This rule should not have failed.
Use start condition and update parser to handle 'destroy' keyword.
Fixes e1dfd5cc4c46 ("src: add support to command "destroy")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- include/parser.h | 1 + src/parser_bison.y | 2 ++ src/scanner.l | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-)
include/parser.h +1 -0
@@ -52,6 +52,7 @@ enum startcond_type {PARSER_SC_TYPE ,PARSER_SC_VLAN ,PARSER_SC_XT , +PARSER_SC_CMD_DESTROY ,PARSER_SC_CMD_EXPORT ,PARSER_SC_CMD_IMPORT , PARSER_SC_CMD_LIST,
src/parser_bison.y +2 -0
@@ -969,6 +969,7 @@ close_scope_comp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_COMP); close_scope_ct : { scanner_pop_start_cond(nft->scanner, PARSER_SC_CT); }; close_scope_counter : { scanner_pop_start_cond(nft->scanner, PARSER_SC_COUNTER); }; close_scope_dccp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_DCCP); }; +close_scope_destroy : { scanner_pop_start_cond(nft->scanner, PARSER_SC_CMD_DESTROY); }; close_scope_dst : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_DST); }; close_scope_dup : { scanner_pop_start_cond(nft->scanner, PARSER_SC_STMT_DUP); }; close_scope_esp : { scanner_pop_start_cond(nft->scanner, PARSER_SC_EXPR_ESP); };
@@ -4912,6 +4913,7 @@ keyword_expr : ETHER close_scope_eth { $$ = symbol_value(&@$, "ether"); } | SNAT close_scope_nat { $$ = symbol_value(&@$, "snat"); } | ECN { $$ = symbol_value(&@$, "ecn"); } | RESET close_scope_reset { $$ = symbol_value(&@$, "reset"); } + | DESTROY close_scope_destroy { $$ = symbol_value(&@$, "destroy"); } | ORIGINAL { $$ = symbol_value(&@$, "original"); } | REPLY { $$ = symbol_value(&@$, "reply"); } | LABEL { $$ = symbol_value(&@$, "label"); }
src/scanner.l +3 -1
@@ -216,6 +216,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) %s SCANSTATE_TYPE %s SCANSTATE_VLAN %s SCANSTATE_XT +%s SCANSTATE_CMD_DESTROY %s SCANSTATE_CMD_EXPORT %s SCANSTATE_CMD_IMPORT %s SCANSTATE_CMD_LIST
@@ -359,7 +360,8 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr}) "import" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_IMPORT); return IMPORT; } "export" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_EXPORT); return EXPORT; } "monitor" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_MONITOR); return MONITOR; } -"destroy" { return DESTROY; } +"destroy" { scanner_push_start_cond(yyscanner, SCANSTATE_CMD_DESTROY); return DESTROY; } + "position" { return POSITION; } "index" { return INDEX; }
Signature · 1 line
2.30.2