luci-app-mwan3: Offer loaded ipsets as dropdown for ipset selection
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
a429bb47e7
commit
f229dea746
1 changed files with 6 additions and 0 deletions
|
@ -3,12 +3,15 @@
|
||||||
-- Licensed to the public under the GNU General Public License v2.
|
-- Licensed to the public under the GNU General Public License v2.
|
||||||
|
|
||||||
local dsp = require "luci.dispatcher"
|
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 m, mwan_rule, src_ip, src_port, dest_ip, dest_port, proto, sticky
|
||||||
local timeout, ipset, logging, policy
|
local timeout, ipset, logging, policy
|
||||||
|
|
||||||
arg[1] = arg[1] or ""
|
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 = Map("mwan3", translatef("MWAN Rule Configuration - %s", arg[1]))
|
||||||
m.redirect = dsp.build_url("admin", "network", "mwan", "rule")
|
m.redirect = dsp.build_url("admin", "network", "mwan", "rule")
|
||||||
|
|
||||||
|
@ -52,6 +55,9 @@ timeout.datatype = "range(1, 1000000)"
|
||||||
|
|
||||||
ipset = mwan_rule:option(Value, "ipset", translate("IPset"),
|
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\")"))
|
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"),
|
logging = mwan_rule:option(Flag, "logging", translate("Logging"),
|
||||||
translate("Enables firewall rule logging (global mwan3 logging must also be enabled)"))
|
translate("Enables firewall rule logging (global mwan3 logging must also be enabled)"))
|
||||||
|
|
Loading…
Reference in a new issue