summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-04-18 12:28:25 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-04-18 15:32:54 +0200
commitda24c01b6d94820aee7222aa3c75854ef47bf355 (patch)
tree24dd5da378d9b61f1b20a66f8bc8dc33a5ab787d /src/rule.c
parent84cf34938294e404fd7e9ebe1a630fe868ae22da (diff)
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 <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c13
1 files changed, 13 insertions, 0 deletions
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)