summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datatype.c2
-rw-r--r--src/json.c2
-rw-r--r--src/libnftables.c11
-rw-r--r--src/main.c14
-rw-r--r--src/monitor.c8
5 files changed, 7 insertions, 30 deletions
diff --git a/src/datatype.c b/src/datatype.c
index bfb70a6e..6af1c843 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -196,7 +196,7 @@ void symbolic_constant_print(const struct symbol_table *tbl,
if (quotes)
nft_print(octx, "\"");
- if (octx->numeric > NFT_NUMERIC_ALL)
+ if (nft_output_numeric_symbol(octx))
nft_print(octx, "%" PRIu64 "", val);
else
nft_print(octx, "%s", s->identifier);
diff --git a/src/json.c b/src/json.c
index 8a2bcd65..fc92d464 100644
--- a/src/json.c
+++ b/src/json.c
@@ -812,7 +812,7 @@ static json_t *symbolic_constant_json(const struct symbol_table *tbl,
if (!s->identifier)
return expr_basetype(expr)->json(expr, octx);
- if (octx->numeric > NFT_NUMERIC_ALL)
+ if (nft_output_numeric_symbol(octx))
return json_integer(val);
else
return json_string(s->identifier);
diff --git a/src/libnftables.c b/src/libnftables.c
index 03c15fba..bd79cd60 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -312,17 +312,6 @@ void nft_ctx_set_dry_run(struct nft_ctx *ctx, bool dry)
ctx->check = dry;
}
-enum nft_numeric_level nft_ctx_output_get_numeric(struct nft_ctx *ctx)
-{
- return ctx->output.numeric;
-}
-
-void nft_ctx_output_set_numeric(struct nft_ctx *ctx,
- enum nft_numeric_level level)
-{
- ctx->output.numeric = level;
-}
-
unsigned int nft_ctx_output_get_flags(struct nft_ctx *ctx)
{
return ctx->output.flags;
diff --git a/src/main.c b/src/main.c
index 883261fc..1f01a6c0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
diff --git a/src/monitor.c b/src/monitor.c
index b2267e1f..0e735ed5 100644
--- a/src/monitor.c
+++ b/src/monitor.c
@@ -835,11 +835,9 @@ static int netlink_events_newgen_cb(const struct nlmsghdr *nlh, int type,
}
if (genid >= 0) {
nft_mon_print(monh, "# new generation %d", genid);
- if (pid >= 0) {
- nft_mon_print(monh, " by process %d", pid);
- if (!monh->ctx->nft->output.numeric)
- nft_mon_print(monh, " (%s)", name);
- }
+ if (pid >= 0)
+ nft_mon_print(monh, " by process %d (%s)", pid, name);
+
nft_mon_print(monh, "\n");
}