Merge pull request #1039 from danrl/luci-proto-wireguard

luci-proto-wireguard: add support for fwmark option
This commit is contained in:
Hannu Nyman 2017-02-27 21:50:52 +02:00 committed by GitHub
commit be8b920a2e
2 changed files with 24 additions and 4 deletions

View file

@ -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)

View file

@ -85,6 +85,18 @@ preshared_key.datatype = "and(base64,rangelength(44, 44))"
preshared_key.optional = true
fwmark = section:taboption(
"advanced",
Value,
"fwmark",
translate("Firewall Mark"),
translate("Optional. 32-bit mark for outgoing encrypted packets. " ..
"Enter value in hex, starting with <code>0x</code>.")
)
fwmark.datatype = "hex(4)"
fwmark.optional = true
-- peers -----------------------------------------------------------------------
peers = map:section(