devices: show interface rx-placement displays the wrong information (VPP-894) 72/7372/3
authorSteven <sluong@cisco.com>
Fri, 30 Jun 2017 14:15:02 +0000 (07:15 -0700)
committerDamjan Marion <dmarion.lists@gmail.com>
Sat, 1 Jul 2017 07:02:08 +0000 (07:02 +0000)
commitbafa4d048439fdbcc0bd577e43a2784d1b89bfc5
tree02bf316f3326beb27e837c6447091b78f25911e9
parent85e5b8da28b522ea7a88275f066d127c20eff171
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>
src/vnet/interface_cli.c