The table may contain sets, but they are anonymous. For example, using this ruleset: ==== 8< ==== table arp test_arp { chain test { meta nfproto { ipv4} } } ==== 8< ==== Before this patch: % nft list sets table arp test_arp { } After this patch: % nft list sets <no output> Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@xxxxxxxxx> --- 0 files changed diff --git a/src/rule.c b/src/rule.c index 18ff592..c0e45aa 100644 --- a/src/rule.c +++ b/src/rule.c @@ -1009,12 +1009,24 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd) }; struct table *table; struct set *set; + bool printable_sets = false; list_for_each_entry(table, &table_list, list) { if (cmd->handle.family != NFPROTO_UNSPEC && cmd->handle.family != table->handle.family) continue; + /* if there are no printable sets, don't print empty table */ + list_for_each_entry(set, &table->sets, list) { + if (!set->flags & SET_F_ANONYMOUS) { + printable_sets = true; + break; + } + } + + if (!printable_sets) + continue; + printf("table %s %s {\n", family2str(table->handle.family), table->handle.table); @@ -1027,6 +1039,8 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd) } printf("}\n"); + + printable_sets = false; } return 0; } -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html