LISP Source/Dest control plane support, VPP-197
[vpp.git] / vnet / vnet / interface_cli.c
index 7d828f5..f7d42a7 100644 (file)
@@ -45,6 +45,8 @@
 #include <vnet/vnet.h>
 #include <vnet/ip/ip.h>
 #include <vppinfra/bitmap.h>
+#include <vnet/fib/ip4_fib.h>
+#include <vnet/fib/ip6_fib.h>
 
 static int
 compare_interface_names (void *a1, void *a2)
@@ -290,8 +292,8 @@ show_sw_interfaces (vlib_main_t * vm,
          fib_index6 = vec_elt (im6->fib_index_by_sw_if_index,
                                si->sw_if_index);
 
-       fib4 = vec_elt_at_index (im4->fibs, fib_index4);
-       fib6 = vec_elt_at_index (im6->fibs, fib_index6);
+       fib4 = ip4_fib_get (fib_index4);
+       fib6 = ip6_fib_get (fib_index6);
 
        if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED)
          vlib_cli_output
@@ -813,27 +815,17 @@ set_unnumbered (vlib_main_t * vm,
   int is_set = 0;
   int is_del = 0;
 
-  while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
-    {
-
-      if (unformat (input, "%U use %U",
-                   unformat_vnet_sw_interface, vnm, &unnumbered_sw_if_index,
-                   unformat_vnet_sw_interface, vnm,
-                   &inherit_from_sw_if_index))
-       is_set = 1;
-      else if (unformat (input, "del %U",
-                        unformat_vnet_sw_interface,
-                        vnm, &unnumbered_sw_if_index))
-       is_del = 1;
-      else
-       {
-         if (is_set || is_del)
-           break;
-         else
-           return clib_error_return
-             (0, "parse error '%U'", format_unformat_error, input);
-       }
-    }
+  if (unformat (input, "%U use %U",
+               unformat_vnet_sw_interface, vnm, &unnumbered_sw_if_index,
+               unformat_vnet_sw_interface, vnm, &inherit_from_sw_if_index))
+    is_set = 1;
+  else if (unformat (input, "del %U",
+                    unformat_vnet_sw_interface, vnm,
+                    &unnumbered_sw_if_index))
+    is_del = 1;
+  else
+    return clib_error_return (0, "parse error '%U'",
+                             format_unformat_error, input);
 
   si = vnet_get_sw_interface (vnm, unnumbered_sw_if_index);
   if (is_del)
@@ -841,7 +833,7 @@ set_unnumbered (vlib_main_t * vm,
       si->flags &= ~(VNET_SW_INTERFACE_FLAG_UNNUMBERED);
       si->unnumbered_sw_if_index = (u32) ~ 0;
     }
-  else
+  else if (is_set)
     {
       si->flags |= VNET_SW_INTERFACE_FLAG_UNNUMBERED;
       si->unnumbered_sw_if_index = inherit_from_sw_if_index;
@@ -853,7 +845,7 @@ set_unnumbered (vlib_main_t * vm,
 /* *INDENT-OFF* */
 VLIB_CLI_COMMAND (set_unnumbered_command, static) = {
   .path = "set interface unnumbered",
-  .short_help = "set interface unnumbered [<intfc> use <intfc>][del <intfc>]",
+  .short_help = "set interface unnumbered [<intfc> use <intfc> | del <intfc>]",
   .function = set_unnumbered,
 };
 /* *INDENT-ON* */