From: Yu Watanabe Date: Thu, 19 Oct 2023 15:01:15 +0000 (+0900) Subject: sd-dhcp-client: only send RENEW message when the client is in bound state X-Git-Tag: v255-rc1~161^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dab96fed0cfbe0c475b64837affe3da2d69e5764;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 6c08d289622..7e369089371 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);