Re: [PATCH] dhcp: fix overflow causing retries to stop

James Prestwood <[email protected]> Tue, 9 Jan 2024 04:18:09 -0800
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Hi Denis,

On 1/8/24 8:27 PM, Denis Kenzior wrote:
> Hi James,
>
> On 1/8/24 22:06, 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.
>>
>> Since 5 attempts results in a value of 64 we can instead just limit
>> the attempts to 5, and set next_timeout to 64 after that as the spec
>> requires.
>
> Overflowing next_timeout implies that discovery is taking ~25 
> minutes?  I think I'd rather we gave up and sent a NO_LEASE event 
> after retries hits a certain max number?

Yep, this is whats happening, the DHCP server is down. Obviously we 
could change the logic, but NO_LEASE appears to just restart the DHCP 
client, i.e. no real difference between trying discovery forever. Should 
we add another event, L_DHCP_CLIENT_EVENT_TIMEOUT?

Thanks,

james

>
> Regards,
> -Denis