Commit a743fe1ae3 for frr
commit a743fe1ae33b247185be798bf619e9f2f793414b
Author: Jing Kan <kanjing.kj@alibaba-inc.com>
Date: Mon Nov 9 22:08:25 2026 +0800
tests: exercise FlowSpec node reuse through route_node_get
The byte-prefix NLRI regression test checks that distinct FlowSpec rules
keep separate route nodes. Its extra route_node_lookup() calls exercise
a different path from normal FlowSpec updates and withdrawals, exposing
an existing temporary-prefix ownership leak.
Use route_node_get() for both repeated retrievals and verify node identity,
independent info pointers, and an unchanged route count. Preserve the
prefix matching assertions without changing the underlying library's
ownership behavior.
Link: https://github.com/FRRouting/frr/pull/23886#issuecomment-6736151737
Signed-off-by: Jing Kan <kanjing.kj@alibaba-inc.com>
diff --git a/tests/lib/test_table.c b/tests/lib/test_table.c
index cacea1de7c..577e1f1433 100644
--- a/tests/lib/test_table.c
+++ b/tests/lib/test_table.c
@@ -570,7 +570,7 @@ static void test_flowspec_prefix_match(void)
struct route_table *table;
struct route_node *rn_short;
struct route_node *rn_long;
- struct route_node *lookup;
+ struct route_node *node;
p_long.u.prefix_flowspec.prefixlen = sizeof(nlri_long);
p_long.u.prefix_flowspec.ptr = (uintptr_t)nlri_long;
@@ -586,15 +586,15 @@ static void test_flowspec_prefix_match(void)
assert(rn_long != rn_short);
rn_long->info = &p_long;
- lookup = route_node_lookup(table, &p_short);
- assert(lookup == rn_short);
- route_unlock_node(lookup);
- lookup = route_node_lookup(table, &p_long);
- assert(lookup == rn_long);
- route_unlock_node(lookup);
- lookup = route_node_get(table, &p_long);
- assert(lookup == rn_long);
- route_unlock_node(lookup);
+ /* Reuse the get path used by BGP updates and withdrawals. */
+ node = route_node_get(table, &p_short);
+ assert(node == rn_short);
+ assert(node->info == &p_short);
+ route_unlock_node(node);
+ node = route_node_get(table, &p_long);
+ assert(node == rn_long);
+ assert(node->info == &p_long);
+ route_unlock_node(node);
assert(route_table_count(table) == 2);
route_table_finish(table);