openwrt/odhcpd

Bug: odhcp doesn't handle static lease (dhcp.@host[#]) entries with multiple MAC addresses

ktetzlaff opened this issue · 1 comments

In https://openwrt.org/docs/guide-user/base-system/dhcp#static_leases, OpenWrt defines the /mac/ option of a DHCP Static Lease as:

mac | string | no | (none) | The hardware address(es) of this host, separated by spaces.

This explicitly allows to define leases with multiple MAC addresses. However, /odhcpd/ skips such /leases/ during configuration.

Here's the code fragment which handles MAC addresses of static leases in set_lease(..) (found in config.c):

	if ((c = tb[LEASE_ATTR_MAC]))
		if (!ether_aton_r(blobmsg_get_string(c), &l->mac))
			goto err;

As can be seen, the code doesn't have any special handling for the multiple MAC case. So ether_aton_r(..) returns NULL which triggers goto err; and the lease doesn't make it into /leases/.

Just noticed that bugs should be reported in the main OpenWrt repo. So I created another issue: openwrt/openwrt#9598.