luci-app-shadowsocks-libev: fix cidr datatype

* add a new 'cidr' alias datatype to fix #2671

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2019-04-23 15:42:53 +02:00
parent 8d839ddfb8
commit 8fffadecc5
No known key found for this signature in database
GPG key ID: 9D71CD547BFAE684

View file

@ -132,6 +132,10 @@ function ip6prefix(val)
return ( val and val >= 0 and val <= 128 )
end
function cidr(val)
return cidr4(val) or cidr6(val)
end
function cidr4(val)
local ip, mask = val:match("^([^/]+)/([^/]+)$")