netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] ip: mroute: Add table output to show command
@ 2017-06-14 12:08 Donald Sharp
  2017-06-14 12:53 ` Nikolay Aleksandrov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Donald Sharp @ 2017-06-14 12:08 UTC (permalink / raw)
  To: netdev, stephen

When the user specifies `table all` or `table 0` to
the `ip mroute show` command we dump the entirety of
the known mroute tables.  Without some sort of
divisor to tell us what table we are looking at
the command is useless.

Add `Table: <vrf name>` to the output of 'ip mroute show table 0'

Follow the convention established by 'ip route show table 0'
for when to display

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
---
 ip/ipmroute.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ip/ipmroute.c b/ip/ipmroute.c
index 4d2d758..70f4c4f 100644
--- a/ip/ipmroute.c
+++ b/ip/ipmroute.c
@@ -189,6 +189,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
 		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
 			(int)tv.tv_usec/10000);
 	}
+
+	if (table && (table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
+		fprintf(fp, " Table: %s",
+			rtnl_rttable_n2a(table, b1, sizeof(b1)));
+
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] ip: mroute: Add table output to show command
  2017-06-14 12:08 [PATCH iproute2] ip: mroute: Add table output to show command Donald Sharp
@ 2017-06-14 12:53 ` Nikolay Aleksandrov
  2017-06-14 15:42 ` David Ahern
  2017-06-14 20:32 ` Stephen Hemminger
  2 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2017-06-14 12:53 UTC (permalink / raw)
  To: Donald Sharp, netdev, stephen

