luci-mod-status: optional MAC for static lease
authorDavid Härdeman <[email protected]>
Mon, 17 Nov 2025 18:07:59 +0000 (19:07 +0100)
committerPaul Donald <[email protected]>
Tue, 18 Nov 2025 22:24:22 +0000 (23:24 +0100)
Note that we might not have a MAC address to set in case of a DHCPv6
lease when the DUID is of a type which isn't MAC-based.

Signed-off-by: David Härdeman <[email protected]>
modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/40_dhcp.js

index 9a82cc3d884af6aec7f9641550e01dad709d19a9..b7f84c66e04abd87cc7158f358f99bd4c4346411 100644 (file)
@@ -69,7 +69,8 @@ return baseclass.extend({
 
                uci.set('dhcp', cfg, 'name', lease.hostname);
                uci.set('dhcp', cfg, 'duid', [duid_iaid]);
-               uci.set('dhcp', cfg, 'mac', [lease.macaddr]);
+               if (lease.macaddr)
+                       uci.set('dhcp', cfg, 'mac', [lease.macaddr.toUpperCase()]);
                if (ip6arr)
                        uci.set('dhcp', cfg, 'hostid', (ip6arr[6] * 0xFFFF + ip6arr[7]).toString(16));