From nobody Wed Apr 24 11:17:39 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:cbb9:0:0:0:0:0 with SMTP id v25csp313885jap; Thu, 11 Nov 2021 01:37:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJxtTqXWBhbRNZTjrPaY6w66Vn0cgh1ItUAh+Rabrgxtapta0EEK6VMFyr13PIU3fEzG/PJC X-Received: by 2002:a9d:4e89:: with SMTP id v9mr4995333otk.352.1636623446636; Thu, 11 Nov 2021 01:37:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636623446; cv=none; d=google.com; s=arc-20160816; b=c6VnuT/GgBwfP6rvBV7+5Iml2DdLc4b9zvEZb25+g6QE0feVnOEYryo0sY2fqXHY5A SoXhUiUq1mbnq/5tl9XOdRdiHZzl6x9MciejmLquQUl3WUhbL9dRhAyomQMfg7A/ZIgm Y4Qgk2SdEaBnr8ty7XacZdhbz5KYi5J3nKol0unegkThQMqPYMWkCWM/T2vFHaxAglxa USiPmXx5B2bHIGREOCVUhBj2PUmXCVp+i7cPhAngCZ+Z4zS7PKjaiypxgZLKm6n5WOkc MYXhoiBj5K71BDRjf9Obrrok1+vHPwRiVQZ4wd3r0MP29CgJnaOn+YEiAcFHyjlfGs3M KRGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=1J4Hkczg07QVsxkpKTn8eFrg+rb32UJpeCz7ZqKG7hE=; b=GUDn4ZE2JoUVi0HqetxOW5XqMSuQJ7e7oSX12gpfVzi5K74S4dBnJcjJ5CVrm9OEhU VUV164nt0PTqmgHTgeO+TD45Cs8vaP5FIWIBCFvwsmFwQWwu9/u0U7WcMQxDmocgEU9Y ukbH2hCx8hSKzq+UBlZowFe0SENnhPmr1/Yw1j8Oziuq32ulXidnAmTOpdSnlIArJSsv t/sxhkHPMzikUU6r6X/2PIDZNnzlfPs/268cXbG1DaQPb/tuP+09iotkIAs0wRixRUO7 yVoRFAMH86ECt5MhxNLeoSOy5nImW4l7Q80oZ+YdwYgEAXUnpSwdnsDcp5rvswo6gW7Q CSqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=D3Zgu9lp; spf=pass (google.com: domain of mptcp+bounces-2412-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2412-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [2604:1380:1:3600::1]) by mx.google.com with ESMTPS id a26si4500190oto.18.2021.11.11.01.37.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Nov 2021 01:37:26 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-2412-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) client-ip=2604:1380:1:3600::1; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=D3Zgu9lp; spf=pass (google.com: domain of mptcp+bounces-2412-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 2604:1380:1:3600::1 as permitted sender) smtp.mailfrom="mptcp+bounces-2412-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ewr.edge.kernel.org (Postfix) with ESMTPS id 6630D1C0AF4 for ; Thu, 11 Nov 2021 09:37:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6EBB29CA; Thu, 11 Nov 2021 09:37:23 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E0742C81 for ; Thu, 11 Nov 2021 09:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636623440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1J4Hkczg07QVsxkpKTn8eFrg+rb32UJpeCz7ZqKG7hE=; b=D3Zgu9lpJdSbwz6IUU75VL0/dJk9MymNWHFxxfLw/VsiqxpmW0ih1DOUn7na1kt961pcAM kLa/uDyrTMbGA6koNgytioXJac6dB8b01tF/TYRZiumZ70TaURzsuyghN4o+f7uuWYQZs9 3vw4ZC3SjBe6IejS3ZLZvRYTq+qOvbw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-218-hVPPz_AEMvGXHMT5byBylw-1; Thu, 11 Nov 2021 04:37:11 -0500 X-MC-Unique: hVPPz_AEMvGXHMT5byBylw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9D7F10066F3; Thu, 11 Nov 2021 09:36:53 +0000 (UTC) Received: from dcaratti.users.ipa.redhat.com (unknown [10.40.195.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1F4D18A68; Thu, 11 Nov 2021 09:36:47 +0000 (UTC) From: Davide Caratti To: pabeni@redhat.com, aclaudi@redhat.com, Matthieu Baerts , Stephen Hemminger Cc: mptcp@lists.linux.dev, "netdev@vger"@kernel.org Subject: [PATCH iproute2] mptcp: fix JSON output when dumping endpoints by id Date: Thu, 11 Nov 2021 10:35:48 +0100 Message-Id: <474b741a13ba1058dd991c4f68f68b99610dda2b.1636623282.git.dcaratti@redhat.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dcaratti@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" iproute ignores '-j' command line argument when dumping endpoints by id: [dcaratti@dcaratti iproute2]$ ./ip/ip -j mptcp endpoint show [{"address":"1.2.3.4","id":42,"signal":true,"backup":true}] [dcaratti@dcaratti iproute2]$ ./ip/ip -j mptcp endpoint show id 42 1.2.3.4 id 42 signal backup fix mptcp_addr_show() to use the proper JSON helpers. Fixes: 7e0767cd862b ("add support for mptcp netlink interface") Signed-off-by: Davide Caratti --- ip/ipmptcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 0f5b6e2d08ba..857004446aa3 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -305,7 +305,11 @@ static int mptcp_addr_show(int argc, char **argv) if (rtnl_talk(&genl_rth, &req.n, &answer) < 0) return -2; =20 - return print_mptcp_addr(answer, stdout); + new_json_obj(json); + ret =3D print_mptcp_addr(answer, stdout); + delete_json_obj(); + fflush(stdout); + return ret; } =20 static int mptcp_addr_flush(int argc, char **argv) --=20 2.31.1