I've only got a single MiSTer so the duplicate MAC issue doesn't seem to show up here, I only see one MAC showing up on the port in my switch's MAC table. Poking around a bit I can see two sets of DHCP requests coming into dnsmasq from the MiSTer on startup which mirrors the information I see in both the current leases table and IP addresses on the device itself.
Code: Select all
user@router:~$ tail -f -n 0 /var/log/dnsmasq.log | grep -i 'b4:b0:24:29:08:21'
Aug 14 11:09:20 dnsmasq-dhcp[4826]: DHCPDISCOVER(bond0.10) b4:b0:24:29:08:21
Aug 14 11:09:20 dnsmasq-dhcp[4826]: DHCPOFFER(bond0.10) 192.168.10.65 b4:b0:24:29:08:21
Aug 14 11:09:20 dnsmasq-dhcp[4826]: DHCPREQUEST(bond0.10) 192.168.10.65 b4:b0:24:29:08:21
Aug 14 11:09:20 dnsmasq-dhcp[4826]: DHCPACK(bond0.10) 192.168.10.65 b4:b0:24:29:08:21
Aug 14 11:09:22 dnsmasq-dhcp[4826]: DHCPREQUEST(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 11:09:22 dnsmasq-dhcp[4826]: DHCPACK(bond0.10) 192.168.10.68 b4:b0:24:29:08:21 MiSTer
Aug 14 11:09:46 dnsmasq-dhcp[4826]: DHCPREQUEST(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 11:09:46 dnsmasq-dhcp[4826]: DHCPACK(bond0.10) 192.168.10.68 b4:b0:24:29:08:21 MiSTer
Separately, Wireshark is showing the first set of requests (sans hostname, for the .65 address) with a vendor class identifier of "udhcp". The second set of requests that come in don't include a vendor class identifier (they're from dhcpc), but they do include the hostname of "MiSTer"
as well as an IAID which is what's causing the double lease since DUID and DUID+IAID are considered unique clients in the eyes of the DHCP server. In this case, the DUID is the MAC address according to the flag in both sets of DHCP requests. The client identifier behavior is controlled in /etc/dhcpcd.conf (default configuration shown below):
Code: Select all
# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid
Given the use case of the MiSTer "duid" mode (DUID+IAID) isn't necessary, and on its own this wouldn't be a problem but it did lend itself to a viable albeit clumsy workaround for testing. As Akuma pointed out udhcpc wasn't completely disabled in the base image which is complicating things as again the client identifiers differ between the two sets of DHCP requests being made, leading to the double lease issue. This was likely introduced when the transition was made from udhcpc to dhcpc at least a year ago.
Related issues:
https://github.com/MiSTer-devel/Main_MiSTer/issues/448
https://github.com/MiSTer-devel/Linux-K ... /issues/29
To confirm my suspicions, I cleared the leases for the MiSTer from dnsmasq and flipped the client identifier configuration from "duid" to "clientid" in /etc/dhcpcd.conf. Now when starting up the MiSTer I only show one address in the wlan0 interface with the expected flags:
Code: Select all
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether b4:b0:24:29:08:21 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.68/24 brd 192.168.10.255 scope global dynamic noprefixroute wlan0
valid_lft 86170sec preferred_lft 75370sec
When watching dnsmasq logs I now see the same address offered for each request:
Code: Select all
user@router:/etc/dnsmasq.d$ tail -f -n 0 /var/log/dnsmasq.log | grep -i 'b4:b0:24:29:08:21'
Aug 14 13:25:06 dnsmasq-dhcp[30909]: DHCPDISCOVER(bond0.10) b4:b0:24:29:08:21
Aug 14 13:25:06 dnsmasq-dhcp[30909]: DHCPOFFER(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 13:25:06 dnsmasq-dhcp[30909]: DHCPREQUEST(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 13:25:06 dnsmasq-dhcp[30909]: DHCPACK(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 13:25:08 dnsmasq-dhcp[30909]: DHCPREQUEST(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 13:25:08 dnsmasq-dhcp[30909]: DHCPACK(bond0.10) 192.168.10.68 b4:b0:24:29:08:21 MiSTer
Aug 14 13:25:33 dnsmasq-dhcp[30909]: DHCPREQUEST(bond0.10) 192.168.10.68 b4:b0:24:29:08:21
Aug 14 13:25:33 dnsmasq-dhcp[30909]: DHCPACK(bond0.10) 192.168.10.68 b4:b0:24:29:08:21 MiSTer
There are still two sets of requests being made (one from udhcpc, and another from dhcpc), but at least this way there's only one client identifier provided to the DHCP server, and thus only one lease allocated which ultimately gets updated with the hostname once the dhcpc requests come in. Ideally this would be resolved by fully disabling udhcpc instead of changing the default behavior of dhcpc.