Merge pull request #16381 from yuwata/dhcp4-renewing

dhcp4: fixes around renewing address
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-07-07 08:59:35 +02:00 committed by GitHub
commit 9389a271b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -1441,7 +1441,10 @@ static int client_timeout_t1(sd_event_source *s, uint64_t usec, void *userdata)
sd_dhcp_client *client = userdata;
DHCP_CLIENT_DONT_DESTROY(client);
client->state = DHCP_STATE_RENEWING;
if (client->lease)
client->state = DHCP_STATE_RENEWING;
else if (client->state != DHCP_STATE_INIT)
client->state = DHCP_STATE_INIT_REBOOT;
client->attempt = 0;
return client_initialize_time_events(client);
@ -2012,6 +2015,9 @@ int sd_dhcp_client_send_renew(sd_dhcp_client *client) {
assert_return(client, -EINVAL);
assert_return(client->fd >= 0, -EINVAL);
if (IN_SET(client->state, DHCP_STATE_INIT, DHCP_STATE_INIT_REBOOT, DHCP_STATE_STOPPED))
return 0;
client->start_delay = 0;
client->attempt = 1;
client->state = DHCP_STATE_RENEWING;