fib: constify the adjacency in the rewrite nodes
[vpp.git] / src / vnet / mpls / mpls_tunnel.c
index 8db08c3..3ed77e6 100644 (file)
@@ -242,7 +242,7 @@ mpls_tunnel_stack (adj_index_t ai)
 
     mt = mpls_tunnel_get_from_sw_if_index(sw_if_index);
 
-    if (NULL == mt)
+    if (NULL == mt || FIB_NODE_INDEX_INVALID == mt->mt_path_list)
         return;
 
     if (FIB_NODE_INDEX_INVALID == mt->mt_path_list)
@@ -376,7 +376,7 @@ mpls_tunnel_admin_up_down (vnet_main_t * vnm,
  */
 static void
 mpls_tunnel_fixup (vlib_main_t *vm,
-                   ip_adjacency_t *adj,
+                   const ip_adjacency_t *adj,
                    vlib_buffer_t *b0,
                    const void*data)
 {
@@ -654,6 +654,7 @@ void
 vnet_mpls_tunnel_path_add (u32 sw_if_index,
                            fib_route_path_t *rpaths)
 {
+    fib_route_path_t *rpath;
     mpls_tunnel_t *mt;
     u32 mti;
 
@@ -695,10 +696,13 @@ vnet_mpls_tunnel_path_add (u32 sw_if_index,
          */
         fib_path_ext_list_resolve(&mt->mt_path_exts, mt->mt_path_list);
     }
-    fib_path_ext_list_insert(&mt->mt_path_exts,
-                             mt->mt_path_list,
-                             FIB_PATH_EXT_MPLS,
-                             rpaths);
+    vec_foreach(rpath, rpaths)
+    {
+        fib_path_ext_list_insert(&mt->mt_path_exts,
+                                 mt->mt_path_list,
+                                 FIB_PATH_EXT_MPLS,
+                                 rpath);
+    }
     mpls_tunnel_restack(mt);
 }