nat: nat44-ed add session timing out indicator in api
[vpp.git] / src / plugins / srv6-ad / ad.c
index 64bf66d..045ddeb 100644 (file)
@@ -35,6 +35,7 @@ unsigned char def_str[] =
   "Endpoint with dynamic proxy to SR-unaware appliance";
 unsigned char params_str[] = "nh <next-hop> oif <iface-out> iif <iface-in>";
 
+srv6_ad_main_t srv6_ad_main;
 
 /*****************************************/
 /* SRv6 LocalSID instantiation and removal functions */
@@ -104,8 +105,12 @@ srv6_ad_localsid_creation_fn (ip6_sr_localsid_t * localsid)
 
       /* Set interface in promiscuous mode */
       vnet_main_t *vnm = vnet_get_main ();
-      ethernet_set_flags (vnm, ls_mem->sw_if_index_in,
-                         ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
+      vnet_hw_interface_t *hi =
+       vnet_get_sup_hw_interface (vnm, ls_mem->sw_if_index_in);
+      /* Make sure it is main interface */
+      if (hi->sw_if_index == ls_mem->sw_if_index_in)
+       ethernet_set_flags (vnm, hi->hw_if_index,
+                           ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
 
       /* Associate local SID index to this interface (resize vector if needed) */
       if (ls_mem->sw_if_index_in >= vec_len (sm->sw_iface_localsid2))
@@ -195,7 +200,11 @@ srv6_ad_localsid_removal_fn (ip6_sr_localsid_t * localsid)
 
       /* Disable promiscuous mode on the interface */
       vnet_main_t *vnm = vnet_get_main ();
-      ethernet_set_flags (vnm, ls_mem->sw_if_index_in, 0);
+      vnet_hw_interface_t *hi =
+       vnet_get_sup_hw_interface (vnm, ls_mem->sw_if_index_in);
+      /* Make sure it is main interface */
+      if (hi->sw_if_index == ls_mem->sw_if_index_in)
+       ethernet_set_flags (vnm, hi->hw_if_index, 0);
 
       /* Remove local SID index from interface table */
       sm->sw_iface_localsid2[ls_mem->sw_if_index_in] = ~(u32) 0;
@@ -354,7 +363,7 @@ unformat_srv6_ad_localsid (unformat_input_t * input, va_list * args)
 
   /* Allocate and initialize memory block for local SID parameters */
   ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
-  memset (ls_mem, 0, sizeof *ls_mem);
+  clib_memset (ls_mem, 0, sizeof *ls_mem);
   *plugin_mem_p = ls_mem;
 
   /* Set local SID parameters */
@@ -424,6 +433,7 @@ srv6_ad_init (vlib_main_t * vm)
                                      keyword_str,
                                      def_str,
                                      params_str,
+                                     128,
                                      &sm->srv6_ad_dpo_type,
                                      format_srv6_ad_localsid,
                                      unformat_srv6_ad_localsid,
@@ -463,7 +473,7 @@ VLIB_INIT_FUNCTION (srv6_ad_init);
 
 VLIB_PLUGIN_REGISTER () = {
   .version = VPP_BUILD_VER,
-  .description = "Dynamic SRv6 proxy",
+  .description = "Dynamic Segment Routing for IPv6 (SRv6) Proxy",
 };
 /* *INDENT-ON* */