summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-09-22 10:49:43 +0000
committerDamjan Marion <dmarion@me.com>2021-09-22 14:32:22 +0000
commite619ada151548b7efc6bec00feea064e9d6cbcaf (patch)
tree0030903454deeb039fce0e591788c3c917b83d31
parentc0d64ace0e1a177113075c57fa29852bd05c4fc3 (diff)
interface: allow an interface's index to be given in 'sh int'
Type: improvement e.g.: DBGvpp# sh int 3 Name Idx State MTU (L3/IP4/IP6/MPLS) Counter Count loop2 3 down 9000/0/0/0 Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Ie296167ab2b1b9576b46f6d4d9fb9546aef3a0da
-rw-r--r--src/vnet/interface_cli.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index 8475225b525..2f231c117db 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -319,6 +319,21 @@ show_sw_interfaces (vlib_main_t * vm,
show_vtr = 1;
else if (unformat (linput, "verbose"))
verbose = 1;
+ else if (unformat (linput, "%d", &sw_if_index))
+ {
+ if (!pool_is_free_index (im->sw_interfaces, sw_if_index))
+ {
+ si = pool_elt_at_index (im->sw_interfaces, sw_if_index);
+ vec_add1 (sorted_sis, si[0]);
+ }
+ else
+ {
+ vec_free (sorted_sis);
+ error = clib_error_return (0, "unknown interface index `%d'",
+ sw_if_index);
+ goto done;
+ }
+ }
else
{
vec_free (sorted_sis);