X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=modules%2Fadmin-full%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_network%2Fdhcp.lua;h=bd6f403c53002c9ed32e15d816a14a3a6af37d73;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hp=ceebe7cb53a4668b1c370187d462a47e595aaa46;hpb=706eb828ad51f862e7582c5fe5355e1c73475de1;p=project%2Fluci.git 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 ceebe7cb53..bd6f403c53 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/dhcp.lua @@ -86,7 +86,7 @@ s:taboption("advanced", Flag, "localise_queries", s:taboption("general", Value, "local", translate("Local server"), - translate("Local domain specification. Names matching this domain are never forwared and resolved from DHCP or hosts files only")) + translate("Local domain specification. Names matching this domain are never forwarded and are resolved from DHCP or hosts files only")) s:taboption("general", Value, "domain", translate("Local domain"), @@ -178,7 +178,7 @@ lm.placeholder = translate("unlimited") em = s:taboption("advanced", Value, "ednspacket_max", translate("Max. EDNS0 paket size"), + "Domain Name System\">EDNS0 packet size"), translate("Maximum allowed size of EDNS.0 UDP packets")) em.optional = true @@ -236,9 +236,12 @@ name.rmempty = true mac = s:option(Value, "mac", translate("MAC-Address")) mac.datatype = "list(macaddr)" +mac.rmempty = true ip = s:option(Value, "ip", translate("IPv4-Address")) -ip.datatype = "ip4addr" +ip.datatype = "or(ip4addr,'ignore')" + +hostid = s:option(Value, "hostid", translate("IPv6-Suffix (hex)")) sys.net.arptable(function(entry) ip:value(entry["IP address"]) @@ -248,5 +251,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