minor spelling errors (both in comments)
[vpp.git] / src / vnet / mpls / mpls_tunnel.c
index b9e8519..8db08c3 100644 (file)
@@ -62,7 +62,7 @@ static u8*
 mpls_tunnel_build_rewrite_i (void)
 {
     /*
-     * passing the adj code a NULL rewirte means 'i don't have one cos
+     * passing the adj code a NULL rewrite means 'i don't have one cos
      * t'other end is unresolved'. That's not the case here. For the mpls
      * tunnel there are just no bytes of encap to apply in the adj. We'll impose
      * the label stack once we choose a path. So return a zero length rewrite.
@@ -245,6 +245,12 @@ mpls_tunnel_stack (adj_index_t ai)
     if (NULL == mt)
         return;
 
+    if (FIB_NODE_INDEX_INVALID == mt->mt_path_list)
+    {
+        adj_nbr_midchain_unstack(ai);
+        return;
+    }
+
     /*
      * while we're stacking the adj, remove the tunnel from the child list
      * of the path list. this breaks a circular dependency of walk updates
@@ -724,6 +730,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
 
         old_pl_index = mt->mt_path_list;
 
+        fib_path_list_lock(old_pl_index);
         mt->mt_path_list =
             fib_path_list_copy_and_path_remove(old_pl_index,
                                                FIB_PATH_LIST_FLAG_SHARED,
@@ -735,6 +742,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
         if (FIB_NODE_INDEX_INVALID == mt->mt_path_list)
         {
             /* no paths left */
+            fib_path_list_unlock(old_pl_index);
             return (0);
         }
         else
@@ -758,6 +766,7 @@ vnet_mpls_tunnel_path_remove (u32 sw_if_index,
                                   mt->mt_path_list);
 
         mpls_tunnel_restack(mt);
+        fib_path_list_unlock(old_pl_index);
    }
 
     return (fib_path_list_get_n_paths(mt->mt_path_list));