diff options
author | Phil Sutter <phil@nwl.cc> | 2018-06-08 17:27:17 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2018-06-11 11:31:49 +0200 |
commit | 78f8d8127eac64abb14e1d4a4309b353ba03bdb6 (patch) | |
tree | 7adf2aab7ce8d98eb6ebf2bf7bb785d213fe132a /src/json.c | |
parent | e8b5419b94e230d008d6701b66d02434a7cb1152 (diff) |
JSON: Add support for connlimit statement
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.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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) { |