]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_bison: recursive table declaration in deprecated meter statement
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 2 Jul 2024 22:08:01 +0000 (00:08 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 23 Jan 2025 00:35:36 +0000 (01:35 +0100)
commit a70a217079ef83482fc093d8549f8cdeaeaa3cae upstream.

This is allowing for recursive table NAME declarations such as:

 ... table xyz1 table xyz2 { ... }

remove it.

Fixes: 3ed5e31f4a32 ("src: add flow statement")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_bison.y

index 513f2f8379b1173e25410bcdbc912efe9d189707..2b505208e54a8ff299efe52d5ad75be303449ae2 100644 (file)
@@ -4112,10 +4112,11 @@ map_stmt                :       set_stmt_op     set_ref_expr '{' set_elem_expr_stmt     COLON   set_elem_expr_
                        }
                        ;
 
-meter_stmt             :       flow_stmt_legacy_alloc          flow_stmt_opts  '{' meter_key_expr stmt '}'
+meter_stmt             :       flow_stmt_legacy_alloc          TABLE identifier        '{' meter_key_expr stmt '}'
                        {
-                               $1->meter.key  = $4;
-                               $1->meter.stmt = $5;
+                               $1->meter.name = $3;
+                               $1->meter.key  = $5;
+                               $1->meter.stmt = $6;
                                $$->location  = @$;
                                $$ = $1;
                        }
@@ -4128,19 +4129,6 @@ flow_stmt_legacy_alloc   :       FLOW
                        }
                        ;
 
-flow_stmt_opts         :       flow_stmt_opt
-                       {
-                               $<stmt>$        = $<stmt>0;
-                       }
-                       |       flow_stmt_opts          flow_stmt_opt
-                       ;
-
-flow_stmt_opt          :       TABLE                   identifier
-                       {
-                               $<stmt>0->meter.name = $2;
-                       }
-                       ;
-
 meter_stmt_alloc       :       METER   identifier              '{' meter_key_expr stmt '}'
                        {
                                $$ = meter_stmt_alloc(&@$);