]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: enable json echo output when reading native syntax
authorJose M. Guisado Gomez <guigom@riseup.net>
Tue, 4 Aug 2020 10:38:46 +0000 (12:38 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 2 Dec 2020 09:45:15 +0000 (10:45 +0100)
commitcb7e02f44d6a6fd1c6001e23cecb3d7534110617
tree7c4f1876a86ca65bed87ecf3cbb826a46794bf00
parent389a0e1edc89a4048a272e569d3349b1d43bc567
src: enable json echo output when reading native syntax

This patch fixes a bug in which nft did not print any output when
specifying --echo and --json and reading nft native syntax.

This patch respects behavior when input is json, in which the output
would be the identical input plus the handles.

Adds a json_echo member inside struct nft_ctx to build and store the json object
containing the json command objects, the object is built using a mock
monitor to reuse monitor json code. This json object is only used when
we are sure we have not read json from input.

[ added json_alloc_echo() to compile without json support --pablo ]

Fixes: https://bugzilla.netfilter.org/show_bug.cgi?id=1446
Signed-off-by: Jose M. Guisado Gomez <guigom@riseup.net>
Tested-by: Eric Garver <eric@garver.life>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/json.h
include/nftables.h
src/json.c
src/monitor.c
src/parser_json.c