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/ct.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ct.c') diff --git a/src/ct.c b/src/ct.c index a1a91f3a..1d50382b 100644 --- a/src/ct.c +++ b/src/ct.c @@ -225,6 +225,7 @@ static const struct datatype ct_label_type = { .size = CT_LABEL_BIT_SIZE, .basetype = &bitmask_type, .print = ct_label_type_print, + .json = ct_label_type_json, .parse = ct_label_type_parse, }; @@ -360,6 +361,7 @@ static const struct expr_ops ct_expr_ops = { .type = EXPR_CT, .name = "ct", .print = ct_expr_print, + .json = ct_expr_json, .cmp = ct_expr_cmp, .clone = ct_expr_clone, .pctx_update = ct_expr_pctx_update, @@ -442,6 +444,7 @@ static const struct stmt_ops ct_stmt_ops = { .type = STMT_CT, .name = "ct", .print = ct_stmt_print, + .json = ct_stmt_json, }; struct stmt *ct_stmt_alloc(const struct location *loc, enum nft_ct_keys key, @@ -467,6 +470,7 @@ static const struct stmt_ops notrack_stmt_ops = { .type = STMT_NOTRACK, .name = "notrack", .print = notrack_stmt_print, + .json = notrack_stmt_json, }; struct stmt *notrack_stmt_alloc(const struct location *loc) -- cgit v1.2.3