fib: Don't back walk from a path-list when a child fist attaches. 00/34200/2
authorNeale Ranns <neale@graphiant.com>
Thu, 21 Oct 2021 12:02:53 +0000 (12:02 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Fri, 22 Oct 2021 07:49:52 +0000 (07:49 +0000)
Type: fix

If the walk is triggered when the child is added, then that child is visited in the walk. However, since it is just attahcing to the path-list it may not, or indeed cannot, have all the context it needs to successfully handle the walk.
In the case of MPLS tunnel, it does not have the path extensions ready, and cannot since the path extensions need to resolve on the path-list.

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: I027af8cf2f522d2f6e37931bea60c767f0cb667d

src/vnet/fib/fib_path_list.c
test/test_mpls.py

index df08bb2..8175169 100644 (file)
@@ -1297,22 +1297,15 @@ fib_path_list_child_add (fib_node_index_t path_list_index,
                         fib_node_type_t child_type,
                         fib_node_index_t child_index)
 {
-    u32 sibling;
-
-    sibling = fib_node_child_add(FIB_NODE_TYPE_PATH_LIST,
-                                 path_list_index,
-                                 child_type,
-                                 child_index);
-
-    if (FIB_PATH_LIST_POPULAR == fib_node_get_n_children(FIB_NODE_TYPE_PATH_LIST,
-                                                         path_list_index))
+    if (FIB_PATH_LIST_POPULAR - 1 == fib_node_get_n_children(FIB_NODE_TYPE_PATH_LIST,
+                                                             path_list_index))
     {
         /*
          * Set the popular flag on the path-list once we pass the magic
          * threshold. then walk children to update.
          * We don't undo this action. The rational being that the number
          * of entries using this prefix is large enough such that it is a
-         * non-trivial amount of effort to converge them. If we get into the
+         * non-trival amount of effort to converge them. If we get into the
          * situation where we are adding and removing entries such that we
          * flip-flop over the threshold, then this non-trivial work is added
          * to each of those routes adds/deletes - not a situation we want.
@@ -1328,7 +1321,10 @@ fib_path_list_child_add (fib_node_index_t path_list_index,
        fib_walk_sync(FIB_NODE_TYPE_PATH_LIST, path_list_index, &ctx);
     }
 
-    return (sibling);
+    return (fib_node_child_add(FIB_NODE_TYPE_PATH_LIST,
+                                 path_list_index,
+                                 child_type,
+                                 child_index));
 }
 
 void
index 2c40e8d..2b959e4 100644 (file)
@@ -1069,7 +1069,7 @@ class TestMPLS(VppTestCase):
     def test_mpls_tunnel_many(self):
         """ MPLS Multiple Tunnels """
 
-        for ii in range(10):
+        for ii in range(100):
             mpls_tun = VppMPLSTunnelInterface(
                 self,
                 [VppRoutePath(self.pg0.remote_ip4,
@@ -1078,6 +1078,16 @@ class TestMPLS(VppTestCase):
                                       VppMplsLabel(46, MplsLspMode.UNIFORM)])])
             mpls_tun.add_vpp_config()
             mpls_tun.admin_up()
+        for ii in range(100):
+            mpls_tun = VppMPLSTunnelInterface(
+                self,
+                [VppRoutePath(self.pg0.remote_ip4,
+                              self.pg0.sw_if_index,
+                              labels=[VppMplsLabel(44, ttl=32),
+                                      VppMplsLabel(46, MplsLspMode.UNIFORM)])],
+                is_l2=1)
+            mpls_tun.add_vpp_config()
+            mpls_tun.admin_up()
 
     def test_v4_exp_null(self):
         """ MPLS V4 Explicit NULL test """