]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: display table when listing sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 25 Sep 2015 10:43:35 +0000 (12:43 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 12 Oct 2015 18:34:21 +0000 (20:34 +0200)
After this patch:

 # nft list sets ip
 table ip test {
        set pepe {
                type ipv4_addr
        }
 }

Before:

 # nft list sets ip
        set pepe {
                type ipv4_addr
        }

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
src/rule.c

index 1bf0e03e44efef50ed273a300c23601ceb18a498..fa3d4c1181fe1e0fea181d5f819439306e26d23b 100644 (file)
@@ -984,8 +984,18 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd)
        struct set *set;
 
        list_for_each_entry(table, &table_list, list) {
+               if (cmd->handle.family != NFPROTO_UNSPEC &&
+                   cmd->handle.family != table->handle.family)
+                       continue;
+
+               printf("table %s %s {\n",
+                      family2str(table->handle.family),
+                      table->handle.table);
+
                list_for_each_entry(set, &table->sets, list)
                        set_print(set);
+
+               printf("}\n");
        }
        return 0;
 }