[PATCH iproute2] ip: mroute: Add table output to show command

Subsystems: the rest · Maintainer: Linus Torvalds

STALE3422d

6 messages, 4 authors, 2017-06-14 · open the first message on its own page

[PATCH iproute2] ip: mroute: Add table output to show command

From: Donald Sharp <hidden>
Date: 2017-06-14 12:08:19

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 <redacted>
---
 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

Re: [PATCH iproute2] ip: mroute: Add table output to show command

From: Nikolay Aleksandrov <hidden>
Date: 2017-06-14 12:53:51

On 14/06/17 15:08, Donald Sharp wrote:
quoted hunk
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 <redacted>
---
 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 <redacted>

Re: [PATCH iproute2] ip: mroute: Add table output to show command

From: David Ahern <hidden>
Date: 2017-06-14 15:42:16

On 6/14/17 6:08 AM, Donald Sharp wrote:
quoted hunk
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.
quoted hunk
+			rtnl_rttable_n2a(table, b1, sizeof(b1)));
+
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 

Re: [PATCH iproute2] ip: mroute: Add table output to show command

From: Nikolay Aleksandrov <hidden>
Date: 2017-06-14 15:44:39

On 14/06/17 18:42, David Ahern wrote:
On 6/14/17 6:08 AM, Donald Sharp wrote:
quoted
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.
quoted
+			rtnl_rttable_n2a(table, b1, sizeof(b1)));
+
 	fprintf(fp, "\n");
 	fflush(fp);
 	return 0;
-- 

Re: [PATCH iproute2] ip: mroute: Add table output to show command

From: David Ahern <hidden>
Date: 2017-06-14 15:47:45

On 6/14/17 9:44 AM, Nikolay Aleksandrov wrote:
On 14/06/17 18:42, David Ahern wrote:
quoted
On 6/14/17 6:08 AM, Donald Sharp wrote:
quoted
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.

Re: [PATCH iproute2] ip: mroute: Add table output to show command

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2017-06-14 20:32:46

On Wed, 14 Jun 2017 08:08:12 -0400
Donald Sharp [off-list ref] 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 <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help