the client reverts to INIT state and restarts the initialization process */
if (client->request_attempt >= client->max_request_attempts) {
log_dhcp_client(client, "Max REQUEST attempts reached. Restarting...");
- client_restart(client);
- return 0;
+ r = client_restart(client);
+ if (r >= 0)
+ return 0;
}
client_stop(client, r);
static int client_timeout_expire(sd_event_source *s, uint64_t usec, void *userdata) {
sd_dhcp_client *client = userdata;
DHCP_CLIENT_DONT_DESTROY(client);
+ int r;
log_dhcp_client(client, "EXPIRED");
/* lease was lost, start over if not freed or stopped in callback */
if (client->state != DHCP_STATE_STOPPED) {
client_initialize(client);
- client_start(client);
+
+ r = client_start(client);
+ if (r < 0) {
+ client_stop(client, r);
+ return 0;
+ }
}
return 0;