diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-27 23:34:57 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-01-03 14:21:53 +0100 |
commit | b139f738f558d6afb8c8f3e73526f578b059abd6 (patch) | |
tree | 2d1b575ee0058f988b43bb43970ab13162a87da0 /src/parser_bison.y | |
parent | 0eaedf58acad4214dd827515c56b9da26ab9e9e3 (diff) |
src: add stateful object reference expression
This patch adds a new objref statement to refer to existing stateful
objects from rules, eg.
# nft add rule filter input counter name test counter
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 5b829a24..795b0ee2 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -365,6 +365,7 @@ static void location_update(struct location *loc, struct location *rhs, int n) %token LABEL "label" %token COUNTER "counter" +%token NAME "name" %token PACKETS "packets" %token BYTES "bytes" @@ -1623,6 +1624,12 @@ counter_stmt_alloc : COUNTER { $$ = counter_stmt_alloc(&@$); } + | COUNTER NAME stmt_expr + { + $$ = objref_stmt_alloc(&@$); + $$->objref.type = NFT_OBJECT_COUNTER; + $$->objref.expr = $3; + } ; counter_args : counter_arg @@ -1823,6 +1830,12 @@ quota_stmt : QUOTA quota_mode NUM quota_unit quota_used $$->quota.used = $5; $$->quota.flags = $2; } + | QUOTA NAME stmt_expr + { + $$ = objref_stmt_alloc(&@$); + $$->objref.type = NFT_OBJECT_QUOTA; + $$->objref.expr = $3; + } ; limit_mode : OVER { $$ = NFT_LIMIT_F_INV; } |