1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

networkd: link - stop clients when failing

This commit is contained in:
Tom Gundersen 2014-04-22 19:25:31 +02:00
parent 0fbedd1fdc
commit 111bb8f93a

View File

@ -151,6 +151,39 @@ static void link_enter_unmanaged(Link *link) {
link_save(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) { static void link_enter_failed(Link *link) {
assert(link); assert(link);
@ -158,6 +191,8 @@ static void link_enter_failed(Link *link) {
link->state = LINK_STATE_FAILED; link->state = LINK_STATE_FAILED;
link_stop_clients(link);
link_save(link); link_save(link);
} }