Netdev List
 help / color / mirror / Atom feed
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>,
	 David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev,
	 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Subject: [PATCH iproute2-net] mptcp: limits: fix JSON support
Date: Thu, 29 Oct 2026 14:17:42 +0100	[thread overview]
Message-ID: <20261029-mptcp-limits-json-v1-1-7ac73cdab054@kernel.org> (raw)

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>
---
 ip/ipmptcp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c
index 02cf72ce..33906eb8 100644
--- a/ip/ipmptcp.c
+++ b/ip/ipmptcp.c
@@ -446,7 +446,9 @@ static int mptcp_limit_get_set(int argc, char **argv, int cmd)
 
 	ret = 0;
 	if (do_get) {
+		new_json_obj_plain(json);
 		ret = print_mptcp_limit(answer, stdout);
+		delete_json_obj_plain();
 		free(answer);
 	}
 

---
base-commit: d1341d07788e8148ce209107813861321a1fb690
change-id: 20261029-mptcp-limits-json-f60c82b687fa

Best regards,
--  
Matthieu Baerts (NGI0) <matttbe@kernel.org>


             reply	other threads:[~2026-10-29 13:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 13:17 Matthieu Baerts (NGI0) [this message]
2026-10-29 17:07 ` [PATCH iproute2-net] mptcp: limits: fix JSON support Stephen Hemminger
2026-10-29 17:24   ` Matthieu Baerts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261029-mptcp-limits-json-v1-1-7ac73cdab054@kernel.org \
    --to=matttbe@kernel.org \
    --cc=dsahern@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox