mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
networkd: netdev - drop the link callbacks after calling them once
We should never call them again, so make sure they are cleaned up correctly.
This commit is contained in:
parent
563c69c6b2
commit
ad0774e61e
@ -192,7 +192,8 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
|
||||
}
|
||||
|
||||
static int netdev_enter_ready(NetDev *netdev) {
|
||||
netdev_enslave_callback *callback;
|
||||
netdev_enslave_callback *callback, *callback_next;
|
||||
int r;
|
||||
|
||||
assert(netdev);
|
||||
assert(netdev->ifname);
|
||||
@ -204,10 +205,16 @@ static int netdev_enter_ready(NetDev *netdev) {
|
||||
|
||||
log_info_netdev(netdev, "netdev ready");
|
||||
|
||||
LIST_FOREACH(callbacks, callback, netdev->callbacks) {
|
||||
LIST_FOREACH_SAFE(callbacks, callback, callback_next, netdev->callbacks) {
|
||||
/* enslave the links that were attempted to be enslaved before the
|
||||
* link was ready */
|
||||
netdev_enslave_ready(netdev, callback->link, callback->callback);
|
||||
r = netdev_enslave_ready(netdev, callback->link, callback->callback);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
LIST_REMOVE(callbacks, netdev->callbacks, callback);
|
||||
link_unref(callback->link);
|
||||
free(callback);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user