From da24c01b6d94820aee7222aa3c75854ef47bf355 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 18 Apr 2013 12:28:25 +0200 Subject: rule: allow to list of existing tables You can now specify: nft list tables ip to obtain the list of all existing tables. Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index 7d0887aa..43b683ca 100644 --- a/src/rule.c +++ b/src/rule.c @@ -477,6 +477,19 @@ static int do_command_list(struct netlink_ctx *ctx, struct cmd *cmd) switch (cmd->obj) { case CMD_OBJ_TABLE: + if (!cmd->handle.table) { + /* List all existing tables */ + struct table *table; + + if (netlink_list_tables(ctx, &cmd->handle) < 0) + return -1; + + list_for_each_entry(table, &ctx->list, list) { + printf("table %s\n", table->handle.table); + } + return 0; + } + /* List content of this table */ if (do_list_sets(ctx, table) < 0) return -1; if (netlink_list_chains(ctx, &cmd->handle) < 0) -- cgit v1.2.3