diff options
author | Florian Eckert <fe@dev.tdt.de> | 2021-03-17 08:55:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-17 08:55:09 +0100 |
commit | 811225156a2a175cad5af850d6b49f2164093488 (patch) | |
tree | 78a45ab571a21ab0bb3cbebf0efd4b6f74a3cd8f /modules/luci-mod-network/htdocs/luci-static/resources | |
parent | 153ec5f46b5a39d0719fdb4eaf4e6fd3530fc26c (diff) | |
parent | 463e910119813aaea0755ff5c16c91ce412a8cbb (diff) |
Merge pull request #4709 from opastushkov/dnsmasq_crash_on_duplication_of_static_ip
luci-mod-network: issue with breakdown of dnsmasq after duplication o…
Diffstat (limited to 'modules/luci-mod-network/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js | 19 |
1 files changed, 19 insertions, 0 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 c2a77f2b0c..253b37b846 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 @@ -469,6 +469,25 @@ return view.extend({ so.value(mac, hint ? '%s (%s)'.format(mac, hint) : mac); }); + so.write = function(section, value) { + var ip = this.map.lookupOption('ip', section)[0].formvalue(section); + var hosts = uci.sections('dhcp', 'host'); + var section_removed = false; + + for (var i = 0; i < hosts.length; i++) { + if (ip == hosts[i].ip) { + uci.set('dhcp', hosts[i]['.name'], 'mac', [hosts[i].mac, value].join(' ')); + uci.remove('dhcp', section); + section_removed = true; + break; + } + } + + if (!section_removed) { + uci.set('dhcp', section, 'mac', value); + } + } + so = ss.option(form.Value, 'ip', _('<abbr title="Internet Protocol Version 4">IPv4</abbr>-Address')); so.datatype = 'or(ip4addr,"ignore")'; so.validate = function(section, value) { |