From d545778d5933ab20c1d9d34a44ae93b2668c60d2 Mon Sep 17 00:00:00 2001 From: Elise Lennion Date: Thu, 26 Jan 2017 15:09:44 -0200 Subject: src: Allow reset single stateful object Currently the stateful objects can only be reseted in groups. With this patch reseting a single object is allowed: $ nft reset counter filter https-traffic table ip filter { counter https-traffic { packets 8774 bytes 542668 } } $ nft list counter filter https-traffic table ip filter { counter https-traffic { packets 0 bytes 0 } } Heavily based on work from Pablo Neira Ayuso . Signed-off-by: Elise Lennion Signed-off-by: Pablo Neira Ayuso --- src/parser_bison.y | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index 4749c9fa..a1b8b088 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -974,6 +974,10 @@ reset_cmd : COUNTERS ruleset_spec { $$ = cmd_alloc(CMD_RESET, CMD_OBJ_COUNTERS, &$3, &@$, NULL); } + | COUNTER obj_spec + { + $$ = cmd_alloc(CMD_RESET, CMD_OBJ_COUNTER, &$2,&@$, NULL); + } | QUOTAS ruleset_spec { $$ = cmd_alloc(CMD_RESET, CMD_OBJ_QUOTAS, &$2, &@$, NULL); @@ -982,6 +986,10 @@ reset_cmd : COUNTERS ruleset_spec { $$ = cmd_alloc(CMD_RESET, CMD_OBJ_QUOTAS, &$3, &@$, NULL); } + | QUOTA obj_spec + { + $$ = cmd_alloc(CMD_RESET, CMD_OBJ_QUOTA, &$2, &@$, NULL); + } ; flush_cmd : TABLE table_spec -- cgit v1.2.3