docs: vnet comment nitfixes
[vpp.git] / src / vnet / ipsec / ipsec_itf.c
index ff06a57..532d5be 100644 (file)
@@ -20,6 +20,7 @@
 #include <vnet/ipsec/ipsec_tun.h>
 #include <vnet/ipsec/ipsec.h>
 #include <vnet/adj/adj_midchain.h>
+#include <vnet/ethernet/mac_address.h>
 
 /* bitmap of Allocated IPSEC_ITF instances */
 static uword *ipsec_itf_instances;
@@ -69,20 +70,11 @@ ipsec_itf_adj_stack (adj_index_t ai, u32 sai)
   if (hw->flags & VNET_HW_INTERFACE_FLAG_LINK_UP)
     {
       const ipsec_sa_t *sa;
+      fib_prefix_t dst;
 
       sa = ipsec_sa_get (sai);
-
-      /* *INDENT-OFF* */
-      const fib_prefix_t dst = {
-        .fp_len = (ipsec_sa_is_set_IS_TUNNEL_V6(sa) ? 128 : 32),
-        .fp_proto = (ipsec_sa_is_set_IS_TUNNEL_V6(sa)?
-                     FIB_PROTOCOL_IP6 :
-                     FIB_PROTOCOL_IP4),
-        .fp_addr = sa->tunnel_dst_addr,
-      };
-      /* *INDENT-ON* */
-
-      adj_midchain_delegate_stack (ai, sa->tx_fib_index, &dst);
+      ip_address_to_fib_prefix (&sa->tunnel.t_dst, &dst);
+      adj_midchain_delegate_stack (ai, sa->tunnel.t_fib_index, &dst);
     }
   else
     adj_midchain_delegate_unstack (ai);
@@ -207,6 +199,7 @@ VNET_HW_INTERFACE_CLASS(ipsec_p2mp_hw_interface_class) = {
   .name = "IPSec",
   .build_rewrite = ipsec_itf_build_rewrite_i,
   .update_adjacency = ipsec_itf_update_adj,
+  .flags = VNET_HW_INTERFACE_CLASS_FLAG_NBMA,
 };
 /* *INDENT-ON* */
 
@@ -312,6 +305,7 @@ ipsec_itf_create (u32 user_instance, tunnel_mode_t mode, u32 * sw_if_indexp)
                                         t_idx);
 
   hi = vnet_get_hw_interface (vnm, hw_if_index);
+  vnet_sw_interface_set_mtu (vnm, hi->sw_if_index, 9000);
 
   vec_validate_init_empty (ipsec_itf_index_by_sw_if_index, hi->sw_if_index,
                           INDEX_INVALID);
@@ -348,6 +342,18 @@ ipsec_itf_delete (u32 sw_if_index)
   return 0;
 }
 
+void
+ipsec_itf_walk (ipsec_itf_walk_cb_t cb, void *ctx)
+{
+  ipsec_itf_t *itf;
+
+  pool_foreach (itf, ipsec_itf_pool)
+    {
+      if (WALK_CONTINUE != cb (itf, ctx))
+       break;
+    }
+}
+
 static clib_error_t *
 ipsec_itf_create_cli (vlib_main_t * vm,
                      unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -467,10 +473,10 @@ ipsec_interface_show (vlib_main_t * vm,
   index_t ii;
 
   /* *INDENT-OFF* */
-  pool_foreach_index (ii, ipsec_itf_pool,
-  ({
+  pool_foreach_index (ii, ipsec_itf_pool)
+   {
     vlib_cli_output (vm, "%U", format_ipsec_itf, ii);
-  }));
+  }
   /* *INDENT-ON* */
 
   return NULL;