diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-29 16:03:32 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-10-30 10:29:44 +0100 |
commit | 505794f75f2a342e8f8115eb0f04965979f2b634 (patch) | |
tree | cba6b69cdb44a5708664be33229b7b5d935325f4 /src/main.c | |
parent | 92abc51d3580dc719fdcbca8d36fdcf5a3751be5 (diff) |
src: get rid of nft_ctx_output_{get,set}_numeric()
This patch adds NFT_CTX_OUTPUT_NUMERIC_SYMBOL, which replaces the last
client of the numeric level approach.
This patch updates `-n' option semantics to display all output
numerically.
Note that monitor code was still using the -n option to skip printing
the process name, this patch updates that path too to print it
inconditionally to simplify things.
Given the numeric levels have no more clients after this patch, remove
that code.
Update several tests/shell not to use -nn.
This patch adds NFT_CTX_OUTPUT_NUMERIC_ALL which enables all flags to
provide a fully numerical output.
Acked-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -132,9 +132,7 @@ static void show_help(const char *name) " -i, --interactive Read input from interactive CLI\n" "\n" " -j, --json Format output in JSON\n" -" -n, --numeric When specified once, show network addresses numerically (default behaviour).\n" -" Specify twice to also show Internet services (port numbers) numerically.\n" -" Specify three times to also show protocols, user IDs, and group IDs numerically.\n" +" -n, --numeric Print fully numerical output.\n" " -s, --stateless Omit stateful information of ruleset.\n" " -u, --guid Print UID/GID as defined in /etc/passwd and /etc/group.\n" " -N Translate IP addresses to names.\n" @@ -189,7 +187,6 @@ static const struct { int main(int argc, char * const *argv) { char *buf = NULL, *filename = NULL; - enum nft_numeric_level numeric; unsigned int output_flags = 0; bool interactive = false; unsigned int debug_mask; @@ -229,14 +226,7 @@ int main(int argc, char * const *argv) } break; case OPT_NUMERIC: - numeric = nft_ctx_output_get_numeric(nft); - if (numeric == NFT_NUMERIC_ALL) { - fprintf(stderr, "Too many numeric options " - "used, max. %u\n", - NFT_NUMERIC_ALL); - exit(EXIT_FAILURE); - } - nft_ctx_output_set_numeric(nft, numeric + 1); + output_flags |= NFT_CTX_OUTPUT_NUMERIC_ALL; break; case OPT_STATELESS: output_flags |= NFT_CTX_OUTPUT_STATELESS; |