[1.2-RC3] A few small DHCP things
wago last edited by
Not sure if this is the right place to report these, but I found a couple small issues with the DHCP server UI when dealing with a DHCP cluster…
1. Consider the case where you have multiple internal subnets... say LAN and DMZ. In services_dhcp.php, it allows the user to enter any IP address for the failover peer. If you use the LAN failover IP when you configure the DMZ DHCP server, it will accept the value, but fail to configure it properly. Specifically, it will configure both sides as 'secondary'. I believe that this is due to the CARP interface discovery logic, but I could be wrong. It would help if this box asked for the "Failover IP on this subnet", or perhaps even checked the user input to make sure it's on the same subnet.
2. In diag_dhcp_leases.php, it uses the remove_duplicate() function to de-duplicate DHCP messages. When it de-duplicates the failover peers, it picks the first message in dhcpd.leases for failover peer, instead of the most recent message. This is because the remove_duplicate() function uses php's array_unique() function, which always de-dupes by returning the first match. The remove_duplicate() function should try to consider the timestamp of the dhcpd.leases entry, and return the most recent entry by timestamp.