diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2018-01-10 00:29:42 +0530 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-03-05 16:39:59 +0100 |
commit | 51d3592d22ea5b0d5e5740a3b3cc4b62a2fabb36 (patch) | |
tree | a24f8a9290d17ccc96b732a5545b7859258ba417 | |
parent | 51a087822e14d29bfbfd87892b792169d78d9863 (diff) |
parser_bison: delete chain via chain handle
This patch allows deletion of chains via unique chain handles which
can be listed with '-a' option and table name and family.
For eg.
nft delete chain [<family>] <table-name> [handle <handle>]
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | src/parser_bison.y | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index 49269b7b..dd0dcc51 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -507,8 +507,8 @@ int nft_lex(void *, void *, void *); %type <cmd> base_cmd add_cmd replace_cmd create_cmd insert_cmd delete_cmd list_cmd reset_cmd flush_cmd rename_cmd export_cmd monitor_cmd describe_cmd import_cmd %destructor { cmd_free($$); } base_cmd add_cmd replace_cmd create_cmd insert_cmd delete_cmd list_cmd reset_cmd flush_cmd rename_cmd export_cmd monitor_cmd describe_cmd import_cmd -%type <handle> table_spec tableid_spec chain_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec -%destructor { handle_free(&$$); } table_spec tableid_spec chain_spec flowtable_spec chain_identifier ruleid_spec handle_spec position_spec rule_position ruleset_spec +%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 set_identifier flowtable_identifier obj_spec obj_identifier %destructor { handle_free(&$$); } set_spec set_identifier obj_spec obj_identifier %type <val> family_spec family_spec_explicit chain_policy prio_spec @@ -1036,6 +1036,10 @@ delete_cmd : TABLE table_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_CHAIN, &$2, &@$, NULL); } + | CHAIN chainid_spec + { + $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_CHAIN, &$2, &@$, NULL); + } | RULE ruleid_spec { $$ = cmd_alloc(CMD_DELETE, CMD_OBJ_RULE, &$2, &@$, NULL); @@ -1830,6 +1834,14 @@ chain_spec : table_spec identifier } ; +chainid_spec : table_spec HANDLE NUM + { + $$ = $1; + $$.handle.location = @$; + $$.handle.id = $3; + } + ; + chain_identifier : identifier { memset(&$$, 0, sizeof($$)); |