dhcpcd-discuss

RE: Extending a lease when dhcp server is offline (similar to lastleaseextend)

Matthew Clarkson

Fri Aug 28 20:59:34 2020

Hi Roy,
Thanks for replying so quickly, especially if you're on vacation.

With this info, I looked into this a bit more. Looks like there are periodic, directed requests starting at 1/2 the original lease time. Then at about 87% of the original lease time there are broadcast requests. It would be nice to be able to shorten the time until the broadcasts.

The current behaviour is actually:
192.168.10.18 -> 255.255.255.255 DHCP Request
<no response>
<1 hour later (1/2 lease time)>
192.168.10.18 -> server IP DHCP request
<repeat until 87.5% of lease time>
192.168.10.18 -> 255.255.255.255 DHCP request
<full lease time later>
0.0.0.0 -> 255.255.255.255 DHCP Request

I have attached a pcap file showing this with:
- the server at MAC 00:24:1d:7d:60:74 (lease time is configured to be 10 minutes)
- the client running dhcpcd at MAC 00:02:d9:1f:ff:ff

Thanks again.

-----Original Message-----
From: Roy Marples <roy@xxxxxxxxxxxx> 
Sent: Friday, August 28, 2020 2:54 AM
To: Matthew Clarkson <mclarkson@xxxxxxxxxxxxxxxxxxxx>; dhcpcd-discuss@xxxxxxxxxxxx
Subject: Re: Extending a lease when dhcp server is offline (similar to lastleaseextend)

Hi Mathew

On 28/08/2020 01:05, Matthew Clarkson wrote:
> Hello,
> 
> We are looking at using this dhcpcd project as the dhcp client in a 
> new product, and we are trying to match the behaviour of an older 
> client in an older product. The version we are looking at is 8.1.9.
> 
> The specific case we are looking at is when the dhcp server goes 
> offline. We would like to see the device attempt to rediscover and if 
> the server doesn't respond then bind to the previous address for a 
> short period of time, and repeat until the server is back.
> 
> As I understand, this is similar to -lastleaseextend except that 
> lastleaseextend is using the full lease time of the last received lease.
> The concern is that if the server is offline temporarily or moved, 
> maybe to change the ip subnet, then it could take a long time for the 
> device to resync.
> 
> As an example, if the device previously received a lease for
> 192.168.10.18 (leasetime 2 hours) and on the next rebind attempt the 
> device would look like:
> 
> <server offline>
> 
> 192.168.10.18 -> 255.255.255.255 DHCP Request
> 
> <no response>
> 
> 0.0.0.0-> 255.255.255.255 DHCP Discover
> 
> <no response>
> 
> <2 minutes later>
> 
> 0.0.0.0-> 255.255.255.255 DHCP Discover
> 
> <repeat>
> 
> Instead it looks like:
> 
> 192.168.10.18 -> 255.255.255.255 DHCP Request
> 
> <no response>
> 
> <2 hour later>
> 
> 0.0.0.0 -> 255.255.255.255 DHCP Request
> 
> Is there another option which will behave as we are expecting, or are 
> there options to modify the behaviour of lastleaseextend (such as 
> setting a shorter lease time for the extension)?

Looks like a bug to me.
With lastlease and lastleaseextend there is still supposed to be periodic DHCP requests upto a maximum of 60 seconds + ramdomisation intervals.

I'm currenty on holiday and have a small backlog of issues to work through, but I'll try and give a better answer with a patch sometime next week.

Roy

Attachment: dhcpcd-no-server-response.pcapng
Description: dhcpcd-no-server-response.pcapng


Follow-Ups:
Re: Extending a lease when dhcp server is offline (similar to lastleaseextend)Roy Marples
References:
Extending a lease when dhcp server is offline (similar to lastleaseextend)Matthew Clarkson
Re: Extending a lease when dhcp server is offline (similar to lastleaseextend)Roy Marples
Archive administrator: postmaster@marples.name