From: Phil Sutter Date: Thu, 8 May 2025 14:44:39 +0000 (+0200) Subject: json: Print single synproxy flags as non-array X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=38f99ee84fe6bd029fbc3d1389f42ab82fa9789c;p=thirdparty%2Fnftables.git json: Print single synproxy flags as non-array Signed-off-by: Phil Sutter --- diff --git a/src/json.c b/src/json.c index a8b0abeb..0034c02f 100644 --- a/src/json.c +++ b/src/json.c @@ -1686,10 +1686,14 @@ json_t *synproxy_stmt_json(const struct stmt *stmt, struct output_ctx *octx) if (stmt->synproxy.flags & NF_SYNPROXY_OPT_SACK_PERM) json_array_append_new(flags, json_string("sack-perm")); - if (json_array_size(flags) > 0) + if (json_array_size(flags) > 1) { json_object_set_new(root, "flags", flags); - else + } else { + if (json_array_size(flags)) + json_object_set(root, "flags", + json_array_get(flags, 0)); json_decref(flags); + } if (!json_object_size(root)) { json_decref(root);