stats: fix duplicate /if/names entry 92/39092/3
authorSteven Luong <sluong@cisco.com>
Wed, 21 Jun 2023 05:22:45 +0000 (22:22 -0700)
committerOle Tr�an <otroan@employees.org>
Fri, 7 Jul 2023 16:55:31 +0000 (16:55 +0000)
commitff27c9f8ecb08ff0f5b98332975733e8bab125f1
tree343fcf4968bbf31039b2c2b9d09e2d18294375b6
parentbecfab0f178ffd21b79404495806a72e1222257f
stats: fix duplicate /if/names entry

stats entries /if/names are never deleted as it is a vector of the
sw_if_index value. When the interface is deleted and then created again
later, and if the new interface takes a different sw_if_index, we may
end up with duplicate entries for the same interface name. For example,
the following configuration sequence causes problem

create loopback interface
create loopback interface
delete loopback interface intfc loop0
delete loopback interface intfc loop1
create loopback interface

vpp_get_stats dump /if/names
[0]: local0 /if/names
[1]: loop0 /if/names
[2]: loop0 /if/names

The fix is to set the delete /if/names entry to deleted when the interface is deleted.

Type: fix

Change-Id: I7d811b12d56e3cf8c7deffe14736ea0f24814d02
Signed-off-by: Steven Luong <sluong@cisco.com>
src/vnet/interface/stats.c