From e70354f53e9f6be4a4be31dbc46c5e23291d3587 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 8 May 2018 13:08:37 +0200 Subject: libnftables: Implement JSON output support Although technically there already is support for JSON output via 'nft export json' command, it is hardly useable since it exports all the gory details of nftables VM. Also, libnftables has no control over what is exported since the content comes directly from libnftnl. Instead, implement JSON format support for regular 'nft list' commands. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/payload.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/payload.c') diff --git a/src/payload.c b/src/payload.c index 09665a0e..6517686c 100644 --- a/src/payload.c +++ b/src/payload.c @@ -25,6 +25,7 @@ #include #include #include +#include bool payload_is_known(const struct expr *expr) { @@ -107,6 +108,7 @@ static const struct expr_ops payload_expr_ops = { .type = EXPR_PAYLOAD, .name = "payload", .print = payload_expr_print, + .json = payload_expr_json, .cmp = payload_expr_cmp, .clone = payload_expr_clone, .pctx_update = payload_expr_pctx_update, @@ -191,6 +193,7 @@ static const struct stmt_ops payload_stmt_ops = { .type = STMT_PAYLOAD, .name = "payload", .print = payload_stmt_print, + .json = payload_stmt_json, }; struct stmt *payload_stmt_alloc(const struct location *loc, -- cgit v1.2.3