From: Pablo Neira Ayuso Date: Fri, 25 Sep 2015 10:43:35 +0000 (+0200) Subject: rule: display table when listing sets X-Git-Tag: v0.6~212 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c62df142dcbc3f4123bf3c677abfbe53ce5d9167;p=thirdparty%2Fnftables.git rule: display table when listing sets 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 Acked-by: Arturo Borrero Gonzalez --- diff --git a/src/rule.c b/src/rule.c index 1bf0e03e..fa3d4c11 100644 --- a/src/rule.c +++ b/src/rule.c @@ -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; }