From patchwork Mon May 28 16:50:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 921631 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nwl.cc Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40vjZY3D3Wz9rxs for ; Tue, 29 May 2018 02:52:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425492AbeE1QwV (ORCPT ); Mon, 28 May 2018 12:52:21 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:34248 "EHLO orbyte.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1425480AbeE1QwU (ORCPT ); Mon, 28 May 2018 12:52:20 -0400 Received: from localhost ([::1]:49524 helo=tatos) by orbyte.nwl.cc with esmtp (Exim 4.90_1) (envelope-from ) id 1fNLNb-0002QL-1M; Mon, 28 May 2018 18:52:19 +0200 From: Phil Sutter To: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Subject: [nft PATCH v2 02/14] JSON: Use "type" for CT helper object Date: Mon, 28 May 2018 18:50:57 +0200 Message-Id: <20180528165109.15992-3-phil@nwl.cc> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528165109.15992-1-phil@nwl.cc> References: <20180528165109.15992-1-phil@nwl.cc> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Property name "helper" was a bit unclear, "type" is better. Signed-off-by: Phil Sutter --- src/json.c | 2 +- src/parser_json.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/json.c b/src/json.c index e458eb3e4bdd8..1b73b919d5df2 100644 --- a/src/json.c +++ b/src/json.c @@ -275,7 +275,7 @@ static json_t *obj_print_json(struct output_ctx *octx, const struct obj *obj) case NFT_OBJECT_CT_HELPER: type = "ct helper"; tmp = json_pack("{s:s, s:o, s:s}", - "helper", obj->ct_helper.name, "protocol", + "type", obj->ct_helper.name, "protocol", proto_name_json(obj->ct_helper.l4proto), "l3proto", family2str(obj->ct_helper.l3proto)); json_object_update(root, tmp); diff --git a/src/parser_json.c b/src/parser_json.c index f872977f5bcb4..993368f04ea4a 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -2643,14 +2643,14 @@ static struct cmd *json_parse_cmd_add_object(struct json_ctx *ctx, case NFT_OBJECT_CT_HELPER: cmd_obj = CMD_OBJ_CT_HELPER; obj->type = NFT_OBJECT_CT_HELPER; - if (!json_unpack(root, "{s:s}", "helper", &tmp)) { + if (!json_unpack(root, "{s:s}", "type", &tmp)) { int ret; ret = snprintf(obj->ct_helper.name, sizeof(obj->ct_helper.name), "%s", tmp); if (ret < 0 || ret >= (int)sizeof(obj->ct_helper.name)) { - json_error(ctx, "Invalid CT helper name '%s', max length is %zu.", + json_error(ctx, "Invalid CT helper type '%s', max length is %zu.", tmp, sizeof(obj->ct_helper.name)); obj_free(obj); return NULL;