summaryrefslogtreecommitdiffstats
path: root/src/parser_bison.y
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2020-07-21 15:00:24 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2020-07-22 11:47:08 +0200
commit49d4fe2170b866b3995e764f8b9c4d65ec2b7898 (patch)
treeb23fe6e517efc73934ff538047c1e6e8a914e29a /src/parser_bison.y
parent5173151863d3f44fa77506b0af25560fe1918c0f (diff)
src: allow for negative value in variable definitions
Extend test to cover for negative value in chain priority definition. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r--src/parser_bison.y10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y
index d2d7694a..f0cca641 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -2157,7 +2157,6 @@ extended_prio_spec : int_num
{
struct prio_spec spec = {0};
- datatype_set($1->sym->expr, &priority_type);
spec.expr = $1;
$$ = spec;
}
@@ -3982,6 +3981,15 @@ set_rhs_expr : concat_rhs_expr
initializer_expr : rhs_expr
| list_rhs_expr
| '{' '}' { $$ = compound_expr_alloc(&@$, EXPR_SET); }
+ | DASH NUM
+ {
+ int32_t num = -$2;
+
+ $$ = constant_expr_alloc(&@$, &integer_type,
+ BYTEORDER_HOST_ENDIAN,
+ sizeof(num) * BITS_PER_BYTE,
+ &num);
+ }
;
counter_config : PACKETS NUM BYTES NUM