[Dnsmasq-discuss] [PATCH] dhcp: add dhcp-hold-offered to reserve offered addresses briefly
Matthew Harkness
Matthew.Harkness at spacex.com
Thu Oct 1 18:30:46 UTC 2026
Hello,
I have run into an issue described in a couple previous threads:
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q4/015997.html
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2022q3/016526.html
As a summary, if two clients get served the same IP from dnsmasq DHCP, dnsmasq will serve a NAK to the second client. Good client software should just retry on this condition, but unfortunately getting served a NAK causes bugs in some PXE firmware.
I've attached a patch to add a new option: `dhcp-hold-offered`, which creates a short (30s) lease on a DHCP offer. I don't think it makes sense to change the behavior of dnsmasq unconditionally to get around this issue, as this is working around a bug in external software. This is a small update allowing users to have a workaround for this issue.
Here is some data of the lease file from testing (running `watch -n 1 cat /var/lib/misc/dnsmasq.leases`):
I see the initial short lease get created:
1790020329 {MAC1} {IP1} * *
The lease is respected, and the second server is given the next IP in range:
1790020333 {MAC2} {IP2} * *
1790020329 {MAC1} {IP1} * *
Both servers end up with their full lease (30m in this case):
1790022110 {MAC2} {IP2} * *
1790022110 {MAC1} {IP1} * *
Let me know if you can look at the patch. Here is the source commit:
https://thekelleys.org.uk/gitweb-noai/?p=dnsmasq.git;a=commit;h=ad9208358eadcf747619511ec8b98134bf85a5f3
Thanks,
Matt
Matthew.Harkness at spacex.com<mailto:Matthew.Harkness at spacex.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20261001/f34cda2e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dhcp-hold-offered.patch
Type: application/octet-stream
Size: 3993 bytes
Desc: dhcp-hold-offered.patch
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20261001/f34cda2e/attachment.obj>
More information about the Dnsmasq-discuss
mailing list