On 14/06/17 15:08, Donald Sharp wrote:
> When the user specifies `table all` or `table 0` to
> the `ip mroute show` command we dump the entirety of
> the known mroute tables.  Without some sort of
> divisor to tell us what table we are looking at
> the command is useless.
> 
> Add `Table: <vrf name>` to the output of 'ip mroute show table 0'
> 
> Follow the convention established by 'ip route show table 0'
> for when to display
> 
> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
> ---
>  ip/ipmroute.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/ip/ipmroute.c b/ip/ipmroute.c
> index 4d2d758..70f4c4f 100644
> --- a/ip/ipmroute.c
> +++ b/ip/ipmroute.c
> @@ -189,6 +189,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>  		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
>  			(int)tv.tv_usec/10000);
>  	}
> +
> +	if (table && (table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
> +		fprintf(fp, " Table: %s",
> +			rtnl_rttable_n2a(table, b1, sizeof(b1)));
> +
>  	fprintf(fp, "\n");
>  	fflush(fp);
>  	return 0;
> 

LGTM, thanks!

Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] ip: mroute: Add table output to show command
  2017-06-14 12:08 [PATCH iproute2] ip: mroute: Add table output to show command Donald Sharp
  2017-06-14 12:53 ` Nikolay Aleksandrov
@ 2017-06-14 15:42 ` David Ahern
  2017-06-14 15:44   ` Nikolay Aleksandrov
  2017-06-14 20:32 ` Stephen Hemminger
  2 siblings, 1 reply; 6+ messages in thread
From: David Ahern @ 2017-06-14 15:42 UTC (permalink / raw)
  To: Donald Sharp, netdev, stephen

On 6/14/17 6:08 AM, Donald Sharp wrote:
> diff --git a/ip/ipmroute.c b/ip/ipmroute.c
> index 4d2d758..70f4c4f 100644
> --- a/ip/ipmroute.c
> +++ b/ip/ipmroute.c
> @@ -189,6 +189,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>  		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
>  			(int)tv.tv_usec/10000);
>  	}
> +
> +	if (table && (table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
> +		fprintf(fp, " Table: %s",

I suggest lowercase 'table' to be consistent with ip route output.

> +			rtnl_rttable_n2a(table, b1, sizeof(b1)));
> +
>  	fprintf(fp, "\n");
>  	fflush(fp);
>  	return 0;
> -- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] ip: mroute: Add table output to show command
  2017-06-14 15:42 ` David Ahern
@ 2017-06-14 15:44   ` Nikolay Aleksandrov
  2017-06-14 15:47     ` David Ahern
  0 siblings, 1 reply; 6+ messages in thread
From: Nikolay Aleksandrov @ 2017-06-14 15:44 UTC (permalink / raw)
  To: David Ahern, Donald Sharp, netdev, stephen

On 14/06/17 18:42, David Ahern wrote:
> On 6/14/17 6:08 AM, Donald Sharp wrote:
>> diff --git a/ip/ipmroute.c b/ip/ipmroute.c
>> index 4d2d758..70f4c4f 100644
>> --- a/ip/ipmroute.c
>> +++ b/ip/ipmroute.c
>> @@ -189,6 +189,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>>  		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
>>  			(int)tv.tv_usec/10000);
>>  	}
>> +
>> +	if (table && (table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
>> +		fprintf(fp, " Table: %s",
> 
> I suggest lowercase 'table' to be consistent with ip route output.

This is consistent with the mroute show command, all of its fields start
with upper case.

> 
>> +			rtnl_rttable_n2a(table, b1, sizeof(b1)));
>> +
>>  	fprintf(fp, "\n");
>>  	fflush(fp);
>>  	return 0;
>> -- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] ip: mroute: Add table output to show command
  2017-06-14 15:44   ` Nikolay Aleksandrov
@ 2017-06-14 15:47     ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2017-06-14 15:47 UTC (permalink / raw)
  To: Nikolay Aleksandrov, Donald Sharp, netdev, stephen

On 6/14/17 9:44 AM, Nikolay Aleksandrov wrote:
> On 14/06/17 18:42, David Ahern wrote:
>> On 6/14/17 6:08 AM, Donald Sharp wrote:
>>> diff --git a/ip/ipmroute.c b/ip/ipmroute.c
>>> index 4d2d758..70f4c4f 100644
>>> --- a/ip/ipmroute.c
>>> +++ b/ip/ipmroute.c
>>> @@ -189,6 +189,11 @@ int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
>>>  		fprintf(fp, ", Age %4i.%.2i", (int)tv.tv_sec,
>>>  			(int)tv.tv_usec/10000);
>>>  	}
>>> +
>>> +	if (table && (table != RT_TABLE_MAIN || show_details > 0) && !filter.tb)
>>> +		fprintf(fp, " Table: %s",
>> I suggest lowercase 'table' to be consistent with ip route output.
> This is consistent with the mroute show command, all of its fields start
> with upper case.
> 

ok.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] ip: mroute: Add table output to show command
  2017-06-14 12:08 [PATCH iproute2] ip: mroute: Add table output to show command Donald Sharp
  2017-06-14 12:53 ` Nikolay Aleksandrov
  2017-06-14 15:42 ` David Ahern
@ 2017-06-14 20:32 ` Stephen Hemminger
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2017-06-14 20:32 UTC (permalink / raw)
  To: Donald Sharp; +Cc: netdev

On Wed, 14 Jun 2017 08:08:12 -0400
Donald Sharp <sharpd@cumulusnetworks.com> wrote:

> When the user specifies `table all` or `table 0` to
> the `ip mroute show` command we dump the entirety of
> the known mroute tables.  Without some sort of
> divisor to tell us what table we are looking at
> the command is useless.
> 
> Add `Table: <vrf name>` to the output of 'ip mroute show table 0'
> 
> Follow the convention established by 'ip route show table 0'
> for when to display
> 
> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-14 20:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14 12:08 [PATCH iproute2] ip: mroute: Add table output to show command Donald Sharp
2017-06-14 12:53 ` Nikolay Aleksandrov
2017-06-14 15:42 ` David Ahern
2017-06-14 15:44   ` Nikolay Aleksandrov
2017-06-14 15:47     ` David Ahern
2017-06-14 20:32 ` Stephen Hemminger

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).