MPLS Mcast
[vpp.git] / src / vnet / interface.c
index 78610ed..45417b2 100644 (file)
@@ -631,15 +631,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)
@@ -1357,10 +1360,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;
     }