summaryrefslogtreecommitdiff
path: root/src/network/networkd-netdev.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-08 19:46:06 +0200
committerTom Gundersen <teg@jklm.no>2014-05-09 14:41:27 +0200
commitb226d99b044222739dccfa9cf9f7a9d79576c407 (patch)
tree72725d58273afa28235e40e4747df2d0a3efe09d /src/network/networkd-netdev.c
parent47e2dc3168cb0509d8d61f5dbeffaa3c252685b5 (diff)
networkd: link - take refcounts on links
We need to take a refcount on the link whenever we expect a callback. The exceptions are the ipv4ll/dhcp clients as their lifetimes are guaranteed to be shorter than that of the link.
Diffstat (limited to 'src/network/networkd-netdev.c')
-rw-r--r--src/network/networkd-netdev.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index 961404295d..5ee257f984 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -168,7 +168,7 @@ static int netdev_enter_ready(NetDev *netdev) {
log_info_netdev(netdev, "netdev ready");
LIST_FOREACH(callbacks, callback, netdev->callbacks) {
- /* enslave the links that were attempted to be enslaved befor the
+ /* enslave the links that were attempted to be enslaved before the
* link was ready */
netdev_enslave_ready(netdev, callback->link, callback->callback);
}
@@ -308,11 +308,15 @@ static int netdev_create(NetDev *netdev, Link *link, sd_rtnl_message_handler_t c
}
int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback) {
+ int r;
+
if (netdev->kind == NETDEV_KIND_VLAN || netdev->kind == NETDEV_KIND_MACVLAN)
return netdev_create(netdev, link, callback);
if (netdev->state == NETDEV_STATE_READY) {
- netdev_enslave_ready(netdev, link, callback);
+ r = netdev_enslave_ready(netdev, link, callback);
+ if (r < 0)
+ return r;
} else {
/* the netdev is not yet read, save this request for when it is*/
netdev_enslave_callback *cb;