summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-02-27 21:50:52 +0200
committerGitHub <noreply@github.com>2017-02-27 21:50:52 +0200
commitbe8b920a2eae8c41999ad4f315931b7a6b5624b5 (patch)
treea321df359f4542735fc6c394c430754e69b6bb80 /modules
parent829344d6767a2a9b5a1ee12cc0c0de5bbc2e7748 (diff)
parentcd8333cf0b90c6498366c993f8135dbd29cd6000 (diff)
Merge pull request #1039 from danrl/luci-proto-wireguard
luci-proto-wireguard: add support for fwmark option
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/luasrc/cbi/datatypes.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/cbi/datatypes.lua b/modules/luci-base/luasrc/cbi/datatypes.lua
index 62b0e0f617..cf56566287 100644
--- a/modules/luci-base/luasrc/cbi/datatypes.lua
+++ b/modules/luci-base/luasrc/cbi/datatypes.lua
@@ -283,6 +283,14 @@ function hexstring(val)
return false
end
+function hex(val, maxbytes)
+ maxbytes = tonumber(maxbytes)
+ if val and maxbytes ~= nil then
+ return ((val:match("^0x[a-fA-F0-9]+$") ~= nil) and (#val <= 2 + maxbytes * 2))
+ end
+ return false
+end
+
function base64(val)
if val then
return (val:match("^[a-zA-Z0-9/+]+=?=?$") ~= nil) and (math.fmod(#val, 4) == 0)