]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-dhcp-client: only send RENEW message when the client is in bound state
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 19 Oct 2023 15:01:15 +0000 (00:01 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Oct 2023 16:54:08 +0000 (01:54 +0900)
Fixes an issue reported at
https://github.com/systemd/systemd/pull/29544#issuecomment-1762742561.

src/libsystemd-network/sd-dhcp-client.c

index 6c08d2896226560e64e95291eaa61e856280d665..7e3690893710937dfbd0f295d56f0f4f593effab 100644 (file)
@@ -2161,9 +2161,11 @@ int sd_dhcp_client_send_renew(sd_dhcp_client *client) {
         assert_return(sd_dhcp_client_is_running(client), -ESTALE);
         assert_return(client->fd >= 0, -EINVAL);
 
-        if (!client->lease)
+        if (client->state != DHCP_STATE_BOUND)
                 return 0;
 
+        assert(client->lease);
+
         client->start_delay = 0;
         client->attempt = 1;
         client_set_state(client, DHCP_STATE_RENEWING);