summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authordanrl <mail@danrl.com>2017-02-24 15:03:11 +0100
committerdanrl <mail@danrl.com>2017-02-27 20:48:46 +0100
commitcd8333cf0b90c6498366c993f8135dbd29cd6000 (patch)
tree229557137a0c6ad13306fddb54f8db1da30f3db3 /modules/luci-base/luasrc
parent09353ff64059b82f5ce2fab330a036e448b4a075 (diff)
luci-proto-wireguard: add support for fwmark option
Adds support for the fwmark option. FwMark is a 32-bit fwmark for outgoing packets. If set to 0 or "off", this option is disabled. Signed-off-by: Dan Luedtke <mail@danrl.com>
Diffstat (limited to 'modules/luci-base/luasrc')
-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)