From: Steve Shin Date: Tue, 20 Feb 2018 19:38:34 +0000 (-0800) Subject: Fix reset the vlan flags when main interface is deleted. X-Git-Tag: v18.04-rc1~286 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=8a3e575dfca22500744df76c40de600d8aa61e12;hp=f3ab4896ed13733a22e9637395973fc1808823e1;p=vpp.git Fix reset the vlan flags when main interface is deleted. The dot1q_vlans & dot1ad_vlans should be reset to 0 when main interface is deleted. Otherwise, VPP will crash if the same interface index is reused without attaching the sub interface on it. Change-Id: I484d4a8892ff4241a3a32b22189746193d5f2594 Signed-off-by: Steve Shin --- diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c index 801c99f824d..091ca2977ee 100644 --- a/src/vnet/ethernet/interface.c +++ b/src/vnet/ethernet/interface.c @@ -344,6 +344,7 @@ ethernet_delete_interface (vnet_main_t * vnm, u32 hw_if_index) } } pool_put_index (em->vlan_pool, main_intf->dot1q_vlans); + main_intf->dot1q_vlans = 0; } if (main_intf->dot1ad_vlans) { @@ -356,6 +357,7 @@ ethernet_delete_interface (vnet_main_t * vnm, u32 hw_if_index) } } pool_put_index (em->vlan_pool, main_intf->dot1ad_vlans); + main_intf->dot1ad_vlans = 0; } vnet_delete_hw_interface (vnm, hw_if_index);