summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2015-03-24 10:59:26 +0000
committerPatrick McHardy <kaber@trash.net>2015-03-25 20:59:39 +0000
commit8dbea7de5db5e84736bfe6d650a36bb01f70226a (patch)
tree32a8af2c3780ebb97b6c19fd3b5919941791d123
parentac987dc5d471a766e0f96676d0a22279304e279a (diff)
parser: remove duplicated grammar for chain policy
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r--src/parser_bison.y19
1 files 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 <handle> set_spec set_identifier
%destructor { handle_free(&$$); } set_spec set_identifier
-%type <val> handle_spec family_spec family_spec_explicit position_spec
+%type <val> handle_spec family_spec family_spec_explicit position_spec chain_policy
%type <table> 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 ($<chain>0->policy != -1) {
erec_queue(error(&@$, "you cannot set chain policy twice"),
state->msgs);
YYERROR;
}
- $<chain>0->policy = NF_ACCEPT;
- }
- | POLICY DROP
- {
- if ($<chain>0->policy != -1) {
- erec_queue(error(&@$, "you cannot set chain policy twice"),
- state->msgs);
- YYERROR;
- }
- $<chain>0->policy = NF_DROP;
+ $<chain>0->policy = $2;
}
;
+chain_policy : ACCEPT { $$ = NF_ACCEPT; }
+ | DROP { $$ = NF_DROP; }
+ ;
+
identifier : STRING
;