summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_cli.c
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2019-11-08 15:05:23 -0600
committerOle Trøan <otroan@employees.org>2019-11-12 20:37:55 +0000
commit9485d99bd3941b13abf7e47fc7e1d56f7b4fee55 (patch)
treed3f4e90f5cdd5966300d61c89c4bfea81ce5dab9 /src/vnet/interface_cli.c
parent592a909a302262cf4088a5468b8e427f577725e8 (diff)
interface: Allow VLAN tag-rewrite on non-sub-interfaces too.
This fix was first made in commit fdea5c6a00b74971dbb1b7ec4e25839a871006ca but was subsequently lost in commit 053204ab039d34a990ff0e14c32ce3b294fcce0e Added unit test for setting VTR on a non-sub-interface to help ensure no future regressions of this ability. Type: fix Change-Id: I71ce2684fb72383741455829ae2d397ea2e95eae Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/vnet/interface_cli.c')
-rw-r--r--src/vnet/interface_cli.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c
index a66e1576bde..9de674a10fa 100644
--- a/src/vnet/interface_cli.c
+++ b/src/vnet/interface_cli.c
@@ -277,6 +277,7 @@ show_sw_interfaces (vlib_main_t * vm,
u8 show_addresses = 0;
u8 show_features = 0;
u8 show_tag = 0;
+ u8 show_vtr = 0;
int verbose = 0;
/*
@@ -300,6 +301,8 @@ show_sw_interfaces (vlib_main_t * vm,
show_features = 1;
else if (unformat (linput, "tag"))
show_tag = 1;
+ else if (unformat (linput, "vtr"))
+ show_vtr = 1;
else if (unformat (linput, "verbose"))
verbose = 1;
else
@@ -312,7 +315,7 @@ show_sw_interfaces (vlib_main_t * vm,
}
unformat_free (linput);
}
- if (show_features || show_tag)
+ if (show_features || show_tag || show_vtr)
{
if (sw_if_index == ~(u32) 0)
{
@@ -353,6 +356,27 @@ show_sw_interfaces (vlib_main_t * vm,
return 0;
}
+ /*
+ * Show vlan tag rewrite data for one interface.
+ */
+ if (show_vtr)
+ {
+ u32 vtr_op = L2_VTR_DISABLED;
+ u32 push_dot1q = 0, tag1 = 0, tag2 = 0;
+
+ if (l2vtr_get (vm, vnm, sw_if_index,
+ &vtr_op, &push_dot1q, &tag1, &tag2) != 0)
+ {
+ vlib_cli_output (vm, "%U: Problem getting vlan tag-rewrite data",
+ format_vnet_sw_if_index_name, vnm, sw_if_index);
+ return 0;
+ }
+ vlib_cli_output (vm, "%U: VTR %0U",
+ format_vnet_sw_if_index_name, vnm, sw_if_index,
+ format_vtr, vtr_op, push_dot1q, tag1, tag2);
+ return 0;
+ }
+
if (!show_addresses)
vlib_cli_output (vm, "%U\n", format_vnet_sw_interface, vnm, 0);
@@ -474,7 +498,7 @@ done:
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (show_sw_interfaces_command, static) = {
.path = "show interface",
- .short_help = "show interface [address|addr|features|feat] [<interface> [<interface> [..]]] [verbose]",
+ .short_help = "show interface [address|addr|features|feat|vtr] [<interface> [<interface> [..]]] [verbose]",
.function = show_sw_interfaces,
.is_mp_safe = 1,
};