summaryrefslogtreecommitdiffstats
path: root/src/json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-05-09 13:35:37 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-05-09 17:19:50 +0200
commit501d8be41d4e4910e874a1131f7de1521e0252d4 (patch)
treed2f9b2957a27a71f08c192ccf6ded20ed9a27881 /src/json.c
parent590ba3efda281f3df125ede59fa547b30b97a643 (diff)
json: Support nat in inet family
Add the missing bits to JSON parser, printer, man page and testsuite. Fixes: fbe27464dee45 ("src: add nat support for the inet family") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/json.c b/src/json.c
index 4900c023..a8538bdc 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1260,6 +1260,14 @@ json_t *nat_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
json_t *root = json_object();
json_t *array = nat_flags_json(stmt->nat.flags);
+ switch (stmt->nat.family) {
+ case NFPROTO_IPV4:
+ case NFPROTO_IPV6:
+ json_object_set_new(root, "family",
+ json_string(family2str(stmt->nat.family)));
+ break;
+ }
+
if (stmt->nat.addr)
json_object_set_new(root, "addr",
expr_print_json(stmt->nat.addr, octx));