summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2019-10-21 22:49:22 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2019-10-22 09:39:41 +0200
commit46763359adc3be45f7202dc0a130718203bfafce (patch)
tree08e359a29b53a0fe9a0073aa0be9d0a4a3adbe73 /src/rule.c
parent27c9fc5e879c903e4e9ddefc27b0110bab3a1d87 (diff)
src: add --terse to suppress output of set elements.
Listing an entire ruleset or a table with `nft list` prints the elements of all set definitions within the ruleset or table. Seeing the full set contents is not often necessary especially when requesting to see someone's ruleset for help and support purposes. Add a new option '-t, --terse' options to suppress the output of set contents. Link: https://bugzilla.netfilter.org/show_bug.cgi?id=1374 Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rule.c b/src/rule.c
index 55894cbd..64756bce 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -538,7 +538,8 @@ 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 && nft_output_stateless(octx)) {
+ if ((set->flags & NFT_SET_EVAL && nft_output_stateless(octx)) ||
+ nft_output_terse(octx)) {
nft_print(octx, "%s}%s", opts->tab, opts->nl);
return;
}