Skip to content

Commit b4ed597

Browse files
pabigotjukkar
authored andcommitted
net: dhcp: fix timeout on entry to bound state
When a renewal occurs the client enters RENEWING, sends a request, then sets a short timeout (about 4 s) for the response. In the common case the response will arrive immediately, which will trigger an attempt to reset the timer with T1 which is generally large. However the check for updating the timer performs the update only if the new deadline is closer than the currently set one. Thus the timer fires at the time the RENEWING request would have been retransmitted, and only then updates to the correct deadline (T1) for the current machine state. Remove the extra timeout by unconditionally setting the timeout to the new value. This works when there is one interface; it could be wrong if there were multiple interfaces one of which had a closer deadline, but multiple interfaces are mishandled anyway and will be fixed next. Signed-off-by: Peter Bigot <[email protected]>
1 parent 6518342 commit b4ed597

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

subsys/net/ip/dhcpv4.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,7 @@ static uint32_t dhcpv4_send_discover(struct net_if *iface)
421421

422422
static void dhcpv4_update_timeout_work(uint32_t timeout)
423423
{
424-
if (!k_delayed_work_remaining_get(&timeout_work) ||
425-
(MSEC_PER_SEC * timeout) <
426-
k_delayed_work_remaining_get(&timeout_work)) {
427-
k_delayed_work_cancel(&timeout_work);
428-
k_delayed_work_submit(&timeout_work, K_SECONDS(timeout));
429-
}
424+
k_delayed_work_submit(&timeout_work, K_SECONDS(timeout));
430425
}
431426

432427
static void dhcpv4_enter_selecting(struct net_if *iface)

0 commit comments

Comments
 (0)