summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-01-02 15:31:59 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-01-02 15:31:59 +0000
commit7a531b4add84d2d25a666e3e988a68ffa2149b6f (patch)
treeebf0f42d13e4677755bcfb287ab35cb8c3acb704
parent33d15b9422668984e47d3798444b2832bdc8c444 (diff)
modules/admin-full: make mac addresses optional in static lease configuration
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index bf8418f81..98f9d8ecf 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -236,6 +236,7 @@ name.rmempty = true
mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
mac.datatype = "list(macaddr)"
+mac.rmempty = true
ip = s:option(Value, "ip", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
ip.datatype = "ip4addr"
@@ -248,5 +249,14 @@ sys.net.arptable(function(entry)
)
end)
+function ip.validate(self, value, section)
+ local m = mac:formvalue(section) or ""
+ local n = name:formvalue(section) or ""
+ if value and #n == 0 and #m == 0 then
+ return nil, translate("One of hostname or mac address must be specified!")
+ end
+ return Value.validate(self, value, section)
+end
+
return m