1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-31 16:21:26 +03:00

network: restart DHCP server on carrier gain

This commit is contained in:
Yu Watanabe 2021-05-18 16:12:40 +09:00
parent b27e5d53f3
commit ab486ef4eb
2 changed files with 10 additions and 6 deletions

View File

@ -445,13 +445,11 @@ static int dhcp4_server_configure(Link *link) {
return log_link_error_errno(link, r, "Failed to set DHCPv4 static lease for DHCP server: %m");
}
if (!sd_dhcp_server_is_running(link->dhcp_server)) {
r = sd_dhcp_server_start(link->dhcp_server);
if (r < 0)
return log_link_error_errno(link, r, "Could not start DHCPv4 server instance: %m");
log_link_debug(link, "Offering DHCPv4 leases");
}
return 1;
}

View File

@ -1209,6 +1209,12 @@ static int link_acquire_ipv4_conf(Link *link) {
return log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m");
}
if (link->dhcp_server) {
r = sd_dhcp_server_start(link->dhcp_server);
if (r < 0)
return log_link_warning_errno(link, r, "Could not start DHCP server: %m");
}
return 0;
}