diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2018-01-19 00:22:56 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-03-05 17:53:08 +0100 |
commit | 832b2862df471e45142ea2f2a459723b4ad6f4eb (patch) | |
tree | 8fdd0e7bb884567433c0e692cb90a105afbfdc3f /src/parser_bison.y | |
parent | 9807bc39fd89431a6e26205eb1f86b949d505bde (diff) |
src: extend nft to list object handle and delete objects via handle
Print handle attributes in objects when listing via '-a' option and
delete objects via their unique object handles.
For e.g.
nft delete [<object-type>] [<family>] <table-name> [handle <handle>]
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index d4481ad6..e96340d9 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -509,8 +509,8 @@ int nft_lex(void *, void *, void *); %type <handle> table_spec tableid_spec chain_spec chainid_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec %destructor { handle_free(&$$); } table_spec tableid_spec chain_spec chainid_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec -%type <handle> set_spec setid_spec set_identifier flowtable_identifier obj_spec obj_identifier -%destructor { handle_free(&$$); } set_spec setid_spec set_identifier obj_spec obj_identifier +%type <handle> set_spec setid_spec set_identifier flowtable_identifier obj_spec objid_spec obj_identifier +%destructor { handle_free(&$$); } set_spec setid_spec set_identifier obj_spec objid_spec obj_identifier %type <val> family_spec family_spec_explicit chain_policy prio_spec %type <string> dev_spec quota_unit @@ -1068,10 +1068,18 @@ delete_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_COUNTER, &$2, &@$, NULL); } + | COUNTER objid_spec + { + $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_COUNTER, &$2, &@$, NULL); + } | QUOTA obj_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_QUOTA, &$2, &@$, NULL); } + | QUOTA objid_spec + { + $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_QUOTA, &$2, &@$, NULL); + } | CT ct_obj_type obj_spec ct_obj_alloc { $$ = cmd_alloc_obj_ct(CMD_DELETE, $2, &$3, &@$, $4); @@ -1080,6 +1088,10 @@ delete_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_LIMIT, &$2, &@$, NULL); } + | LIMIT objid_spec + { + $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_LIMIT, &$2, &@$, NULL); + } ; list_cmd : TABLE table_spec @@ -1897,6 +1909,14 @@ obj_spec : table_spec identifier } ; +objid_spec : table_spec HANDLE NUM + { + $$ = $1; + $$.handle.location = @$; + $$.handle.id = $3; + } + ; + obj_identifier : identifier { memset(&$$, 0, sizeof($$)); |