X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Fcbi%2Fdatatypes.lua;h=52f90afee675488cf1eb19557264ed77a9716f5a;hp=ebd7e594f7a13ee630f089861656366e66aa6713;hb=9b30357454ea53a9f1d7e82d8f894db5f409de98;hpb=ea9f25b63ee0d9a380cf74c65061c3977cad3b2f;ds=inline diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua index ebd7e594f..52f90afee 100644 --- a/modules/luci-base/luasrc/cbi/datatypes.lua +++ b/modules/luci-base/luasrc/cbi/datatypes.lua @@ -184,6 +184,16 @@ function network(val) return uciname(val) or host(val) end +function hostport(val) + local h, p = val:match("^([^:]+):([^:]+)$") + return not not (h and p and host(h) and port(p)) +end + +function ipaddrport(val) + local h, p = val:match("^([^:]+):([^:]+)$") + return not not (h and p and ipaddr(h) and port(p)) +end + function wpakey(val) if #val == 64 then return (val:match("^[a-fA-F0-9]+$") ~= nil)