summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/network/networkd-address.c6
-rw-r--r--src/network/networkd-dummy.c2
-rw-r--r--src/network/networkd-link.c21
-rw-r--r--src/network/networkd-netdev.c5
-rw-r--r--src/network/networkd-route.c4
5 files changed, 15 insertions, 23 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 76febc7a07..1ba2108316 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -144,6 +144,8 @@ int address_drop(Address *address, Link *link,
return r;
}
+ link_ref(link);
+
return 0;
}
@@ -225,6 +227,8 @@ int address_update(Address *address, Link *link,
return r;
}
+ link_ref(link);
+
return 0;
}
@@ -373,6 +377,8 @@ int address_configure(Address *address, Link *link,
return r;
}
+ link_ref(link);
+
return 0;
}
diff --git a/src/network/networkd-dummy.c b/src/network/networkd-dummy.c
index 5232524df7..80fe41b0b7 100644
--- a/src/network/networkd-dummy.c
+++ b/src/network/networkd-dummy.c
@@ -112,6 +112,8 @@ int netdev_create_dummy(NetDev *netdev, sd_rtnl_message_handler_t callback) {
return r;
}
+ netdev_ref(netdev);
+
log_debug_netdev(netdev, "Creating dummy netdev.");
netdev->state = NETDEV_STATE_CREATING;
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 660efedc61..14c0417d83 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -436,7 +436,6 @@ static int link_set_dhcp_routes(Link *link) {
return r;
}
- link_ref(link);
link->route_messages ++;
}
@@ -468,7 +467,6 @@ static int link_enter_set_routes(Link *link) {
return r;
}
- link_ref(link);
link->route_messages ++;
}
@@ -503,7 +501,6 @@ static int link_enter_set_routes(Link *link) {
return r;
}
- link_ref(link);
link->route_messages ++;
}
}
@@ -551,7 +548,6 @@ static int link_enter_set_routes(Link *link) {
return r;
}
- link_ref(link);
link->route_messages ++;
route->family = AF_INET;
@@ -566,7 +562,6 @@ static int link_enter_set_routes(Link *link) {
return r;
}
- link_ref(link);
link->route_messages ++;
}
@@ -663,7 +658,6 @@ static int link_enter_set_addresses(Link *link) {
return r;
}
- link_ref(link);
link->addr_messages ++;
}
@@ -699,7 +693,6 @@ static int link_enter_set_addresses(Link *link) {
return r;
}
- link_ref(link);
link->addr_messages ++;
}
}
@@ -760,7 +753,6 @@ static int link_enter_set_addresses(Link *link) {
return r;
}
- link_ref(link);
link->addr_messages ++;
}
@@ -957,7 +949,6 @@ static int dhcp_lease_lost(Link *link) {
route->dst_prefixlen = routes[i].dst_prefixlen;
route_drop(route, link, &route_drop_handler);
- link_ref(link);
}
}
}
@@ -978,7 +969,6 @@ static int dhcp_lease_lost(Link *link) {
route_gw->scope = RT_SCOPE_LINK;
route_drop(route_gw, link, &route_drop_handler);
- link_ref(link);
}
r = route_new_dynamic(&route);
@@ -987,7 +977,6 @@ static int dhcp_lease_lost(Link *link) {
route->in_addr.in = gateway;
route_drop(route, link, &route_drop_handler);
- link_ref(link);
}
}
@@ -1000,7 +989,6 @@ static int dhcp_lease_lost(Link *link) {
address->prefixlen = prefixlen;
address_drop(address, link, &address_drop_handler);
- link_ref(link);
}
if (link->network->dhcp_mtu) {
@@ -1267,7 +1255,6 @@ static int ipv4ll_address_update(Link *link, bool deprecate) {
address->broadcast.s_addr = address->in_addr.in.s_addr | htonl(0xfffffffflu >> address->prefixlen);
address_update(address, link, &address_update_handler);
- link_ref(link);
}
return 0;
@@ -1300,7 +1287,6 @@ static int ipv4ll_address_lost(Link *link) {
address->scope = RT_SCOPE_LINK;
address_drop(address, link, &address_drop_handler);
- link_ref(link);
r = route_new_dynamic(&route);
if (r < 0) {
@@ -1314,7 +1300,6 @@ static int ipv4ll_address_lost(Link *link) {
route->metrics = 99;
route_drop(route, link, &route_drop_handler);
- link_ref(link);
}
return 0;
@@ -1810,7 +1795,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
@@ -1834,7 +1818,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
@@ -1858,7 +1841,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
@@ -1879,7 +1861,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
@@ -1900,7 +1881,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
@@ -1921,7 +1901,6 @@ static int link_enter_enslave(Link *link) {
return r;
}
- link_ref(link);
link->enslaving ++;
}
diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c
index c80e943871..0861ff3cc1 100644
--- a/src/network/networkd-netdev.c
+++ b/src/network/networkd-netdev.c
@@ -184,6 +184,8 @@ static int netdev_enslave_ready(NetDev *netdev, Link* link, sd_rtnl_message_hand
return r;
}
+ link_ref(link);
+
log_debug_netdev(netdev, "enslaving link '%s'", link->ifname);
return 0;
@@ -393,6 +395,7 @@ int netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callbac
cb->callback = callback;
cb->link = link;
+ link_ref(link);
LIST_PREPEND(callbacks, netdev->callbacks, cb);
}
@@ -678,8 +681,6 @@ static int netdev_load_one(Manager *manager, const char *filename) {
if (r < 0)
return r;
- netdev_ref(netdev);
-
break;
case NETDEV_KIND_BRIDGE:
case NETDEV_KIND_BOND:
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index d0a04ecfee..acfe3f023f 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -164,6 +164,8 @@ int route_drop(Route *route, Link *link,
return r;
}
+ link_ref(link);
+
return 0;
}
@@ -235,6 +237,8 @@ int route_configure(Route *route, Link *link,
return r;
}
+ link_ref(link);
+
return 0;
}