[Dnsmasq-discuss] [PATCH] Create temporary leases for DHCPOFFER actions

Petr Menšík pemensik at redhat.com
Fri Jul 8 20:26:35 UTC 2022


Hi!

I have already described similar problem back in year 2021 [1]. There 
exists race condition when higher count of clients starts at similar 
time and requests DHCP(v4). First two patches were already sent. I think 
I have sent also following patches already, but were not able to find them.

Anyway, some DHCP clients tend to handle badly situation, where dnsmasq 
first offers them some address. Then later in the process it realizes 
such address were offered also to someone else and denies acking it. We 
already have a workaround merged for IPv6 case, where it will ack 
instead different address. I think it would be nice also for IPv6 the 
same way, but I think it is not as urgent as for IPv4.

I have created a kind of half-lease. When it offers someone address, it 
makes it reserved for that address. That should prevent unnecessary race 
during startup, where some clients tend to receive NACK. When client 
continues with DHCPREQUEST, it converts a temporary lease to a permanent 
lease, which is then stored into lease file.

It solves a race in case more clients requests address than addresses on 
such network are available. When there are the same amount of temporary 
leases and remaining addresses, it reuses random temporary lease. Of 
course in such situation a failures are unavoidable. But I think it 
should attempt do the best available.

I am attaching also setup.sh, which I used to emulate starting multiple 
clients at similar time. I configured dnsmasq listening on virbr1 device 
and offering addresses. Then run that script as root and record 
communication in wireshark. Unlike current situation, there should not 
be any NACKs present. Even though ISC dhclient handles NACK well and is 
able to retry, unlike some netbooting firmware, which fails the boot in 
such situation.

Comments or testing would be welcome.

This is tracked on redhat bug #2028704 [2]. I have pushed those commits 
also to dhcp-temp-leases branch in github [3].

1. 
https://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2021q4/015982.html
2. https://bugzilla.redhat.com/show_bug.cgi?id=2028704
3. https://github.com/InfrastructureServices/dnsmasq/tree/dhcp-temp-leases
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-icmp-ping-hash-also-when-pinging-requested-addre.patch
Type: text/x-patch
Size: 3304 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Simplify-ICMP-ping-from-dhcp.patch
Type: text/x-patch
Size: 3900 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Create-temporary-leases-on-DISCOVER-message.patch
Type: text/x-patch
Size: 8441 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Reuse-temporary-leases-if-no-free-address-remains.patch
Type: text/x-patch
Size: 10315 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Ensure-temporary-leases-are-ignored-on-save.patch
Type: text/x-patch
Size: 10106 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0011.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Handle-case-when-temporary-lease-is-from-different-s.patch
Type: text/x-patch
Size: 4610 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0012.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup.sh
Type: application/x-shellscript
Size: 921 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20220708/8a12ec5e/attachment-0013.bin>


More information about the Dnsmasq-discuss mailing list