From a9e8376c20f386c030e8b004e1245fa220173773 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 2 Jun 2017 01:00:12 +0200 Subject: [PATCH] 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 --- .../luasrc/model/cbi/admin_network/dhcp.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 f418ecb40..c7d330e68 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 @@ -276,6 +276,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("MAC-Address")) mac.datatype = "list(macaddr)" mac.rmempty = true -- 2.11.0