mirror of
https://github.com/openwrt/luci.git
synced 2026-06-17 14:50:21 +04:00
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 <newtwen+github@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user