X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Finterface.c;h=41e218642f73b98090c5073c17272a10b39c65fb;hb=30d0fd4804cf3526eea155cf600f2d3de2629038;hp=78610ed460bd3911d3abfce662187e06e73e1ca2;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/interface.c b/src/vnet/interface.c index 78610ed460b..41e218642f7 100644 --- a/src/vnet/interface.c +++ b/src/vnet/interface.c @@ -482,6 +482,13 @@ vnet_sw_interface_set_flags_helper (vnet_main_t * vnm, u32 sw_if_index, vnet_device_class_t *dev_class = vnet_get_device_class (vnm, hi->dev_class_index); + if ((flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) && + (si->flags & VNET_SW_INTERFACE_FLAG_ERROR)) + { + error = clib_error_return (0, "Interface in the error state"); + goto done; + } + /* save the si admin up flag */ old_flags = si->flags; @@ -631,15 +638,18 @@ vnet_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index) vnet_sw_interface_t *sw = pool_elt_at_index (im->sw_interfaces, sw_if_index); - /* Make sure the interface is in L3 mode (removed from L2 BD or XConnect) */ + /* Check if the interface has config and is removed from L2 BD or XConnect */ vlib_main_t *vm = vlib_get_main (); l2_input_config_t *config; - config = vec_elt_at_index (l2input_main.configs, sw_if_index); - if (config->xconnect) - set_int_l2_mode (vm, vnm, MODE_L3, config->output_sw_if_index, 0, 0, 0, - 0); - if (config->xconnect || config->bridge) - set_int_l2_mode (vm, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0); + if (sw_if_index < vec_len (l2input_main.configs)) + { + config = vec_elt_at_index (l2input_main.configs, sw_if_index); + if (config->xconnect) + set_int_l2_mode (vm, vnm, MODE_L3, config->output_sw_if_index, 0, 0, + 0, 0); + if (config->xconnect || config->bridge) + set_int_l2_mode (vm, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0); + } /* Bring down interface in case it is up. */ if (sw->flags != 0) @@ -916,6 +926,8 @@ vnet_delete_hw_interface (vnet_main_t * vnm, u32 hw_if_index) hash_unset_mem (im->hw_interface_by_name, hw->name); vec_free (hw->name); + vec_free (hw->input_node_thread_index_by_queue); + vec_free (hw->dq_runtime_index_by_queue); pool_put (im->hw_interfaces, hw); } @@ -1357,10 +1369,11 @@ vnet_link_to_l3_proto (vnet_link_t link) case VNET_LINK_IP6: return (VNET_L3_PACKET_TYPE_IP6); case VNET_LINK_MPLS: - return (VNET_L3_PACKET_TYPE_MPLS_UNICAST); + return (VNET_L3_PACKET_TYPE_MPLS); case VNET_LINK_ARP: return (VNET_L3_PACKET_TYPE_ARP); case VNET_LINK_ETHERNET: + case VNET_LINK_NSH: ASSERT (0); break; }