netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH 1/4] rule: don't list anonymous sets
@ 2016-01-04 12:18 Arturo Borrero Gonzalez
  2016-01-04 12:18 ` [nft PATCH 2/4] rule: when listing all sets, don't print empty tables Arturo Borrero Gonzalez
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Arturo Borrero Gonzalez @ 2016-01-04 12:18 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pablo

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 <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);
 		}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-01-05 12:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-04 12:18 [nft PATCH 1/4] rule: don't list anonymous sets Arturo Borrero Gonzalez
2016-01-04 12:18 ` [nft PATCH 2/4] rule: when listing all sets, don't print empty tables Arturo Borrero Gonzalez
2016-01-05 11:19   ` Pablo Neira Ayuso
2016-01-05 11:35   ` Pablo Neira Ayuso
2016-01-05 11:40     ` Pablo Neira Ayuso
2016-01-05 12:10       ` Arturo Borrero Gonzalez
2016-01-04 12:18 ` [nft PATCH 3/4] rule: delete extra space in sets printing Arturo Borrero Gonzalez
2016-01-05 11:28   ` Pablo Neira Ayuso
2016-01-05 11:35     ` Arturo Borrero Gonzalez
2016-01-04 12:18 ` [nft PATCH 4/4] tests/operations: add some listing tests Arturo Borrero Gonzalez
2016-01-05 12:12   ` Arturo Borrero Gonzalez
2016-01-05 11:19 ` [nft PATCH 1/4] rule: don't list anonymous sets Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).