netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next 7/9] Add support for nexthop objects
Date: Thu, 30 May 2019 11:55:45 -0600	[thread overview]
Message-ID: <dbce798b-a063-be24-a8ad-6fdb3aef8782@gmail.com> (raw)
In-Reply-To: <20190530105229.6951bffa@hermes.lan>

On 5/30/19 11:52 AM, Stephen Hemminger wrote:
> On Wed, 29 May 2019 20:17:44 -0700
> David Ahern <dsahern@kernel.org> wrote:
> 
>> +
>> +static void print_nh_gateway(FILE *fp, const struct nhmsg *nhm,
>> +			      const struct rtattr *rta)
>> +{
>> +	const char *gateway = format_host_rta(nhm->nh_family, rta);
>> +
>> +	if (is_json_context())
>> +		print_string(PRINT_JSON, "gateway", NULL, gateway);
>> +	else {
>> +		fprintf(fp, "via ");
> 
> I was trying to get rid of all use of /fprintf(fp, / since it was
> indication of non-json code and fp is always stdout.
> 
> Maybe
> 	print_string(PRINT_FP, NULL, "via ", NULL);
> 	print_color_string(PRINT_ANY, ifa_family_color(nhm->nh_family),
> 			"gateway", "%s ", format_host_rta(nhm->nh_family, rta));
> 
> 
> 			   
> 

The above is consistent with print_rta_gateway in ip/iproute.c. Since
the only difference between the 2 is the header struct, I will change
print_rta_gateway to take the address family over rtmsg and re-use it
for both paths.

  reply	other threads:[~2019-05-30 17:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30  3:17 [PATCH iproute2-next 0/9] ip: Add support for nexthop objects David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 1/9] libnetlink: Set NLA_F_NESTED in rta_nest David Ahern
2019-05-30 17:43   ` Stephen Hemminger
2019-05-30 17:50     ` David Ahern
2019-05-31  6:35       ` Michal Kubecek
2019-05-30  3:17 ` [PATCH iproute2-next 2/9] lwtunnel: Pass encap and encap_type attributes to lwt_parse_encap David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 3/9] libnetlink: Add helper to add a group via setsockopt David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 4/9] uapi: Import nexthop object API David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 5/9] libnetlink: Add helper to create nexthop dump request David Ahern
2019-05-30 19:56   ` Roopa Prabhu
2019-05-30 19:59     ` David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 6/9] ip route: Export print_rt_flags and print_rta_if David Ahern
2019-05-30  3:17 ` [PATCH iproute2-next 7/9] Add support for nexthop objects David Ahern
2019-05-30 17:45   ` Stephen Hemminger
2019-05-30 17:52     ` David Ahern
2019-05-30 17:45   ` Stephen Hemminger
2019-05-30 17:52     ` David Ahern
2019-05-30 17:52   ` Stephen Hemminger
2019-05-30 17:55     ` David Ahern [this message]
2019-05-30 20:01   ` Roopa Prabhu
2019-05-30  3:17 ` [PATCH iproute2-next 8/9] ip route: Add option to use " David Ahern
2019-05-30 19:59   ` Roopa Prabhu
2019-05-30  3:17 ` [PATCH iproute2-next 9/9] ipmonitor: Add nexthop option to monitor David Ahern

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=dbce798b-a063-be24-a8ad-6fdb3aef8782@gmail.com \
    --to=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).