network/route: introduce ref/unref functions for Route object

Then, Route object can live if it is detached from the owner (Manager,
Network, or Wireguard object).

This is the one for routes of ebd9690647.
This commit is contained in:
Yu Watanabe
2024-01-25 16:43:44 +09:00
parent 3caed9ea08
commit 74c301b9ee
9 changed files with 97 additions and 61 deletions
+2 -2
View File
@@ -188,7 +188,7 @@ int network_verify(Network *network) {
network->filename);
network->addresses_by_section = ordered_hashmap_free(network->addresses_by_section);
network->routes_by_section = hashmap_free_with_destructor(network->routes_by_section, route_free);
network->routes_by_section = hashmap_free(network->routes_by_section);
}
if (network->link_local < 0) {
@@ -782,7 +782,7 @@ static Network *network_free(Network *network) {
/* static configs */
set_free_free(network->ipv6_proxy_ndp_addresses);
ordered_hashmap_free(network->addresses_by_section);
hashmap_free_with_destructor(network->routes_by_section, route_free);
hashmap_free(network->routes_by_section);
ordered_hashmap_free(network->nexthops_by_section);
hashmap_free_with_destructor(network->bridge_fdb_entries_by_section, bridge_fdb_free);
hashmap_free_with_destructor(network->bridge_mdb_entries_by_section, bridge_mdb_free);