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 074bfbc71bf7..c78738b9cca3 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 @@ -913,7 +913,8 @@ return view.extend({ uci.unset('dhcp', section, 'dns'); }; - so = ss.option(form.Value, 'mac', + //this can be a .DynamicList or a .Value with a widget and dnsmasq handles multimac OK. + so = ss.option(form.DynamicList, 'mac', _('MAC address(es)'), _('The hardware address(es) of this entry/host.') + '

' + _('In DHCPv4, it is possible to include more than one mac address. This allows an IP address to be associated with multiple macaddrs, and dnsmasq abandons a DHCP lease to one of the macaddrs when another asks for a lease. It only works reliably if only one of the macaddrs is active at any time.')); @@ -923,30 +924,7 @@ return view.extend({ var macs = L.toArray(uci.get('dhcp', section, 'mac')); return expandAndFormatMAC(macs); }; - so.renderWidget = function(section_id, option_index, cfgvalue) { - var node = form.Value.prototype.renderWidget.apply(this, [section_id, option_index, cfgvalue]), - ipopt = this.section.children.filter(function(o) { return o.option == 'ip' })[0]; - - node.addEventListener('cbi-dropdown-change', L.bind(function(ipopt, section_id, ev) { - var mac = ev.detail.value.value; - if (mac == null || mac == '' || !hosts[mac]) - return; - - var iphint = L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0]; - if (iphint == null) - return; - - var ip = ipopt.formvalue(section_id); - if (ip != null && ip != '') - return; - - var node = ipopt.map.findElement('id', ipopt.cbid(section_id)); - if (node) - dom.callClassMethod(node, 'setValue', iphint); - }, this, ipopt, section_id)); - - return node; - }; + //removed jows renderwidget function which hindered multi-mac entry so.validate = validateMACAddr.bind(so, pools); Object.keys(hosts).forEach(function(mac) { var hint = hosts[mac].name || L.toArray(hosts[mac].ipaddrs || hosts[mac].ipv4)[0];