From 505794f75f2a342e8f8115eb0f04965979f2b634 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Mon, 29 Oct 2018 16:03:32 +0100 Subject: 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 Signed-off-by: Pablo Neira Ayuso --- doc/libnftables.adoc | 39 ++++----------------------------------- doc/nft.txt | 5 +---- 2 files changed, 5 insertions(+), 39 deletions(-) (limited to 'doc') diff --git a/doc/libnftables.adoc b/doc/libnftables.adoc index 78819439..00750678 100644 --- a/doc/libnftables.adoc +++ b/doc/libnftables.adoc @@ -21,10 +21,6 @@ void nft_ctx_set_dry_run(struct nft_ctx* '\*ctx'*, bool* 'dry'*); unsigned int nft_ctx_output_get_flags(struct nft_ctx* '\*ctx'*); void nft_ctx_output_set_flags(struct nft_ctx* '\*ctx'*, unsigned int* 'flags'*); -enum nft_numeric_level nft_ctx_output_get_numeric(struct nft_ctx* '\*ctx'*); -void nft_ctx_output_set_numeric(struct nft_ctx* '\*ctx'*, - enum nft_numeric_level* 'level'*); - unsigned int nft_ctx_output_get_debug(struct nft_ctx* '\*ctx'*); void nft_ctx_output_set_debug(struct nft_ctx* '\*ctx'*, unsigned int* 'mask'*); @@ -125,37 +121,10 @@ NFT_CTX_OUTPUT_NUMERIC_PROTO:: Display layer 4 protocol numerically. NFT_CTX_OUTPUT_NUMERIC_PRIO:: Display base chain priority numerically. - -=== nft_ctx_output_get_numeric() and nft_ctx_output_set_numeric() -These functions allow control over value representation in library output. -For instance, port numbers by default are printed by their name (as listed in '/etc/services' file), if known. -In libnftables, numeric output is leveled, defined as such: - ----- -enum nft_numeric_level { - NFT_NUMERIC_NONE, - NFT_NUMERIC_ADDR, - NFT_NUMERIC_PORT, - NFT_NUMERIC_ALL, -}; ----- - -Each numeric level includes all previous ones: - -NFT_NUMERIC_NONE:: - No conversion into numeric format happens, this is the default. -NFT_NUMERIC_ADDR:: - Network addresses are always converted into numeric format. -NFT_NUMERIC_PORT:: - Network services are always converted into numeric format. -NFT_NUMERIC_ALL:: - Everything is converted into numeric format. - -The default numeric level is *NFT_NUMERIC_NONE*. - -The *nft_ctx_output_get_numeric*() function returns the numeric output setting's value contained in 'ctx'. - -The *nft_ctx_output_set_numeric*() function sets the numeric output setting in 'ctx' to the value of 'level'. +NFT_CTX_OUTPUT_NUMERIC_SYMBOL:: + Display expression datatype as numeric value. +NFT_CTX_OUTPUT_NUMERIC_ALL:: + Display all numerically. === nft_ctx_output_get_debug() and nft_ctx_output_set_debug() Libnftables supports separate debugging of different parts of its internals. diff --git a/doc/nft.txt b/doc/nft.txt index 99ac0e33..8e18d908 100644 --- a/doc/nft.txt +++ b/doc/nft.txt @@ -34,10 +34,7 @@ For a full summary of options, run *nft --help*. *-n*:: *--numeric*:: - Show data numerically. When used once (the default behaviour), skip - lookup of addresses to symbolic names. Use twice to also show Internet - services (port numbers) numerically. Use three times to also show - protocols, UIDs/GIDs and priorities numerically. + Print fully numerical output. *-s*:: *--stateless*:: -- cgit v1.2.3