diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-21 03:24:44 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-08-21 04:43:59 +0200 |
commit | 2bb7559ade518bb0f27ec6d0212ddb8bcc470677 (patch) | |
tree | 9c59b62d43255e527c0a2f62c8cc8567f544ccad /src | |
parent | sd-dhcp-client: refuse to send RELEASE or friends gracefully when the daemon ... (diff) | |
download | systemd-2bb7559ade518bb0f27ec6d0212ddb8bcc470677.tar.xz systemd-2bb7559ade518bb0f27ec6d0212ddb8bcc470677.zip |
sd-dhcp-client: stop client without calling notification after sending RELEASE
Otherwise, even the acquired lease is released, the client may be in
e.g. BOUND state or so, and may send renew or rebind after timeout
later.
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 94ad5bbea9..1a1499fa2c 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -2223,7 +2223,11 @@ int sd_dhcp_client_send_release(sd_dhcp_client *client) { log_dhcp_client(client, "RELEASE"); - return 0; + /* This function is mostly called when stopping daemon. Hence, do not call client_stop() or + * client_restart(). Otherwise, the notification callback will be called again and we may easily + * enter an infinite loop. */ + client_initialize(client); + return 1; /* sent and stopped. */ } int sd_dhcp_client_send_decline(sd_dhcp_client *client) { |