summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full/luasrc
diff options
context:
space:
mode:
authorJan Pavlinec <jan.pavlinec@nic.cz>2017-02-08 12:54:04 +0100
committerJo-Philipp Wich <jo@mein.io>2017-11-10 13:00:26 +0100
commit37f4a3b90c56fea8d06833092ce6a5e2e2c2d1d1 (patch)
tree728e1b3dc5c7625f68279ece6e54c7fe09cd6620 /modules/luci-mod-admin-full/luasrc
parent6b2ad7958ebc718c25a02bb589ed2f379c9bb7fc (diff)
luci-mod-admin-full: add DUID option to static leases section
Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz> [add field validation] 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.lua13
1 files changed, 13 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 c7d330e68..0c01ceffc 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
@@ -296,6 +296,19 @@ ip.datatype = "or(ip4addr,'ignore')"
time = s:option(Value, "leasetime", translate("Lease time"))
time.rmempty = true
+duid = s:option(Value, "duid", translate("<abbr title=\"The DHCP Unique Identifier\">DUID</abbr>"))
+duid.datatype = "and(rangelength(28,36),hexstring)"
+fp = io.open("/var/hosts/odhcpd")
+if fp then
+ for line in fp:lines() do
+ local net_val, duid_val = string.match(line, "# (%S+)%s+(%S+)")
+ if duid_val then
+ duid:value(duid_val, duid_val)
+ end
+ end
+ fp:close()
+end
+
hostid = s:option(Value, "hostid", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Suffix (hex)"))
ipc.neighbors({ family = 4 }, function(n)