Re: [PATCH v3] dhcp: add settable max attempts, fix timeout overflow to zero

Denis Kenzior <[email protected]> Thu, 18 Jan 2024 21:14:04 -0600
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Hi James,

On 1/18/24 09:08, James Prestwood wrote:
> If DHCP is in a SELECTING/REQUESTING state and the number of attempts
> reached a value where 2 << attempts overflowed an unsigned int the
> next timeout would become zero, causing DHCP to never retry without
> any event notification.
> 
> The number of attempts will now be configurable, but limited to
> between 3 and 30 which prevents the bit shift from overflowing
> 'next_timeout' and provides some ultimate threshold where DHCP will
> fail instead of try indefinitely.
> 
> A new event was added (L_DHCP_CLIENT_EVENT_MAX_ATTEMPTS_REACHED) to
> notify netconfig of the situation. Netconfig will then send a failure
> event and the consumer can decide how to proceed.
> 
> Fixes: f130c448 ("dhcp: Introduce timeout fuzzing")
> ---
>   ell/dhcp.c      | 35 ++++++++++++++++++++++++++++++++---
>   ell/dhcp.h      |  3 +++
>   ell/ell.sym     |  1 +
>   ell/netconfig.c |  6 ++++++
>   4 files changed, 42 insertions(+), 3 deletions(-)
> 

Applied, thanks.

Regards,
-Denis