From 8dbea7de5db5e84736bfe6d650a36bb01f70226a Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Tue, 24 Mar 2015 10:59:26 +0000 Subject: parser: remove duplicated grammar for chain policy Signed-off-by: Patrick McHardy --- src/parser_bison.y | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/parser_bison.y b/src/parser_bison.y index ea3ff526..b86381d9 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -409,7 +409,7 @@ static void location_update(struct location *loc, struct location *rhs, int n) %destructor { handle_free(&$$); } table_spec tables_spec chain_spec chain_identifier ruleid_spec ruleset_spec %type set_spec set_identifier %destructor { handle_free(&$$); } set_spec set_identifier -%type handle_spec family_spec family_spec_explicit position_spec +%type handle_spec family_spec family_spec_explicit position_spec chain_policy %type table_block_alloc table_block %destructor { close_scope(state); table_free($$); } table_block_alloc @@ -1071,26 +1071,21 @@ hook_spec : TYPE STRING HOOK STRING PRIORITY NUM } ; -policy_spec : POLICY ACCEPT +policy_spec : POLICY chain_policy { if ($0->policy != -1) { erec_queue(error(&@$, "you cannot set chain policy twice"), state->msgs); YYERROR; } - $0->policy = NF_ACCEPT; - } - | POLICY DROP - { - if ($0->policy != -1) { - erec_queue(error(&@$, "you cannot set chain policy twice"), - state->msgs); - YYERROR; - } - $0->policy = NF_DROP; + $0->policy = $2; } ; +chain_policy : ACCEPT { $$ = NF_ACCEPT; } + | DROP { $$ = NF_DROP; } + ; + identifier : STRING ; -- cgit v1.2.3