luci-mod-admin-full: allow a wider range of DSL SNR margins
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_network / dhcp.lua
index f418ecb..0c01cef 100644 (file)
@@ -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("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
 mac.datatype = "list(macaddr)"
 mac.rmempty  = true
@@ -286,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)