summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2017-06-02 01:00:12 +0200
committerJo-Philipp Wich <jo@mein.io>2017-06-02 01:03:07 +0200
commit7f6fc1681f7becc514a58082e871f3855d3a123f (patch)
tree77e84148c31dce4c157b441e6ce361e61f5e714c /modules/luci-mod-admin-full/luasrc
parenta6054eb38ac55702d17dda4963cb30789d3a6fc9 (diff)
luci-mod-admin-full: automatically set dns=1 for static leases with hostname
Most users likely want the hostname of a static DHCP lease to be resolveable, even if the corresponding host is currently offline. Adjust the form logic to automatically set 'option dns 1' whenever a name is specified in the static lease entry. FIxes LEDE FS#815. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc')
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index 10636a491a..9ccfd9b870 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -275,6 +275,16 @@ name = s:option(Value, "name", translate("Hostname"))
name.datatype = "hostname"
name.rmempty = true
+function name.write(self, section, value)
+ Value.write(self, section, value)
+ m:set(section, "dns", "1")
+end
+
+function name.remove(self, section)
+ Value.remove(self, section)
+ m:del(section, "dns")
+end
+
mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
mac.datatype = "list(macaddr)"
mac.rmempty = true