From 7b931da4779c68f5aef5908286c2ae5283d2dece Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Thu, 8 Oct 2020 02:43:29 +0200 Subject: [PATCH] luci-mod-network: handle multiple mac for static lease The mac section for the static lease doesn't correctly handle when multiple mac are set for a rule. Fixes: #4291 Signed-off-by: Ansuel Smith (cherry picked from commit 6c9a6c334e2fa55f4b64b64b85e0b104f0b99037) --- .../htdocs/luci-static/resources/view/network/dhcp.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 6693dc0eac..886271b13d 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 @@ -425,12 +425,9 @@ return view.extend({ so.datatype = 'list(unique(macaddr))'; so.rmempty = true; so.cfgvalue = function(section) { - var macs = uci.get('dhcp', section, 'mac'), + var macs = L.toArray(uci.get('dhcp', section, 'mac')), result = []; - if (!Array.isArray(macs)) - macs = (macs != null && macs != '') ? macs.split(/\ss+/) : []; - for (var i = 0, mac; (mac = macs[i]) != null; i++) if (/^([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2}):([0-9a-fA-F]{1,2})$/.test(mac)) result.push('%02X:%02X:%02X:%02X:%02X:%02X'.format( -- 2.30.2