Article View: linux.kernel.netdev
Article #8658Re: [PATCH iproute2-net] mptcp: limits: fix JSON support
From: Matthieu Baerts
Date: Thu, 29 Oct 2026 17:24
Date: Thu, 29 Oct 2026 17:24
134 lines
15473 bytes
15473 bytes
Hi Stephen,
Thank you for the review!
On 29/10/2026 18:07, Stephen Hemminger wrote:
> On Thu, 29 Oct 2026 14:17:42 +0100
> "Matthieu Baerts (NGI0)" <matttbe@kernel.org> wrote:
>
>> print_mptcp_limit() was trying to open a JSON sub-object and closing it,
>> but no JSON object was actually created before.
>>
>> Because of that, JSON support was working with the MPTCP limits:
>>
>> $ ip -j mptcp limits show
>> add_addr_accepted 0 subflows 2
>>
>> Create a plain object before calling print_mptcp_limit: an array is not
>> needed here because all limits have a different name.
>>
>> After this modification, we now have:
>>
>> $ ip -j mptcp limits show | jq
>> {
>> "add_addr_accepted": 0,
>> "subflows": 2
>> }
>>
>> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>> ---
>
> Should be the regular json_obj variants, not the _plain ones
> here.
Mmh, can I disagree with AI? :)
> The AI response was:
>
> On Thu, 29 Oct 2026 14:17:42 +0100, Matthieu Baerts (NGI0) wrote:
>> print_mptcp_limit() was trying to open a JSON sub-object and closing it,
>> but no JSON object was actually created before.
>
> Right, and that part of the diagnosis is correct -- the open_json_object()
> and close_json_object() calls in print_mptcp_limit() were silent no-ops
> because no writer existed. Thanks for catching it.
>
>> Create a plain object before calling print_mptcp_limit: an array is not
>> needed here because all limits have a different name.
>
> This is where I'd push back. An array isn't needed in the sense that there
> is only ever one object, but it is what every other "ip" subcommand emits,
> including the other three JSON sites in this same file:
>
> ip/ipmptcp.c:317 new_json_obj(json) mptcp_addr_dump()
> ip/ipmptcp.c:345 new_json_obj(json) mptcp_addr_show()
> ip/ipmptcp.c:611 new_json_obj(json) mptcp_monitor()
>
> So after this patch "ip mptcp" is inconsistent with itself:
>
> $ ip -j mptcp endpoint show
> []
> $ ip -j mptcp limits show
> {"add_addr_accepted":0,"subflows":2}
Mmh, yes that's "inconsistent", but that's a different output, for a
different purpose:
- for the first one, we have a list of endpoints: a dictionary with
the same keys. We need an extra object (an array, but that could have
been a dict with the ID as key) here to get the different endpoints.
- for the limits, we have a bunch of key-values. Adding an extra array
doesn't make sense.
> The _plain variant exists for the standalone utilities that have their own
> output conventions -- dcb, devlink, dpll, nstat, ifstat, lnstat, vdpa. It
> is not used anywhere else under ip/, and I'd rather it stayed that way.
>
>> + new_json_obj_plain(json);
>> ret = print_mptcp_limit(answer, stdout);
>> + delete_json_obj_plain();
Each output has its own convention, no?
> Please use the regular pair instead:
>
> new_json_obj(json);
> ret = print_mptcp_limit(answer, stdout);
> delete_json_obj();
>
> which gives
>
> $ ip -j mptcp limits show
> [{"add_addr_accepted":0,"subflows":2}]
> $ ip -j -p mptcp limits show
> [
> {
> "add_addr_accepted": 0,
> "subflows": 2
> }
> ]
Here, we can see the array doesn't make sense. Are there other similar
output in 'ip' adding an extra array just to present one dict?
> No other change is needed: print_mptcp_limit() already calls
> open_json_object(NULL), which is required either way -- under an array it
> creates the element object, under _plain it created the root object. Plain
> text output is unchanged in both versions.
>
> Worth doing now rather than later: JSON output for the limits never worked,
> so nothing can be depending on the current shape yet. I checked the mptcp
> selftests as the likely consumer and they parse text only --
> pm_netlink.sh:71 does
>
> ip -n "${ns1}" mptcp limits | awk '{ print $2" "$4 }'
>
> with no -j or --json use anywhere under selftests/net/mptcp/ (the only jq
> there parses nft output in mptcp_sockopt.sh). So the shape is still free to
> change; once it ships in a release it isn't.
>
> One nit in the commit message while you're respinning:
>
>> Because of that, JSON support was working with the MPTCP limits:
>
> Missing a negation -- "was not working". The example output just below makes
> the intent clear, so this alone wouldn't be worth a v2.
Indeed, I can add the missing "not" if a v2 is needed.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Technical Details
Message-ID:
<48a15033-3e8f-4043-aa2b-eb7440bf3742@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353409-linux-kernel-netdev=dewy.ruReferences:
<20261029-mptcp-limits-json-v1-1-7ac73cdab054@kernel.org> <20261029100741.3cd38216@phoenix.local>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-353409-linux-kernel-netdev=dewy.ru From: matttbe@kernel.org (Matthieu Baerts) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH iproute2-net] mptcp: limits: fix JSON support Date: Thu, 29 Oct 2026 18:24:25 +0100 Organization: Usenet Network Message-ID: <48a15033-3e8f-4043-aa2b-eb7440bf3742@kernel.org> References: <20261029-mptcp-limits-json-v1-1-7ac73cdab054@kernel.org> <20261029100741.3cd38216@phoenix.local> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2059319"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:P48yTsTiDcagiqM7QEXZIA7O17U= sha256:mUV5DidfXWcExAaJY0Eu7QOh+BK+Fl3MNhbbulLE5Yg= sha1:8vunoYHP1GPprtuO46XNYQvDfqk= sha256:Brask7MEpE0ZMTOa7uDkVk5t/2zGvaWljZiBaKRnsUg= Content-Language: fr List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 38A20125C6C; Thu, 29 Oct 2026 20:25:53 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jGAliUDtE6dA; Thu, 29 Oct 2026 20:25:46 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353409-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 2028B125C69; Thu, 29 Oct 2026 20:25:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id F402125DBB; Thu, 29 Oct 2026 17:24:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793294669; b=TfobWGxYE8RedfqQREZfYlsLP/Nm5XehxsToUSK6WZ64JzaXnGZfBKB2Dw7R/3xXAcHa /0TGu+qwS05PBioqqrcEdTayMhIFVrNoucSHMRRE59WwW8sylI75txhocbjHgg2mDdt4f 8n7sszYUfQ6oKEOA79TfkCUvlvbGWi8qZvVXN1o+THx2MslMIqBpywGZ7HsipVoQOMYmi mg2v6DReGfKI66k0oYIbGlnb6G5Wu84VaPPR8AMQfenzq3vuV7suQD9i1aiFAc/MZ2gVS tSR9g2J+6pyw2hXfmeEJCaPNQbwYAOUO5o06WHqJKrzdlH4bSdSoi7nL+A+NM5z5IIw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793294669; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:Autocrypt:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=f3BdBNh1o3iZmtSjlSRESQeyO7zMNUxkDS2xwUHCGWQ=; b=1JN45aTTwd/mNrq4fTK/vYirU4mt+jE7YynREpCneTw0MsDOG+Od5JZoI8uqIhUkHkZE vhd7kvSQ5s3KuSqneYRWuaCEf0zYToFecyIEA0GkF9KD/jO59sUCwT6Zn9A9L9l5uhzog 8gU7mfa9YgGTp6bF4oj/zzy14S76cyp2ZX9RqmaCukaHsbuQiuX+wcS5GYbkPqXmMW/O6 05P/Whcw1uTz98y+Hswoyktz6auYhIkkKdJaJnN2onxpc2Kfr9Ij7PE6VfiEwRoDCP2Ze OnxN0V3TS6Sr3Lm5OyZSMzucejjMXvmSH8d3WdbFWKCFHhE0t/0eGTM2w3y0Qv3YReA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bd2LDDSH; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C36E3606A322; Thu, 29 Oct 2026 17:24:29 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bd2LDDSH X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793294669; b=vceiash4wEW9J5KAz12r5sAZdot/rj72gMmpyZN5DxsGHMu3q5ZGJjjFJ88BhYfaBB7o x92tOovlJj00irP6mCtzNb5JonkqXqLoEDm7qTxLR/vBV+OtAXK8qe9/O9jT3YLuRMdxm aO6ttKawvLNL574qKCiofP0oohMWitPOwxgpX1gXQBRxfrE/n3XZTU88b+vUBiEoMK3fI 9S+CSoed7Ozj6GJnC1JSlL9+QT1+pC32PC60oM7eMGk8/y91G5p67HMInGJSN740VJE/v Zlhb7csJeF5abA+U9wk1x00AoVX7lFpdjRmlIVeo3iNjMadHb3no5uEFi890F+agV+Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793294669; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:Autocrypt:Organization: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=f3BdBNh1o3iZmtSjlSRESQeyO7zMNUxkDS2xwUHCGWQ=; b=rFiTC/BBi446K9FqdsVBezu41NV3C0u2WiKb5Y+m1+vjUNadr3qLXHi5HKwKeTDKe4tJ 2Dg4Y5cr4rF7Qn6sQ/ryvBOfU+0Yq3Tl2I+ziq710wuLsvl/AjzTKigOcwZ4VjVPys1rV NT+lnWIOTo5eh2dJEWFa8Efg0z1rs9PN8yoExNRY8VCHWJBSXU9AvwZiKrT0IKKKN+GXe 1QroByv/rBCWRVj0SgvjtxqxvHXs/afNsmjTEartnXbiXHZfru45X8JAGPoxhEc07Enpu E86usUmAaeosQiU1v/fSrKzoXwAtxk5/xLoLfG7jBa+F55UuwUlMW5667dKUMsMoHtw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bd2LDDSH; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A65C606A31A; Thu, 29 Oct 2026 17:24:28 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51DF31F01816; Thu, 29 Oct 2026 17:24:27 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793294668; bh=f3BdBNh1o3iZmtSjlSRESQeyO7zMNUxkDS2xwUHCGWQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=bd2LDDSHr6Y/G0+CwJwadqfz54SDMq6uCYWqUFexGhACZgxfqF5JpvH/IM6Gp4msf Oyzi7gy6P8E0/8s0BaTptsViiP/4WGpe63QvhOPSFHkvuTspVVZ81bYQ0pb7vIBT2c 8CW0N+sRRDpli9x6hGh43fIqfn1HEiRROsI/6tfzZgyK12eW0HQG63z1BZqRnq9xzB sPb2+2YiHaSi54G5GGT0r1kT8GJtI6zYWjsnGYOwPp226QRdCXY0Dy5f7ppIkYZo/X Df0EUcjFzgay5B4YWdDhmGTkinANd6w1MwlPau0XQiy6TFOkWY0aFz4So4Dp9fcCYF 1V5EjIW/58+Ew== X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird Beta X-Cc: David Ahern <dsahern@kernel.org>, netdev@vger.kernel.org, mptcp@lists.linux.dev X-Autocrypt: addr=matttbe@kernel.org; keydata= xsFNBFXj+ekBEADxVr99p2guPcqHFeI/JcFxls6Kibzy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dK3u2RuKErajKBa/YWzuSaKAOkneFxG3LJIv Hl7iqPF+JDCjB5sAEQEAAcLBXwQYAQIACQUCVeP56QIbDAAKCRD2t4JPQmmgc5VnD/9YgbCr HR1FbMbm7td54UrYvZV/i7m3dIQNXK2e+Cbv5PXf19ce3XluaE+wA8D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== X-Organization: NGI0 Core X-In-Reply-To: <20261029100741.3cd38216@phoenix.local>