summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-link.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 392665a4d1..d9b38c1f6d 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -151,6 +151,39 @@ static void link_enter_unmanaged(Link *link) {
link_save(link);
}
+static int link_stop_clients(Link *link) {
+ int r = 0, k;
+
+ assert(link);
+ assert(link->manager);
+ assert(link->manager->event);
+
+ if (!link->network)
+ return 0;
+
+ if (link->network->dhcp) {
+ assert(link->dhcp_client);
+
+ k = sd_dhcp_client_stop(link->dhcp_client);
+ if (k < 0) {
+ log_warning_link(link, "Could not stop DHCPv4 client: %s", strerror(-r));
+ r = k;
+ }
+ }
+
+ if (link->network->ipv4ll) {
+ assert(link->ipv4ll);
+
+ k = sd_ipv4ll_stop(link->ipv4ll);
+ if (k < 0) {
+ log_warning_link(link, "Could not stop IPv4 link-local: %s", strerror(-r));
+ r = k;
+ }
+ }
+
+ return r;
+}
+
static void link_enter_failed(Link *link) {
assert(link);
@@ -158,6 +191,8 @@ static void link_enter_failed(Link *link) {
link->state = LINK_STATE_FAILED;
+ link_stop_clients(link);
+
link_save(link);
}