[Dnsmasq-discuss] [PATCH] Do not shorten a host's infinite lease to the client's requested time

Dominik Derigs dl6er at dl6er.de
Sun Aug 9 08:32:19 UTC 2026


Hi Simon,

a `dhcp-host` reservation with `infinite` silently ends up with a finite 
lease
as soon as the client sends option 51. calc_time() treats the configured 
lease
time as an upper bound, and `infinite` is an unbounded one, so whatever the
client asks for is shorter and wins. Apple devices request 7776000 
seconds in
every DHCPREQUEST, so every iPhone/iPad/Watch with a reservation is 
affected.

The attached patch honors `infinite` literally when it comes from 
`dhcp-host`:
for a reserved address there is nothing to be gained from expiring it early.
`dhcp-range` is left alone - there, granting a client's shorter request does
return pool addresses sooner.

Reproducer, with a client sending option 51 = 7776000 for its reserved 
address:

   dnsmasq -d --port=0 --dhcp-authoritative \
     --dhcp-range=10.99.0.100,10.99.0.200,255.255.255.0,1h \
     --dhcp-host=02:aa:bb:cc:dd:ee,10.99.0.9,testhost,infinite

The DHCPACK lease time is 7776000 before and 4294967295 with the patch. A
finite `dhcp-host` lease time and pool addresses behave exactly as 
before, in
both directions.

Downstream report: https://github.com/pi-hole/FTL/issues/3014

Best regards,
Dominik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Do-not-shorten-a-host-s-infinite-lease-to-the-client.patch
Type: text/x-patch
Size: 1958 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20260809/07fde92b/attachment.bin>


More information about the Dnsmasq-discuss mailing list