modules/admin-full: make mac addresses optional in static lease configuration
This commit is contained in:
parent
33d15b9422
commit
7a531b4add
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue