ospf6d: Fix use after free of router in OSPFv3 ABR route calculation.

This PR fixes FRR issue https://github.com/FRRouting/frr/issues/18040. The
OSPFv3 route is locked during the ABR calculation since there are
scenarios under which it is freed. The OSPFv3 ABR computation is
sub-optimal and this PR doesn't attempt to rework it.

Signed-off-by: Acee Lindem <acee@lindem.com>
This commit is contained in:
Acee Lindem 2025-02-24 21:44:32 +00:00
parent b6ae929c1d
commit 06af50eace

View file

@ -2194,9 +2194,15 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
zlog_info("%s: brouter %s appears via area %s", zlog_info("%s: brouter %s appears via area %s",
__func__, brouter_name, oa->name); __func__, brouter_name, oa->name);
ospf6_route_lock(brouter);
/* newly added */ /* newly added */
if (hook_add) if (hook_add)
(*hook_add)(brouter); (*hook_add)(brouter);
if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_WAS_REMOVED)) {
ospf6_route_unlock(brouter);
brouter = NULL;
} else
ospf6_route_unlock(brouter);
} else { } else {
if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID( if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(
brouter_id) brouter_id)