Compare commits

..

8 Commits

Author SHA1 Message Date
Yu Watanabe e94c38e783
Merge dda1e98c04 into b7eefa1996 2024-11-21 08:55:26 +01:00
Yu Watanabe dda1e98c04 network/nexthop: add one more assertion
This may help issue #35164.
2024-11-21 16:54:26 +09:00
Yu Watanabe 3d417da827 network: introduce address_forget() and friends and use it where applicable
No functional change, just refactoring.
2024-11-21 16:47:36 +09:00
Yu Watanabe 5209f43ad2 network/nexthop: drop outdated comment and add one debugging log
All NextHop objects are managed by Manager since
352eba2e49.
2024-11-21 16:47:36 +09:00
Yu Watanabe a16844ff60 network/ndisc: unref Route objects that depend on the nexthop
No functional change, as when this function is called, the set will be
freed and contained Route objects will be unref()ed anyway soon later
by nexthop_detach() -> nexthop_free().
Even though, when the routes are forgotten from the Manager, then it is
not necessary to keep them by the nexthop. Let's unref earlier.
2024-11-21 16:47:36 +09:00
Yu Watanabe 5344ee6c94 network/ndisc: constify several arguments and add several assertions
Follow-up for 0f8afaf94d.

No functional change, just for safety.
2024-11-21 16:47:36 +09:00
Yu Watanabe 3985e93dab network/nexthop: do not share NextHop.nexthops and NextHop.routes with duplicated object
Otherwise, these may be freed twice.
But, fortunately, when this function is called, both are NULL.
So, this should not change any behavior. But for safety.
2024-11-21 16:47:36 +09:00
Yu Watanabe c6f6f506fc network: drop outdated comment
All Route objects are managed by Manager since
8d01e44c1f.
2024-11-21 16:47:36 +09:00
1 changed files with 3 additions and 1 deletions

View File

@ -78,7 +78,9 @@ static NextHop* nexthop_detach_impl(NextHop *nexthop) {
nexthop_detach_from_group_members(nexthop);
assert_se(hashmap_remove(nexthop->manager->nexthops_by_id, UINT32_TO_PTR(nexthop->id)) == nexthop);
NextHop *n;
n = hashmap_remove(nexthop->manager->nexthops_by_id, UINT32_TO_PTR(nexthop->id));
assert(!n || n == nexthop);
nexthop->manager = NULL;
return nexthop;
}