]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser: remove duplicated grammar for chain policy
authorPatrick McHardy <kaber@trash.net>
Tue, 24 Mar 2015 10:59:26 +0000 (10:59 +0000)
committerPatrick McHardy <kaber@trash.net>
Wed, 25 Mar 2015 20:59:39 +0000 (20:59 +0000)
Signed-off-by: Patrick McHardy <kaber@trash.net>
src/parser_bison.y

index ea3ff52698bd75260204fa64fc5e28d3fb7b38d0..b86381d97ef3f8aa522da29b6a03c64f3de8be37 100644 (file)
@@ -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
                        ;