summaryrefslogtreecommitdiffstats
path: root/include/nftables.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-18 11:40:38 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2023-08-24 09:01:45 +0200
commit2034d8c60ed91c36b74e86e0c195eb6f2c27f9fa (patch)
treeed75840f9cca338ed6ebc5e9bd5d7080a83c6396 /include/nftables.h
parent3684a1b69c255d5268dd2b1590c1dc039e48052d (diff)
src: add input flag NFT_CTX_INPUT_JSON to enable JSON parsing
By default, the input is parsed using the nftables grammar. When setting NFT_CTX_OUTPUT_JSON flag, nftables will first try to parse the input as JSON before falling back to the nftables grammar. But NFT_CTX_OUTPUT_JSON flag also turns on JSON for the output. Add a flag NFT_CTX_INPUT_JSON which allows to treat only the input as JSON, but keep the output mode unchanged. Signed-off-by: Thomas Haller <thaller@redhat.com> Reviewed-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/nftables.h')
-rw-r--r--include/nftables.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/nftables.h b/include/nftables.h
index 666a17ae..f073fa95 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -32,6 +32,11 @@ static inline bool nft_input_no_dns(const struct input_ctx *ictx)
return ictx->flags & NFT_CTX_INPUT_NO_DNS;
}
+static inline bool nft_input_json(const struct input_ctx *ictx)
+{
+ return ictx->flags & NFT_CTX_INPUT_JSON;
+}
+
struct output_ctx {
unsigned int flags;
union {