diff options
author | Steven <sluong@cisco.com> | 2017-06-30 07:15:02 -0700 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2017-07-06 13:27:25 +0000 |
commit | 9d6d9894b1035eda6163d96c72b9ddbaea096f0e (patch) | |
tree | 65982dd21771d8191ec351a6e8bbcab926e8a154 /src/vnet | |
parent | 475674ee5aa4e130a0ac0caf08ef9d579b8604b7 (diff) |
devices: show interface rx-placement displays the wrong information (VPP-894)
show interface rx-placement somtimes displays the wrong interface names.
This happens when there exists subinterfaces in VPP.
The problem is due to the function show_interface_rx_placement_fn is calling
format_vnet_sw_if_index_name with hw_if_index instead of sw_if_index.
VPP has the concept of sw_if_index and hw_if_index. Each serves a different
purpose. When there is no subinterfaces, both hw_if_index and sw_if_index
may happen to have the same value. But don't count on it. When the API calls
for sw_if_index, we must pass the sw_if_index although the hw_if_index has
the same type which the compiler does not catch. Passing hw_if_index for an
API which requires sw_if_index may have an unpredictable result such as
described in the VPP-894 and sometimes it may even crash if the particular
index does not exist.
Change-Id: I76c4834f79b88a1c20684fcba64f14b2da142d77
Signed-off-by: Steven <sluong@cisco.com>
(cherry picked from commit bafa4d048439fdbcc0bd577e43a2784d1b89bfc5)
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/interface_cli.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index bf2873acbe9..fe7ae38f7cd 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -1339,8 +1339,10 @@ show_interface_rx_placement_fn (vlib_main_t * vm, unformat_input_t * input, vec_foreach (dq, rt->devices_and_queues) { + vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, + dq->hw_if_index); s = format (s, " %U queue %u (%U)\n", - format_vnet_sw_if_index_name, vnm, dq->hw_if_index, + format_vnet_sw_if_index_name, vnm, hi->sw_if_index, dq->queue_id, format_vnet_hw_interface_rx_mode, dq->mode); } |