aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-01-18 12:44:50 -0500
committerDave Wallace <dwallacelf@gmail.com>2018-01-19 16:46:03 +0000
commit5957a14329ab174e1215a914296cade8de8865e9 (patch)
tree90590a4ea5f91291e9506177468c8e347a138aa4 /src/vnet/ethernet
parent2167355e1657af1991085b880bb0dd0331093f4e (diff)
Sub-Interface deletion not cleanup hash's properly (VPP-1136)
On deleting sub-interfaces, functions vnet_delete_sub_interface() and vnet_delete_hw_interface() are not cleaning up sub-interface related hash tables and memory properly. Change-Id: I17c7c4b2078c062c77bfe48889beb677610035ca Signed-off-by: John Lo <loj@cisco.com> (cherry picked from commit 7f5bec647c9dc743c015d461d040e63a77fd0a08)
Diffstat (limited to 'src/vnet/ethernet')
-rw-r--r--src/vnet/ethernet/interface.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c
index 3e78a49d62b..801c99f824d 100644
--- a/src/vnet/ethernet/interface.c
+++ b/src/vnet/ethernet/interface.c
@@ -737,29 +737,26 @@ int
vnet_delete_sub_interface (u32 sw_if_index)
{
vnet_main_t *vnm = vnet_get_main ();
+ vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
int rv = 0;
if (pool_is_free_index (vnm->interface_main.sw_interfaces, sw_if_index))
return VNET_API_ERROR_INVALID_SW_IF_INDEX;
-
- vnet_interface_main_t *im = &vnm->interface_main;
- vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
-
if (si->type == VNET_SW_INTERFACE_TYPE_SUB ||
si->type == VNET_SW_INTERFACE_TYPE_P2P)
{
- vnet_sw_interface_t *si = vnet_get_sw_interface (vnm, sw_if_index);
+ vnet_interface_main_t *im = &vnm->interface_main;
+ vnet_hw_interface_t *hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
u64 sup_and_sub_key =
((u64) (si->sup_sw_if_index) << 32) | (u64) si->sub.id;
-
- hash_unset_mem (im->sw_if_index_by_sup_and_sub, &sup_and_sub_key);
+ hash_unset_mem_free (&im->sw_if_index_by_sup_and_sub, &sup_and_sub_key);
+ hash_unset (hi->sub_interface_sw_if_index_by_id, si->sub.id);
vnet_delete_sw_interface (vnm, sw_if_index);
}
else
- {
- rv = VNET_API_ERROR_INVALID_SUB_SW_IF_INDEX;
- }
+ rv = VNET_API_ERROR_INVALID_SUB_SW_IF_INDEX;
+
return rv;
}