From ead6345cb4ab23f3277155a611483edace536a46 Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 25 Mar 2021 10:34:40 +0100 Subject: parser: fix scope closure of COUNTER token It is closed after allocation, which is too early: this stopped 'packets' and 'bytes' from getting parsed correctly. Also add a test case for this. Signed-off-by: Florian Westphal --- src/parser_bison.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index ca64141e..abe11781 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -2692,7 +2692,7 @@ stateful_stmt_list : stateful_stmt } ; -stateful_stmt : counter_stmt +stateful_stmt : counter_stmt close_scope_counter | limit_stmt | quota_stmt | connlimit_stmt @@ -2792,11 +2792,11 @@ connlimit_stmt : CT COUNT NUM close_scope_ct counter_stmt : counter_stmt_alloc | counter_stmt_alloc counter_args -counter_stmt_alloc : COUNTER close_scope_counter +counter_stmt_alloc : COUNTER { $$ = counter_stmt_alloc(&@$); } - | COUNTER NAME stmt_expr close_scope_counter + | COUNTER NAME stmt_expr { $$ = objref_stmt_alloc(&@$); $$->objref.type = NFT_OBJECT_COUNTER; -- cgit v1.2.3