FIB table add/delete API
[vpp.git] / src / vnet / mfib / ip6_mfib.c
index 116fee2..e486133 100644 (file)
@@ -151,14 +151,15 @@ static const ip6_mfib_special_t ip6_mfib_specials[] =
 
 
 static u32
-ip6_create_mfib_with_table_id (u32 table_id)
+ip6_create_mfib_with_table_id (u32 table_id,
+                               mfib_source_t src)
 {
     mfib_table_t *mfib_table;
     mfib_prefix_t pfx = {
         .fp_proto = FIB_PROTOCOL_IP6,
     };
     const fib_route_path_t path_for_us = {
-        .frp_proto = FIB_PROTOCOL_IP6,
+        .frp_proto = DPO_PROTO_IP6,
         .frp_addr = zero_addr,
         .frp_sw_if_index = 0xffffffff,
         .frp_fib_index = ~0,
@@ -182,7 +183,7 @@ ip6_create_mfib_with_table_id (u32 table_id)
         mfib_table->v6.table_id =
             table_id;
 
-    mfib_table_lock(mfib_table->mft_index, FIB_PROTOCOL_IP6);
+    mfib_table_lock(mfib_table->mft_index, FIB_PROTOCOL_IP6, src);
 
     mfib_table->v6.rhead =
         clib_mem_alloc_aligned (sizeof(*mfib_table->v6.rhead),
@@ -222,7 +223,7 @@ ip6_mfib_table_destroy (ip6_mfib_t *mfib)
         .fp_proto = FIB_PROTOCOL_IP6,
     };
     const fib_route_path_t path_for_us = {
-        .frp_proto = FIB_PROTOCOL_IP6,
+        .frp_proto = DPO_PROTO_IP6,
         .frp_addr = zero_addr,
         .frp_sw_if_index = 0xffffffff,
         .frp_fib_index = ~0,
@@ -259,7 +260,7 @@ void
 ip6_mfib_interface_enable_disable (u32 sw_if_index, int is_enable)
 {
     const fib_route_path_t path = {
-        .frp_proto = FIB_PROTOCOL_IP6,
+        .frp_proto = DPO_PROTO_IP6,
         .frp_addr = zero_addr,
         .frp_sw_if_index = sw_if_index,
         .frp_fib_index = ~0,
@@ -297,14 +298,15 @@ ip6_mfib_interface_enable_disable (u32 sw_if_index, int is_enable)
 }
 
 u32
-ip6_mfib_table_find_or_create_and_lock (u32 table_id)
+ip6_mfib_table_find_or_create_and_lock (u32 table_id,
+                                        mfib_source_t src)
 {
     u32 index;
 
     index = ip6_mfib_index_from_table_id(table_id);
     if (~0 == index)
-        return ip6_create_mfib_with_table_id(table_id);
-    mfib_table_lock(index, FIB_PROTOCOL_IP6);
+        return ip6_create_mfib_with_table_id(table_id, src);
+    mfib_table_lock(index, FIB_PROTOCOL_IP6, src);
 
     return (index);
 }
@@ -585,16 +587,19 @@ ip6_show_mfib (vlib_main_t * vm,
                            unformat_ip6_address, &grp))
         {
             matching = 1;
-            mask = 64;
+            mask = 256;
         }
-        else if (unformat (input, "%U", unformat_ip6_address, &grp))
+        else if (unformat (input, "%U/%d", unformat_ip6_address, &grp, &mask))
         {
+            memset(&src, 0, sizeof(src));
             matching = 1;
-            mask = 32;
         }
-        else if (unformat (input, "%U/%d",
-                           unformat_ip6_address, &grp, &mask))
+        else if (unformat (input, "%U", unformat_ip6_address, &grp))
+        {
+            memset(&src, 0, sizeof(src));
             matching = 1;
+            mask = 128;
+        }
         else if (unformat (input, "table %d", &table_id))
             ;
         else if (unformat (input, "index %d", &fib_index))