Skip to content

Commit

Permalink
networkd: manager do not unef netlink and gennetlink early
Browse files Browse the repository at this point in the history
Because of this the fd is getting closed and we getting errors
like
```
^Ceno1: Could not send rtnetlink message: Bad file descriptor
enp7s0f0: Could not send rtnetlink message: Bad file descriptor
enp7s0f0: Cannot delete unreachable route for DHCPv6 delegated subnet 2a0a:...:fc::/62: Bad file descriptor
Assertion '*_head == _item' failed at ../systemd/src/network/networkd-route.c:126, function route_free(). Aborting.
Aborted
```

Closes one of systemd#12452
  • Loading branch information
Susant Sahani authored and yuwata committed May 5, 2019
1 parent e6d6b85 commit 8e5a98a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/network/networkd-manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,18 +1427,13 @@ int manager_new(Manager **ret) {

void manager_free(Manager *m) {
AddressPool *pool;
Network *network;
Link *link;

if (!m)
return;

free(m->state_file);

sd_netlink_unref(m->rtnl);
sd_netlink_unref(m->genl);
sd_resolve_unref(m->resolve);

while ((link = hashmap_first(m->dhcp6_prefixes)))
manager_dhcp6_prefix_remove_all(m, link);
hashmap_free(m->dhcp6_prefixes);
Expand All @@ -1454,9 +1449,7 @@ void manager_free(Manager *m) {
m->links = hashmap_free_with_destructor(m->links, link_unref);

m->duids_requesting_uuid = set_free(m->duids_requesting_uuid);
while ((network = m->networks))
network_unref(network);
hashmap_free(m->networks_by_name);
m->networks_by_name = hashmap_free_with_destructor(m->networks_by_name, network_unref);

m->netdevs = hashmap_free_with_destructor(m->netdevs, netdev_unref);

Expand All @@ -1469,6 +1462,10 @@ void manager_free(Manager *m) {
m->rules_foreign = set_free_with_destructor(m->rules_foreign, routing_policy_rule_free);
set_free_with_destructor(m->rules_saved, routing_policy_rule_free);

sd_netlink_unref(m->rtnl);
sd_netlink_unref(m->genl);
sd_resolve_unref(m->resolve);

sd_event_unref(m->event);

sd_device_monitor_unref(m->device_monitor);
Expand Down

0 comments on commit 8e5a98a

Please sign in to comment.