diff mbox

[nft,1/4] rule: don't list anonymous sets

Message ID 145190990642.22285.2420592085262978551.stgit@r2d2.cica.es
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero Jan. 4, 2016, 12:18 p.m. UTC
Don't list anonymous sets when listing all sets.

For example, using this ruleset:


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso Jan. 5, 2016, 11:19 a.m. UTC | #1
On Mon, Jan 04, 2016 at 01:18:26PM +0100, Arturo Borrero Gonzalez wrote:
> Don't list anonymous sets when listing all sets.

Applied, thanks Arturo.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

==== 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 <arturo.borrero.glez@gmail.com>
---
 0 files changed

diff --git a/src/rule.c b/src/rule.c
index 5d3cd84..18ff592 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);
 		}