From 9adbd79faa8b2d50e92bd2fd6bc21aabe396591f Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 2 May 2018 16:52:37 +0200 Subject: [PATCH] luci-mod-admin-full: canonicalize configured static lease MAC When reading the configured mac address of the static lease, filter it through luci.ip.checkmac() to canonicalize and uppercase the value for mapping it against the combo box host hints. Fixes #1772. Signed-off-by: Jo-Philipp Wich --- .../luasrc/model/cbi/admin_network/dhcp.lua | 5 +++++ 1 file changed, 5 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 fbde431df..3b030143e 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 @@ -297,6 +297,11 @@ mac = s:option(Value, "mac", translate("MAC mac.datatype = "list(macaddr)" mac.rmempty = true +function mac.cfgvalue(self, section) + local val = Value.cfgvalue(self, section) + return ipc.checkmac(val) or val +end + ip = s:option(Value, "ip", translate("IPv4-Address")) ip.datatype = "or(ip4addr,'ignore')" -- 2.25.1