From: Arturo Borrero Date: Mon, 4 Jan 2016 12:18:26 +0000 (+0100) Subject: rule: don't list anonymous sets X-Git-Tag: v0.6~160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df5e71ba390dc574c50f0977f741d56cbc137034;p=thirdparty%2Fnftables.git rule: don't list anonymous sets Don't list anonymous sets when listing all sets. For example, using this ruleset: ==== 8< ==== table inet test { set set1 { type ipv4_addr } chain test { tcp dport { 80 } accept } } ==== 8< ==== Before this patch: % nft list sets table inet test { set set0 { type inet_service flags constant } set set1 { type ipv4_addr } } After this patch: % nft list sets table inet test { set set1 { type ipv4_addr } } Fixes: 8f297010 ("rule: `list sets' only displays declaration, not definition") Signed-off-by: Arturo Borrero Gonzalez Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/rule.c b/src/rule.c index 5d3cd841..18ff5920 100644 --- a/src/rule.c +++ b/src/rule.c @@ -1020,6 +1020,8 @@ static int do_list_sets(struct netlink_ctx *ctx, struct cmd *cmd) table->handle.table); list_for_each_entry(set, &table->sets, list) { + if (set->flags & SET_F_ANONYMOUS) + continue; set_print_declaration(set, &opts); printf("%s}%s", opts.tab, opts.nl); }