diff options
| author | Renato Westphal <renato@opensourcerouting.org> | 2022-11-23 22:14:51 -0300 |
|---|---|---|
| committer | Renato Westphal <renato@opensourcerouting.org> | 2022-11-24 13:08:26 -0300 |
| commit | 4dfe15200ab1a84a8d77fcbc33085c373d556eae (patch) | |
| tree | ebf8541d3699393368dc2b9dedb714fe3d9bdd72 /ospf6d/ospf6_route.c | |
| parent | d15c84fa223bb32500912af1d05c8a701a643e15 (diff) | |
ospf6d: fix infinite loop when adding ASBR route
Commit 8f359e1593c414322 removed a check that prevented the same route
from being added twice. In certain topologies, that change resulted in
the following infinite loop when adding an ASBR route:
ospf6_route_add
ospf6_top_brouter_hook_add
ospf6_abr_examin_brouter
ospf6_abr_examin_summary
ospf6_route_add
(repeat until stack overflow)
Revert the offending commit and update `ospf6_route_is_identical()` to
not do comparison using `memcmp()`.
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_route.c')
| -rw-r--r-- | ospf6d/ospf6_route.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c index db94b85b1b..1cc1fcb47b 100644 --- a/ospf6d/ospf6_route.c +++ b/ospf6d/ospf6_route.c @@ -702,6 +702,27 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route, } if (old) { + /* if route does not actually change, return unchanged */ + if (ospf6_route_is_identical(old, route)) { + if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) + zlog_debug( + "%s %p: route add %p: needless update of %p old cost %u", + ospf6_route_table_name(table), + (void *)table, (void *)route, + (void *)old, old->path.cost); + else if (IS_OSPF6_DEBUG_ROUTE(TABLE)) + zlog_debug("%s: route add: needless update", + ospf6_route_table_name(table)); + + ospf6_route_delete(route); + SET_FLAG(old->flag, OSPF6_ROUTE_ADD); + ospf6_route_table_assert(table); + + /* to free the lookup lock */ + route_unlock_node(node); + return old; + } + if (IS_OSPF6_DEBUG_ROUTE(MEMORY)) zlog_debug( "%s %p: route add %p cost %u paths %u nh %u: update of %p cost %u paths %u nh %u", |
