network/nexthop: do not remove depending nexthops when a nexthop is removed

Previously, when a nexthop is removed, depending nexthops were removed, but
that's not necessary, as the kernel keeps them, at least with v6.11.
This commit is contained in:
Yu Watanabe
2024-11-11 13:59:41 +00:00
committed by Luca Boccassi
parent 422e418ab9
commit 1ca180b994
2 changed files with 13 additions and 16 deletions
+3 -13
View File
@@ -491,19 +491,9 @@ static int nexthop_remove_dependents(NextHop *nexthop, Manager *manager) {
assert(nexthop);
assert(manager);
/* If a nexthop is removed, the kernel silently removes nexthops and routes that depend on the
* removed nexthop. Let's remove them for safety (though, they are already removed in the kernel,
* hence that should fail), and forget them. */
void *id;
SET_FOREACH(id, nexthop->nexthops) {
NextHop *nh;
if (nexthop_get_by_id(manager, PTR_TO_UINT32(id), &nh) < 0)
continue;
RET_GATHER(r, nexthop_remove(nh, manager));
}
/* If a nexthop is removed, the kernel silently removes routes that depend on the removed nexthop.
* Let's remove them for safety (though, they are already removed in the kernel, hence that should
* fail), and forget them. */
Route *route;
SET_FOREACH(route, nexthop->routes)