Distributed Virtual Router Support
[vpp.git] / src / vnet / ip / lookup.c
old mode 100755 (executable)
new mode 100644 (file)
index 667c679..856c494
@@ -165,11 +165,21 @@ ip_interface_address_add_del (ip_lookup_main_t * lm,
     }
   else
     {
+      if (sw_if_index != a->sw_if_index)
+       {
+         if (result_if_address_index)
+           *result_if_address_index = ~0;
+         vnm->api_errno = VNET_API_ERROR_DUPLICATE_IF_ADDRESS;
+         return clib_error_create
+           ("Prefix %U already found on interface %U",
+            lm->format_address_and_length, addr_fib, address_length,
+            format_vnet_sw_if_index_name, vnm, a->sw_if_index);
+       }
+
       if (result_if_address_index)
        *result_if_address_index = a - lm->if_address_pool;
     }
 
-
   return /* no error */ 0;
 }
 
@@ -695,6 +705,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
   unformat_input_t _line_input, *line_input = &_line_input;
   clib_error_t *error = NULL;
   u32 table_id, is_add;
+  u8 *name = NULL;
 
   is_add = 1;
   table_id = ~0;
@@ -711,6 +722,8 @@ vnet_ip_table_cmd (vlib_main_t * vm,
        is_add = 0;
       else if (unformat (line_input, "add"))
        is_add = 1;
+      else if (unformat (line_input, "name %s", &name))
+       ;
       else
        {
          error = unformat_parse_error (line_input);
@@ -732,7 +745,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
     {
       if (is_add)
        {
-         ip_table_create (fproto, table_id, 0);
+         ip_table_create (fproto, table_id, 0, name);
        }
       else
        {