]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser: allow listing sets in one table
authorFlorian Westphal <fw@strlen.de>
Thu, 4 May 2017 15:51:54 +0000 (17:51 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 4 May 2017 19:08:17 +0000 (21:08 +0200)
currently nft can lists sets:
nft list sets

but unlike e.g. 'quotas' or 'counters' we didn't support restricting it to
a table.  Now its possible to restrict set definition listing to one table:

nft list sets table inet filter

Reported-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c
src/parser_bison.y

index 49c5953ae168783c419e182fb3ebc5338fd99c62..1cfe7675162e0472fe28cc4b62b28cbdb55a9e60 100644 (file)
@@ -3037,6 +3037,7 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
        case CMD_OBJ_COUNTERS:
        case CMD_OBJ_QUOTAS:
        case CMD_OBJ_CT_HELPERS:
+       case CMD_OBJ_SETS:
                if (cmd->handle.table == NULL)
                        return 0;
                if (table_lookup(&cmd->handle) == NULL)
@@ -3044,7 +3045,6 @@ static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
                                         cmd->handle.table);
                return 0;
        case CMD_OBJ_CHAINS:
-       case CMD_OBJ_SETS:
        case CMD_OBJ_RULESET:
        case CMD_OBJ_FLOWTABLES:
        case CMD_OBJ_MAPS:
index 8db887a47d3e5a869220b341cea8b2540c57aca1..6be94a9b873f597d1a3eba6e872e4ebf84b75292 100644 (file)
@@ -1007,6 +1007,10 @@ list_cmd         :       TABLE           table_spec
                        {
                                $$ = cmd_alloc(CMD_LIST, CMD_OBJ_SETS, &$2, &@$, NULL);
                        }
+                       |       SETS            TABLE   table_spec
+                       {
+                               $$ = cmd_alloc(CMD_LIST, CMD_OBJ_SETS, &$3, &@$, NULL);
+                       }
                        |       SET             set_spec
                        {
                                $$ = cmd_alloc(CMD_LIST, CMD_OBJ_SET, &$2, &@$, NULL);