summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp4.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-05-28 05:45:10 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-05-28 22:21:25 +0900
commitefdb62dfd04f92a7714777046fd1ba68a84c9f63 (patch)
tree28ad9683c9a6912ad24ee3584d22e44bcbd3fba1 /src/network/networkd-dhcp4.c
parent8ad8292452a708f42b67cda6e9b2074b803197c4 (diff)
downloadsystemd-efdb62dfd04f92a7714777046fd1ba68a84c9f63.tar.gz
systemd-efdb62dfd04f92a7714777046fd1ba68a84c9f63.tar.bz2
systemd-efdb62dfd04f92a7714777046fd1ba68a84c9f63.zip
network: do not send DHCPRELEASE when CriticalConnection= is enabled
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r--src/network/networkd-dhcp4.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 8bcd345731..4ed020ea8e 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -649,15 +649,28 @@ static int dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
return log_link_warning_errno(link, r, "Could not acquire IPv4 link-local address: %m");
}
+ if (link->network->dhcp_critical) {
+ log_link_notice(link, "DHCPv4 connection considered critical, ignoring request to reconfigure it.");
+ return 0;
+ }
+
if (link->network->dhcp_send_release)
(void) sd_dhcp_client_send_release(client);
- _fallthrough_;
+ if (link->dhcp_lease) {
+ r = dhcp_lease_lost(link);
+ if (r < 0) {
+ link_enter_failed(link);
+ return r;
+ }
+ }
+
+ break;
case SD_DHCP_CLIENT_EVENT_EXPIRED:
case SD_DHCP_CLIENT_EVENT_IP_CHANGE:
if (link->network->dhcp_critical) {
- log_link_notice(link, "DHCPv4 connection considered system critical, ignoring request to reconfigure it.");
+ log_link_notice(link, "DHCPv4 connection considered critical, ignoring request to reconfigure it.");
return 0;
}