From 46763359adc3be45f7202dc0a130718203bfafce Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Mon, 21 Oct 2019 22:49:22 +0100 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- src/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 238c5e0b..ebd6d7c3 100644 --- a/src/main.c +++ b/src/main.c @@ -43,9 +43,10 @@ enum opt_vals { OPT_NUMERIC_PRIO = 'y', OPT_NUMERIC_PROTO = 'p', OPT_NUMERIC_TIME = 'T', + OPT_TERSE = 't', OPT_INVALID = '?', }; -#define OPTSTRING "+hvcf:iI:jvnsNaeSupypT" +#define OPTSTRING "+hvcf:iI:jvnsNaeSupypTt" static const struct option options[] = { { @@ -119,6 +120,10 @@ static const struct option options[] = { .name = "numeric-time", .val = OPT_NUMERIC_TIME, }, + { + .name = "terse", + .val = OPT_TERSE, + }, { .name = NULL } @@ -140,6 +145,7 @@ static void show_help(const char *name) " -j, --json Format output in JSON\n" " -n, --numeric Print fully numerical output.\n" " -s, --stateless Omit stateful information of ruleset.\n" +" -t, --terse Omit contents of sets.\n" " -u, --guid Print UID/GID as defined in /etc/passwd and /etc/group.\n" " -N Translate IP addresses to names.\n" " -S, --service Translate ports to service names as described in /etc/services.\n" @@ -301,6 +307,9 @@ int main(int argc, char * const *argv) case OPT_NUMERIC_TIME: output_flags |= NFT_CTX_OUTPUT_NUMERIC_TIME; break; + case OPT_TERSE: + output_flags |= NFT_CTX_OUTPUT_TERSE; + break; case OPT_INVALID: exit(EXIT_FAILURE); } -- cgit v1.2.3