summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2019-04-23 15:42:53 +0200
committerDirk Brenken <dev@brenken.org>2019-04-23 16:57:05 +0200
commit8fffadecc5d8080a7381fd6d00e5b4e91a6fc6fd (patch)
treeed9a9d0dbb56bd42b5cd9471c69b02d67e921da9 /modules/luci-base/luasrc
parent8d839ddfb8f169c01e516e1a5b0c2e8de6948183 (diff)
luci-app-shadowsocks-libev: fix cidr datatype
* add a new 'cidr' alias datatype to fix #2671 Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/cbi/datatypes.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua
index b4206e98d..33d018d2d 100644
--- a/modules/luci-base/luasrc/cbi/datatypes.lua
+++ b/modules/luci-base/luasrc/cbi/datatypes.lua
@@ -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("^([^/]+)/([^/]+)$")