From 761c2cda5f098dcb263f788cb965b000f0ebd6c1 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Mon, 23 Mar 2026 19:10:01 +0100 Subject: [PATCH] luci-mod-network: tighten MAC check regex dnsmasq behaviour changed slightly and MACs separated by hyphen are no longer accepted. Accept only colon separator when validating. Also enforce hex doublets, i.e. 00 instead of 0. Signed-off-by: Paul Donald --- .../htdocs/luci-static/resources/view/network/dhcp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js index 18b82dadff..d4774bbadd 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js @@ -201,7 +201,7 @@ function isValidMAC(sid, s) { if (!s) return true; for (const mac of L.toArray(s)) - if (!mac.match(/^(([0-9a-f]{1,2}|\*)[:-]){5}([0-9a-f]{1,2}|\*)$/i)) + if (!mac.match(/^(([0-9a-f]{2}|\*):){5}([0-9a-f]{2}|\*)$/i)) return _('Expecting a valid MAC address, optionally including wildcards') + _('; invalid MAC: ') + mac; return true;