summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-network/sd-dhcp-client.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-10-19 17:01:15 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-10-20 18:54:08 +0200
commitdab96fed0cfbe0c475b64837affe3da2d69e5764 (patch)
tree2d9f03b41dd047526316e70882902337fdcd5130 /src/libsystemd-network/sd-dhcp-client.c
parentsd-dhcp-client: simplify the condition in sd_dhcp_client_get_lease() (diff)
downloadsystemd-dab96fed0cfbe0c475b64837affe3da2d69e5764.tar.xz
systemd-dab96fed0cfbe0c475b64837affe3da2d69e5764.zip
sd-dhcp-client: only send RENEW message when the client is in bound state
Fixes an issue reported at https://github.com/systemd/systemd/pull/29544#issuecomment-1762742561.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-client.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 6c08d28962..7e36908937 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -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);