luci-mod-admin-full: fix incorrect length of DUID-LL
authorArjen de Korte <build+lede@de-korte.org>
Fri, 8 Dec 2017 09:55:18 +0000 (10:55 +0100)
committerJo-Philipp Wich <jo@mein.io>
Tue, 9 Jan 2018 07:08:55 +0000 (08:08 +0100)
The length of DUID-LL is 80 bits (16 bit DUID type, 16 bit hardware type, 48 bit mac)
which corresponds to 20 nibbles. Also lower the minimum required length of DUID to
20 nibbles in order to allow entering a DUID-LL.

Signed-off-by: Arjen de Korte <build+github@de-korte.org>
modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm
modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm

index 0c01cef..3ce0bc4 100644 (file)
@@ -297,7 +297,7 @@ 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)"
+duid.datatype = "and(rangelength(20,36),hexstring)"
 fp = io.open("/var/hosts/odhcpd")
 if fp then
        for line in fp:lines() do
index ea6ee91..28a37dc 100644 (file)
@@ -5,7 +5,7 @@
                        return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
 
                // DUID-LL / Ethernet
-               if (duid.length === 24 && duid.substr(0, 8) === '00030001')
+               if (duid.length === 20 && duid.substr(0, 8) === '00030001')
                        return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
 
                return null;
index 18f66c2..ff5e26d 100644 (file)
                        return duid.substr(16).replace(/(..)(?=..)/g, '$1:').toUpperCase();
 
                // DUID-LL / Ethernet
-               if (duid.length === 24 && duid.substr(0, 8) === '00030001')
+               if (duid.length === 20 && duid.substr(0, 8) === '00030001')
                        return duid.substr(8).replace(/(..)(?=..)/g, '$1:').toUpperCase();
 
                return null;