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 <ansuelsmth@gmail.com>
(cherry picked from commit 6c9a6c334e)
This commit is contained in:
Ansuel Smith 2020-10-08 02:43:29 +02:00 committed by Jo-Philipp Wich
parent 9eb2efd141
commit 7b931da477

View file

@ -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(