summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-01-20 02:28:00 +0000
committerNeale Ranns <nranns@cisco.com>2020-01-22 22:34:43 +0000
commit20398a368c2b82464a06afbf277b1ffea161a1d3 (patch)
treec96215ce1be192ec558c5aee3c58d3984098ee36 /src/vnet/fib
parent29acfa2ad58c36d183677d2d68c390854e3b8060 (diff)
fib: FIB crash removing labelled route (VPP-1818)
Type: fix The crash occured trying to retreive a NULL path list to walk the path extensions. A walk shoul not be required, because there should be no extensins, since all paths are removed. The problem is that when the paths were added, they were not sorted, hence neither were the extensions and when they were updated, duplicate extensions were added, and hence a path removal did not remove them all. Fix is to make sure paths are sorted. Change-Id: I069d937de8e7bc8aae3d92f588db4daff727d863 Signed-off-by: Neale Ranns <nranns@cisco.com> (cherry picked from commit 257749c40946a9269140d322e374d74c3b6eefb8)
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_table.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/vnet/fib/fib_table.c b/src/vnet/fib/fib_table.c
index ac0f2da6696..ec2acc59c52 100644
--- a/src/vnet/fib/fib_table.c
+++ b/src/vnet/fib/fib_table.c
@@ -580,6 +580,13 @@ fib_table_entry_path_add (u32 fib_index,
return (fib_entry_index);
}
+static int
+fib_route_path_cmp_for_sort (void * v1,
+ void * v2)
+{
+ return (fib_route_path_cmp(v1, v2));
+}
+
fib_node_index_t
fib_table_entry_path_add2 (u32 fib_index,
const fib_prefix_t *prefix,
@@ -598,6 +605,11 @@ fib_table_entry_path_add2 (u32 fib_index,
{
fib_table_route_path_fixup(prefix, &flags, &rpaths[ii]);
}
+ /*
+ * sort the paths provided by the control plane. this means
+ * the paths and the extension on the entry will be sorted.
+ */
+ vec_sort_with_function(rpaths, fib_route_path_cmp_for_sort);
if (FIB_NODE_INDEX_INVALID == fib_entry_index)
{
@@ -740,13 +752,6 @@ fib_table_entry_path_remove (u32 fib_index,
vec_free(paths);
}
-static int
-fib_route_path_cmp_for_sort (void * v1,
- void * v2)
-{
- return (fib_route_path_cmp(v1, v2));
-}
-
fib_node_index_t
fib_table_entry_update (u32 fib_index,
const fib_prefix_t *prefix,