From: Andrea Claudi <aclaudi@redhat.com>
To: Davide Caratti <dcaratti@redhat.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2] mptcp: fix JSON output when dumping endpoints by id
Date: Thu, 11 Nov 2021 11:47:12 +0100 [thread overview]
Message-ID: <YYz0sKInYk2mQV81@renaissance-vector> (raw)
In-Reply-To: <474b741a13ba1058dd991c4f68f68b99610dda2b.1636623282.git.dcaratti@redhat.com>
On Thu, Nov 11, 2021 at 10:52:13AM +0100, Davide Caratti wrote:
> 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 <dcaratti@redhat.com>
> ---
> 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;
>
> - return print_mptcp_addr(answer, stdout);
> + new_json_obj(json);
> + ret = print_mptcp_addr(answer, stdout);
> + delete_json_obj();
> + fflush(stdout);
> + return ret;
> }
>
> static int mptcp_addr_flush(int argc, char **argv)
> --
> 2.31.1
Looks good to me.
Acked-by: Andrea Claudi <aclaudi@redhat.com>
prev parent reply other threads:[~2021-11-11 10:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 9:52 [PATCH iproute2] mptcp: fix JSON output when dumping endpoints by id Davide Caratti
2021-11-11 10:47 ` Andrea Claudi [this message]
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=YYz0sKInYk2mQV81@renaissance-vector \
--to=aclaudi@redhat.com \
--cc=dcaratti@redhat.com \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).