summaryrefslogtreecommitdiffhomepage
path: root/applications
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2019-01-22 17:51:28 +0200
committerGitHub <noreply@github.com>2019-01-22 17:51:28 +0200
commit61b9f7af8f3b788e5e01e61949799848a94e0670 (patch)
tree66f8ead765499c27073b9a7ae88854336edf41d6 /applications
parent4e4fd206c86e7170332e5f46e3ef4b9711f9beb6 (diff)
parentf229dea746f9b404ebe61434ef355842a56aaf39 (diff)
Merge pull request #2476 from TDT-AG/pr/20190122-luci-app-mwan3
luci-app-mwan3: add syslog option and prefiil ipset rule dropdown
Diffstat (limited to 'applications')
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua23
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua11
2 files changed, 32 insertions, 2 deletions
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua
index f54b6e76c3..b71c2886a1 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/globalsconfig.lua
@@ -3,7 +3,7 @@
local net = require "luci.model.network".init()
-local s, m, mask, rtmon, rtlookup
+local s, m, mask, rtmon, rtlookup, logging, loglevel
m = Map("mwan3", translate("MWAN - Globals"))
@@ -17,6 +17,27 @@ mask = s:option(
mask.datatype = "hex(4)"
mask.default = "0xff00"
+logging = s:option(Flag,
+ "logging",
+ translate("Logging"),
+ translate("Enables global firewall logging"))
+
+loglevel = s:option(
+ ListValue,
+ "loglevel",
+ translate("Loglevel"),
+ translate("Firewall loglevel"))
+loglevel.default = "notice"
+loglevel:value("emerg", translate("Emergency"))
+loglevel:value("alert", translate("Alert"))
+loglevel:value("crit", translate("Critical"))
+loglevel:value("error", translate("Error"))
+loglevel:value("warning", translate("Warning"))
+loglevel:value("notice", translate("Notice"))
+loglevel:value("info", translate("Info"))
+loglevel:value("debug", translate("Debug"))
+loglevel:depends("logging", "1")
+
rtmon = s:option(
Value,
"rtmon_interval",
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua
index 51592f8137..3643e37ec5 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/ruleconfig.lua
@@ -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",