summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-05-02 14:50:12 +0200
committerFlorian Westphal <fw@strlen.de>2018-05-02 16:43:38 +0200
commit2cced3146918163c383432fa40488280f3f87371 (patch)
treed60efb1a96f3dbbc5f33eb6bfb4da67755ea2070 /src/parser_bison.y
parenta502ba00e44a03cbce9b5769274e1b604d3f08ad (diff)
meter: enforce presence of a max size
meters are updated dynamically, so we don't know in advance how large this structure can be. Add a 'size' keyword to specifiy an upper limit and update the old syntax to assume a default max value of 65535. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index f546b9ed..ee3600d7 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -2761,10 +2761,20 @@ meter_stmt_alloc : METER identifier '{' meter_key_expr stmt '}'
{
$$ = meter_stmt_alloc(&@$);
$$->meter.name = $2;
+ $$->meter.size = 0xffff;
$$->meter.key = $4;
$$->meter.stmt = $5;
$$->location = @$;
}
+ | METER identifier SIZE NUM '{' meter_key_expr stmt '}'
+ {
+ $$ = meter_stmt_alloc(&@$);
+ $$->meter.name = $2;
+ $$->meter.size = $4;
+ $$->meter.key = $6;
+ $$->meter.stmt = $7;
+ $$->location = @$;
+ }
;
match_stmt : relational_expr