summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index d26027f0bd..121b4d5e0a 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -228,6 +228,7 @@ static Link *link_free(Link *link) {
unlink_and_free(link->state_file);
sd_device_unref(link->sd_device);
+ netdev_unref(link->netdev);
hashmap_free(link->bound_to_links);
hashmap_free(link->bound_by_links);
@@ -1206,6 +1207,7 @@ static int link_get_network(Link *link, Network **ret) {
static int link_reconfigure_impl(Link *link, bool force) {
Network *network = NULL;
+ NetDev *netdev = NULL;
int r;
assert(link);
@@ -1213,6 +1215,10 @@ static int link_reconfigure_impl(Link *link, bool force) {
if (!IN_SET(link->state, LINK_STATE_INITIALIZED, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED, LINK_STATE_UNMANAGED))
return 0;
+ r = netdev_get(link->manager, link->ifname, &netdev);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
r = link_get_network(link, &network);
if (r < 0 && r != -ENOENT)
return r;
@@ -1265,6 +1271,9 @@ static int link_reconfigure_impl(Link *link, bool force) {
link_free_engines(link);
link->network = network_unref(link->network);
+ netdev_unref(link->netdev);
+ link->netdev = netdev_ref(netdev);
+
if (!network) {
link_set_state(link, LINK_STATE_UNMANAGED);
return 0;