fib: fix crash while adding intf-rx routes
[vpp.git] / src / vnet / mpls / mpls.c
index be72d3f..a04e1cf 100644 (file)
@@ -228,7 +228,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
   eos = MPLS_EOS;
   is_del = 0;
   local_label = MPLS_LABEL_INVALID;
-  memset(&pfx, 0, sizeof(pfx));
+  clib_memset(&pfx, 0, sizeof(pfx));
   payload_proto = DPO_PROTO_MPLS;
 
    /* Get a line of input. */
@@ -274,7 +274,7 @@ vnet_mpls_local_label (vlib_main_t * vm,
        ;
       else
       {
-          error = clib_error_return (0, "unkown input: %U",
+          error = clib_error_return (0, "unknown input: %U",
                                      format_unformat_error, line_input);
           goto done;
       }
@@ -312,7 +312,6 @@ vnet_mpls_local_label (vlib_main_t * vm,
   else
   {
       fib_node_index_t fib_index;
-      u32 fi;
 
       if (NULL == rpaths)
       {
@@ -325,24 +324,6 @@ vnet_mpls_local_label (vlib_main_t * vm,
       pfx.fp_label = local_label;
       pfx.fp_payload_proto = rpaths[0].frp_proto;
 
-      /*
-       * the CLI parsing stored table Ids, swap to FIB indicies
-       */
-      if (FIB_NODE_INDEX_INVALID == rpath.frp_sw_if_index)
-      {
-         fi = fib_table_find(dpo_proto_to_fib(pfx.fp_payload_proto),
-                              rpaths[0].frp_fib_index);
-
-         if (~0 == fi)
-         {
-             error = clib_error_return(0 , "%U Via table %d does not exist",
-                                       format_dpo_proto, pfx.fp_payload_proto,
-                                       rpaths[0].frp_fib_index);
-             goto done;
-         }
-         rpaths[0].frp_fib_index = fi;
-      }
-
       fib_index = mpls_fib_index_from_table_id(table_id);
 
       if (FIB_NODE_INDEX_INVALID == fib_index)
@@ -389,7 +370,13 @@ done:
 VLIB_CLI_COMMAND (mpls_local_label_command, static) = {
   .path = "mpls local-label",
   .function = vnet_mpls_local_label,
-  .short_help = "mpls local-label [add|del] <label-value> [eos|non-eos] via [next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight <value>] [preference <value>] [udp-encap-id <value>] [ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] [mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-attached] [rx-ip4 <interface>] [out-labels <value value value>]",
+  .short_help =
+    "mpls local-label [add|del] <label-value> [eos|non-eos] via "
+    "[next-hop-address] [next-hop-interface] [next-hop-table <value>] [weight "
+    "<value>] [preference <value>] [udp-encap-id <value>] "
+    "[ip4-lookup-in-table <value>] [ip6-lookup-in-table <value>] "
+    "[mpls-lookup-in-table <value>] [resolve-via-host] [resolve-via-attached] "
+    "[rx-ip4|rx-ip6 <interface>] [out-labels <value value value>]",
 };
 
 clib_error_t *
@@ -444,8 +431,9 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
     }
 
  done:
-  unformat_free (line_input);
-  return error;
+   vec_free (name);
+   unformat_free (line_input);
+   return error;
 }
 
 /* *INDENT-ON* */
@@ -462,13 +450,6 @@ VLIB_CLI_COMMAND (mpls_table_command, static) = {
   .is_mp_safe = 1,
 };
 
-int
-mpls_fib_reset_labels (u32 fib_id)
-{
-  // FIXME
-  return 0;
-}
-
 static clib_error_t *
 mpls_init (vlib_main_t * vm)
 {