From: David Ahern <dsahern@gmail.com>
To: Julien Fortin <julien@cumulusnetworks.com>, netdev@vger.kernel.org
Cc: roopa@cumulusnetworks.com
Subject: Re: [PATCH iproute2(-next) 1/1] ip: fix ip route show json output for multipath nexthops
Date: Thu, 26 Sep 2019 08:58:42 -0600 [thread overview]
Message-ID: <bdc66f22-9403-c0fb-196a-360f212cd854@gmail.com> (raw)
In-Reply-To: <20190924223256.74017-1-julien@cumulusnetworks.com>
On 9/24/19 4:32 PM, Julien Fortin wrote:
> diff --git a/ip/iproute.c b/ip/iproute.c
> index a4533851..5d5f1551 100644
> --- a/ip/iproute.c
> +++ b/ip/iproute.c
> @@ -649,23 +649,27 @@ static void print_rta_multipath(FILE *fp, const struct rtmsg *r,
> int len = RTA_PAYLOAD(rta);
> int first = 1;
>
> + open_json_array(PRINT_JSON, "nexthops");
> +
> while (len >= sizeof(*nh)) {
> struct rtattr *tb[RTA_MAX + 1];
>
> if (nh->rtnh_len > len)
> break;
>
> + open_json_object(NULL);
> +
> if (!is_json_context()) {
With the fprintf removed in favor of print_string(PRINT_FP), you should
be able to remove this is_json_context() check and remove a level of
indentation for this section.
> if ((r->rtm_flags & RTM_F_CLONED) &&
> r->rtm_type == RTN_MULTICAST) {
> if (first) {
> - fprintf(fp, "Oifs: ");
> + print_string(PRINT_FP, NULL, "Oifs: ", NULL);
> first = 0;
> } else {
> - fprintf(fp, " ");
> + print_string(PRINT_FP, NULL, " ", NULL);
> }
> } else
> - fprintf(fp, "%s\tnexthop ", _SL_);
> + print_string(PRINT_FP, NULL, "%s\tnexthop ", _SL_);
> }
>
> if (nh->rtnh_len > sizeof(*nh)) {
prev parent reply other threads:[~2019-09-26 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 22:32 [PATCH iproute2(-next) 1/1] ip: fix ip route show json output for multipath nexthops Julien Fortin
2019-09-26 14:58 ` David Ahern [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=bdc66f22-9403-c0fb-196a-360f212cd854@gmail.com \
--to=dsahern@gmail.com \
--cc=julien@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=roopa@cumulusnetworks.com \
/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