summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2015-09-25 12:51:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-10-12 20:34:21 +0200
commit4b3d579c281aa07282531369d43e799d6276dd22 (patch)
tree0f4807036319f3f764e0e245e530d9af9425d754 /src
parent716048ab2128b9af3e348fec3eefefea6f873be2 (diff)
rule: display table when listing one set
After: # nft list set ip6 test foo table ip6 test { set foo { type ipv4_addr } } Before: # nft list set ip6 test foo set foo { type ipv4_addr } Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/rule.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rule.c b/src/rule.c
index 344e3967..502f9e5c 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -1043,6 +1043,13 @@ static int do_list_tables(struct netlink_ctx *ctx, struct cmd *cmd)
return 0;
}
+static void table_print_declaration(struct table *table)
+{
+ printf("table %s %s {\n",
+ family2str(table->handle.family),
+ table->handle.table);
+}
+
static int do_list_chains(struct netlink_ctx *ctx, struct cmd *cmd)
{
struct table *table;
@@ -1053,9 +1060,7 @@ static int do_list_chains(struct netlink_ctx *ctx, struct cmd *cmd)
cmd->handle.family != table->handle.family)
continue;
- printf("table %s %s {\n",
- family2str(table->handle.family),
- table->handle.table);
+ table_print_declaration(table);
list_for_each_entry(chain, &table->chains, list) {
chain_print_declaration(chain);
@@ -1076,7 +1081,10 @@ static int do_list_set(struct netlink_ctx *ctx, struct cmd *cmd,
if (set == NULL)
return -1;
+ table_print_declaration(table);
set_print(set);
+ printf("}\n");
+
return 0;
}