ipsec: fix protect update log if nexthop is NULL
[vpp.git] / src / vnet / ipsec / ipsec_tun.c
index 0b6ec0e..1a9a257 100644 (file)
@@ -569,6 +569,9 @@ ipsec_tun_protect_update (u32 sw_if_index,
   ipsec_main_t *im;
   int rv;
 
+  if (NULL == nh)
+    nh = &IP_ADDR_ALL_0;
+
   ITP_DBG2 ("update: %U/%U",
            format_vnet_sw_if_index_name, vnet_get_main (), sw_if_index,
            format_ip_address, nh);
@@ -581,8 +584,6 @@ ipsec_tun_protect_update (u32 sw_if_index,
 
   rv = 0;
   im = &ipsec_main;
-  if (NULL == nh)
-    nh = &IP_ADDR_ALL_0;
   itpi = ipsec_tun_protect_find (sw_if_index, nh);
 
   vec_foreach_index (ii, sas_in)
@@ -925,7 +926,7 @@ const static teib_vft_t ipsec_tun_teib_vft = {
   .nv_deleted = ipsec_tun_teib_entry_deleted,
 };
 
-static void
+void
 ipsec_tun_table_init (ip_address_family_t af, uword table_size, u32 n_buckets)
 {
   ipsec_main_t *im;
@@ -979,56 +980,6 @@ ipsec_tunnel_protect_init (vlib_main_t *vm)
 
 VLIB_INIT_FUNCTION (ipsec_tunnel_protect_init);
 
-static clib_error_t *
-ipsec_config (vlib_main_t * vm, unformat_input_t * input)
-{
-  unformat_input_t sub_input;
-
-  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
-    {
-      if (unformat (input, "ip4 %U", unformat_vlib_cli_sub_input, &sub_input))
-       {
-         uword table_size = ~0;
-         u32 n_buckets = ~0;
-
-         while (unformat_check_input (&sub_input) != UNFORMAT_END_OF_INPUT)
-           {
-             if (unformat (&sub_input, "num-buckets %u", &n_buckets))
-               ;
-             else
-               return clib_error_return (0, "unknown input `%U'",
-                                         format_unformat_error, &sub_input);
-           }
-
-         ipsec_tun_table_init (AF_IP4, table_size, n_buckets);
-       }
-      else if (unformat (input, "ip6 %U", unformat_vlib_cli_sub_input,
-                        &sub_input))
-       {
-         uword table_size = ~0;
-         u32 n_buckets = ~0;
-
-         while (unformat_check_input (&sub_input) != UNFORMAT_END_OF_INPUT)
-           {
-             if (unformat (&sub_input, "num-buckets %u", &n_buckets))
-               ;
-             else
-               return clib_error_return (0, "unknown input `%U'",
-                                         format_unformat_error, &sub_input);
-           }
-
-         ipsec_tun_table_init (AF_IP6, table_size, n_buckets);
-       }
-      else
-       return clib_error_return (0, "unknown input `%U'",
-                                 format_unformat_error, input);
-    }
-
-  return 0;
-}
-
-VLIB_CONFIG_FUNCTION (ipsec_config, "ipsec");
-
 /*
  * fd.io coding-style-patch-verification: ON
  *