[PATCH] udhcpd: Do not pass out static leases to random clients

Ramsay, Lincoln Lincoln.Ramsay at digi.com
Thu Dec 3 05:39:11 UTC 2020


Hi,

Apologies if this arrives twice, I missed that you have to be subscribed to post, I'm assuming my first message went into /dev/null.

I have run into an interesting problem. We have a DHCP server that exists to serve a single address to a single client.

start 192.168.0.2
end 192.168.0.2
interface eth1
max_leases 1
lease_file /var/run/udhcpd.leases
option subnet 255.255.255.252
option router 50.50.50.50
option dns 123.50.50.128
option lease 60
static_lease 11:22:33:44:55:66 192.168.0.2

If machine 11:22:33:44:55:66 sends a DHCPDISCOVER it gets the address as expected.

If a different machine sends a DHCPDISCOVER, the server will not assign it an address because the only available address is attached to a static lease (or alternatively, because that address is already leased out).

However, if a different machine sends a DHCPDISCOVER with DHCP_REQUESTED_IP of 192.168.0.2, the server will happily allow it unless the address is already leased out.

The way we found this was by changing the MAC address in the server's config. We expected the old client to lose its lease but instead, it just kept on getting the address even though the server config indicates it should not.

The patch here will cause the server to ignore the DHCP_REQUESTED_IP in the event that it is a static lease for a different machine. The server will fall back to the available pool of addresses as if the DHCP_REQUESTED_IP was not included.

Lincoln
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-udhcpd-do-not-pass-out-static-leases.patch
Type: application/octet-stream
Size: 1172 bytes
Desc: 0001-udhcpd-do-not-pass-out-static-leases.patch
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20201203/ea88004b/attachment-0001.obj>


More information about the busybox mailing list