ip: mroute: Add table output to show command
Subsystems (2)
PATCH 1/1 ip: mroute: Add table output to show command
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
--- ip/ipmroute.c | 5 +++++ 1 file changed, 5 insertions(+)
ip/ipmroute.c +5 -0
@@ -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 ;
Signature · 1 line
2.1.4
Quoted 23 lines · Donald Sharp
When the user specifies
table allortable 0to theip mroute showcommand 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 <[email protected]>--- ip/ipmroute.c | 5 +++++ 1 file changed, 5 insertions(+)ip/ipmroute.c +0
-0@@ -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,
ip/ipmroute.c int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) · line 199
Quoted 10 lines
ip/ipmroute.c +5
-0(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!
ip/ipmroute.c int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) · line 194
Quoted 11 lines · Donald Sharp
ip/ipmroute.c +3
-0@@ -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 6 lines
ip/ipmroute.c +2
-0+ rtnl_rttable_n2a(table, b1, sizeof(b1))); +fprintf (fp,"\n" );fflush (fp);return 0 ;
Quoted 14 lines · David Ahern
ip/ipmroute.c int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) · line 194
Quoted 11 lines · Donald Sharp
ip/ipmroute.c +3
-0@@ -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 7 lines
Quoted 7 lines
ip/ipmroute.c +2
-0+ rtnl_rttable_n2a(table, b1, sizeof(b1))); +fprintf (fp,"\n" );fflush (fp);return 0 ;
Quoted 14 lines · Nikolay Aleksandrov
Quoted 13 lines · David Ahern
ip/ipmroute.c int print_mroute(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) · line 194
Quoted 11 lines · Donald Sharp
ip/ipmroute.c +3
-0@@ -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 3 lines
This is consistent with the mroute show command, all of its fields start with upper case.
ok.
Stephen Hemminger
AppliedQuoted 6 lines · On Wed, 14 Jun 2017 08:08:12 -0400 Donald Sharp <[email protected]>…
When the user specifies
table allortable 0to theip mroute showcommand 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.
Quoted 6 lines
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 <[email protected]>
Applied, thanks.