From 0c6379953ab575b3b71dda4bcd94b940f0f68447 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 27 Oct 2018 11:44:09 +0200 Subject: src: add nft_ctx_output_{get,set}_stateless() to nft_ctx_output_{get,flags}_flags Add NFT_CTX_OUTPUT_STATELESS flag and enable stateless printing from new output flags interface. This patch adds nft_output_save_flags() and nft_output_restore_flags() to temporarily disable stateful printing Signed-off-by: Pablo Neira Ayuso --- include/nftables.h | 6 +++++- include/nftables/libnftables.h | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/nftables.h b/include/nftables.h index 86b44f17..cb36e066 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -18,7 +18,6 @@ struct cookie { struct output_ctx { unsigned int flags; unsigned int numeric; - unsigned int stateless; unsigned int handle; unsigned int echo; unsigned int json; @@ -42,6 +41,11 @@ static inline bool nft_output_service(const struct output_ctx *octx) return octx->flags & NFT_CTX_OUTPUT_SERVICE; } +static inline bool nft_output_stateless(const struct output_ctx *octx) +{ + return octx->flags & NFT_CTX_OUTPUT_STATELESS; +} + struct nft_cache { uint16_t genid; struct list_head list; diff --git a/include/nftables/libnftables.h b/include/nftables/libnftables.h index 321441b0..4f1c1090 100644 --- a/include/nftables/libnftables.h +++ b/include/nftables/libnftables.h @@ -47,6 +47,7 @@ void nft_ctx_set_dry_run(struct nft_ctx *ctx, bool dry); enum { NFT_CTX_OUTPUT_REVERSEDNS = (1 << 0), NFT_CTX_OUTPUT_SERVICE = (1 << 1), + NFT_CTX_OUTPUT_STATELESS = (1 << 2), }; unsigned int nft_ctx_output_get_flags(struct nft_ctx *ctx); @@ -54,8 +55,6 @@ 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); -bool nft_ctx_output_get_stateless(struct nft_ctx *ctx); -void nft_ctx_output_set_stateless(struct nft_ctx *ctx, bool val); unsigned int nft_ctx_output_get_debug(struct nft_ctx *ctx); void nft_ctx_output_set_debug(struct nft_ctx *ctx, unsigned int mask); bool nft_ctx_output_get_handle(struct nft_ctx *ctx); -- cgit v1.2.3