From 78f8d8127eac64abb14e1d4a4309b353ba03bdb6 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 8 Jun 2018 17:27:17 +0200 Subject: JSON: Add support for connlimit statement Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/json.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/json.c') diff --git a/src/json.c b/src/json.c index 83d438c6..a871c934 100644 --- a/src/json.c +++ b/src/json.c @@ -1276,6 +1276,16 @@ json_t *verdict_stmt_json(const struct stmt *stmt, struct output_ctx *octx) return expr_print_json(stmt->expr, octx); } +json_t *connlimit_stmt_json(const struct stmt *stmt, struct output_ctx *octx) +{ + json_t *root = json_pack("{s:i}", "val", stmt->connlimit.count); + + if (stmt->connlimit.flags & NFT_CONNLIMIT_F_INV) + json_object_set_new(root, "inv", json_true()); + + return json_pack("{s:o}", "ct count", root); +} + static json_t *table_print_json_full(struct netlink_ctx *ctx, struct table *table) { -- cgit v1.2.3