diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-20 06:37:53 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-09-22 18:38:21 +0200 |
commit | 2ff1e23036b9496b86302f3279a8ccf21d331ff4 (patch) | |
tree | f1f4d046e9bbe0e5d20231e703b6ef3c801ffa71 /src/libsystemd-network/sd-dhcp-client.c | |
parent | sd-dhcp-client: split out client_enter_bound() (diff) | |
download | systemd-2ff1e23036b9496b86302f3279a8ccf21d331ff4.tar.xz systemd-2ff1e23036b9496b86302f3279a8ccf21d331ff4.zip |
sd-dhcp-client: split out client_enter_requesting()
No functional change, just refactoring and preparation for later
commits.
Diffstat (limited to '')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-client.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c index 1bd5315c8a..03e7c72842 100644 --- a/src/libsystemd-network/sd-dhcp-client.c +++ b/src/libsystemd-network/sd-dhcp-client.c @@ -1598,6 +1598,20 @@ static int client_handle_offer(sd_dhcp_client *client, DHCPMessage *offer, size_ return 0; } +static int client_enter_requesting(sd_dhcp_client *client) { + assert(client); + + client_set_state(client, DHCP_STATE_REQUESTING); + client->attempt = 0; + + return event_reset_time_relative(client->event, &client->timeout_resend, + CLOCK_BOOTTIME, + 0, 0, + client_timeout_resend, client, + client->event_priority, "dhcp4-resend-timer", + /* force_reset = */ true); +} + static int client_handle_forcerenew(sd_dhcp_client *client, DHCPMessage *force, size_t len) { int r; @@ -1854,14 +1868,7 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message, i if (r < 0) goto error; - client_set_state(client, DHCP_STATE_REQUESTING); - client->attempt = 0; - - r = event_reset_time(client->event, &client->timeout_resend, - CLOCK_BOOTTIME, - 0, 0, - client_timeout_resend, client, - client->event_priority, "dhcp4-resend-timer", true); + r = client_enter_requesting(client); break; case DHCP_STATE_REBOOTING: |