diff mbox series

[nft,2/4] rule: do not print elements in dynamically populated sets with `-s'

Message ID 20180816000350.12226-2-pablo@netfilter.org
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft,1/4] statement: incorrect spacing in set reference | expand

Commit Message

Pablo Neira Ayuso Aug. 16, 2018, 12:03 a.m. UTC
Ruleset listing with --stateless should not display the content of
sets that are dynamically populated from the packet path.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 src/rule.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/src/rule.c b/src/rule.c
index d11b1d2907f2..fcfcf60cbc7c 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -426,6 +426,11 @@  static void do_set_print(const struct set *set, struct print_fmt_options *opts,
 {
 	set_print_declaration(set, opts, octx);
 
+	if (set->flags & NFT_SET_EVAL && octx->stateless) {
+		nft_print(octx, "%s}%s", opts->tab, opts->nl);
+		return;
+	}
+
 	if (set->init != NULL && set->init->size > 0) {
 		nft_print(octx, "%s%selements = ", opts->tab, opts->tab);
 		expr_print(set->init, octx);