luci-mod-admin-full: canonicalize configured static lease MAC
authorJo-Philipp Wich <jo@mein.io>
Wed, 2 May 2018 14:52:37 +0000 (16:52 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 2 May 2018 14:55:22 +0000 (16:55 +0200)
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 <jo@mein.io>
modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua

index fbde431df8df7c5a67773adbd4ef43600095130e..3b030143e44007d639dc8fced20bc59e2676db5a 100644 (file)
@@ -297,6 +297,11 @@ mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">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("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
 ip.datatype = "or(ip4addr,'ignore')"