summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2017-08-21 21:54:14 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2017-08-22 20:19:49 +0800
commit54c1772ad90557a111b33d01348dbd32b6377af1 (patch)
tree97372114f4bcb32da2a050af1210820c2e3904d8 /applications/luci-app-shadowsocks-libev
parent3809bd6ffb5b2da8c1988bc7e9d6bec7dbf3efe8 (diff)
luci-app-shadowsocks-libev: validate elements of src, dst ip/net list
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'applications/luci-app-shadowsocks-libev')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
index 998579017..83e16982f 100644
--- a/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
+++ b/applications/luci-app-shadowsocks-libev/luasrc/model/cbi/shadowsocks-libev/rules.lua
@@ -22,6 +22,11 @@ if not sdata then
m:set('ss_rules', 'disabled', true)
end
+function src_dst_option(s, ...)
+ local o = s:taboption(...)
+ o.datatype = "or(ip4addr,cidr4)"
+end
+
s = m:section(NamedSection, "ss_rules", "ss_rules")
s:tab("general", translate("General Settings"))
s:tab("srcip", translate("Source Settings"))
@@ -49,13 +54,13 @@ s:taboption('general', Value, "ipt_args",
translate("Extra arguments"),
translate("Passes additional arguments to iptables. Use with care!"))
-s:taboption('srcip', DynamicList, "src_ips_bypass",
+src_dst_option(s, 'srcip', DynamicList, "src_ips_bypass",
translate("Src ip bypass"),
translate("Bypass redir action for packets with source addresses in this list"))
-s:taboption('srcip', DynamicList, "src_ips_forward",
+src_dst_option(s, 'srcip', DynamicList, "src_ips_forward",
translate("Src ip forward"),
translate("Go through redir action for packets with source addresses in this list"))
-s:taboption('srcip', DynamicList, "src_ips_checkdst",
+src_dst_option(s, 'srcip', DynamicList, "src_ips_checkdst",
translate("Src ip checkdst"),
translate("Continue to have dst address checked for packets with source addresses in this list"))
o = s:taboption('srcip', ListValue, "src_default",
@@ -63,10 +68,10 @@ o = s:taboption('srcip', ListValue, "src_default",
translate("Default action for packets whose source addresses do not match any of the source ip list"))
ss.values_actions(o)
-s:taboption('dstip', DynamicList, "dst_ips_bypass",
+src_dst_option(s, 'dstip', DynamicList, "dst_ips_bypass",
translate("Dst ip bypass"),
translate("Bypass redir action for packets with destination addresses in this list"))
-s:taboption('dstip', DynamicList, "dst_ips_forward",
+src_dst_option(s, 'dstip', DynamicList, "dst_ips_forward",
translate("Dst ip forward"),
translate("Go through redir action for packets with destination addresses in this list"))