Merge pull request #2476 from TDT-AG/pr/20190122-luci-app-mwan3
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / ruleconfig.lua
index 51592f8137a98a4fa1cb5b62f31c0a944c04f439..3643e37ec58065f21b8705f3d1c47abf7cdb3aef 100644 (file)
@@ -3,12 +3,15 @@
 -- Licensed to the public under the GNU General Public License v2.
 
 local dsp = require "luci.dispatcher"
+local util   = require("luci.util")
 
 local m, mwan_rule, src_ip, src_port, dest_ip, dest_port, proto, sticky
-local timeout, ipset, policy
+local timeout, ipset, logging, policy
 
 arg[1] = arg[1] or ""
 
+local ipsets = util.split(util.trim(util.exec("ipset -n -L 2>/dev/null | grep -v mwan3_ | sort")), "\n", nil, true) or {}
+
 m = Map("mwan3", translatef("MWAN Rule Configuration - %s", arg[1]))
 m.redirect = dsp.build_url("admin", "network", "mwan", "rule")
 
@@ -52,6 +55,12 @@ timeout.datatype = "range(1, 1000000)"
 
 ipset = mwan_rule:option(Value, "ipset", translate("IPset"),
        translate("Name of IPset rule. Requires IPset rule in /etc/dnsmasq.conf (eg \"ipset=/youtube.com/youtube\")"))
+for _, z in ipairs(ipsets) do
+       ipset:value(z)
+end
+
+logging = mwan_rule:option(Flag, "logging", translate("Logging"),
+       translate("Enables firewall rule logging (global mwan3 logging must also be enabled)"))
 
 policy = mwan_rule:option(Value, "use_policy", translate("Policy assigned"))
 m.uci:foreach("mwan3", "policy",