X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-mwan3%2Fluasrc%2Fmodel%2Fcbi%2Fmwan%2Frule.lua;h=f0b94bd0bbbc53c38d8ffcf0aeb7077b4edf3366;hp=5c6329e3397d66a5231d8a1dbeb64b83710ec30a;hb=08a2b27df5e282a6b5221fbe72f700523c7b0913;hpb=831bd71eb387973a25277e3fa7391c6a4af83597 diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua index 5c6329e33..f0b94bd0b 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/rule.lua @@ -1,4 +1,9 @@ +-- Copyright 2014 Aedan Renner +-- Copyright 2018 Florian Eckert +-- Licensed to the public under the GNU General Public License v2. + dsp = require "luci.dispatcher" +uci = require "uci" function ruleCheck() @@ -24,7 +29,7 @@ function ruleWarn(rule_error) local warnings = "" for i, k in pairs(rule_error) do if rule_error[i] == true then - warnings = warnings .. string.format("%s
", + warnings = warnings .. string.format("%s
", translatef("WARNING: Rule %s have a port configured with no or improper protocol specified!", i) ) end @@ -47,54 +52,53 @@ mwan_rule = m5:section(TypedSection, "rule", nil, "Traffic matching a rule, but all WAN interfaces for that policy are down will be blackholed
" .. "Names may contain characters A-Z, a-z, 0-9, _ and no spaces
" .. "Rules may not share the same name as configured interfaces, members or policies")) - mwan_rule.addremove = true - mwan_rule.anonymous = false - mwan_rule.dynamic = false - mwan_rule.sectionhead = translate("Rule") - mwan_rule.sortable = true - mwan_rule.template = "cbi/tblsection" - mwan_rule.extedit = dsp.build_url("admin", "network", "mwan", "rule", "%s") - function mwan_rule.create(self, section) - TypedSection.create(self, section) - m5.uci:save("mwan3") - luci.http.redirect(dsp.build_url("admin", "network", "mwan", "rule", section)) - end - +mwan_rule.addremove = true +mwan_rule.anonymous = false +mwan_rule.dynamic = false +mwan_rule.sectionhead = translate("Rule") +mwan_rule.sortable = true +mwan_rule.template = "cbi/tblsection" +mwan_rule.extedit = dsp.build_url("admin", "network", "mwan", "rule", "%s") +function mwan_rule.create(self, section) + TypedSection.create(self, section) + m5.uci:save("mwan3") + luci.http.redirect(dsp.build_url("admin", "network", "mwan", "rule", section)) +end src_ip = mwan_rule:option(DummyValue, "src_ip", translate("Source address")) - src_ip.rawhtml = true - function src_ip.cfgvalue(self, s) - return self.map:get(s, "src_ip") or "—" - end +src_ip.rawhtml = true +function src_ip.cfgvalue(self, s) + return self.map:get(s, "src_ip") or "—" +end src_port = mwan_rule:option(DummyValue, "src_port", translate("Source port")) - src_port.rawhtml = true - function src_port.cfgvalue(self, s) - return self.map:get(s, "src_port") or "—" - end +src_port.rawhtml = true +function src_port.cfgvalue(self, s) + return self.map:get(s, "src_port") or "—" +end dest_ip = mwan_rule:option(DummyValue, "dest_ip", translate("Destination address")) - dest_ip.rawhtml = true - function dest_ip.cfgvalue(self, s) - return self.map:get(s, "dest_ip") or "—" - end +dest_ip.rawhtml = true +function dest_ip.cfgvalue(self, s) + return self.map:get(s, "dest_ip") or "—" +end dest_port = mwan_rule:option(DummyValue, "dest_port", translate("Destination port")) - dest_port.rawhtml = true - function dest_port.cfgvalue(self, s) - return self.map:get(s, "dest_port") or "—" - end +dest_port.rawhtml = true +function dest_port.cfgvalue(self, s) + return self.map:get(s, "dest_port") or "—" +end proto = mwan_rule:option(DummyValue, "proto", translate("Protocol")) - proto.rawhtml = true - function proto.cfgvalue(self, s) - return self.map:get(s, "proto") or "all" - end +proto.rawhtml = true +function proto.cfgvalue(self, s) + return self.map:get(s, "proto") or "all" +end use_policy = mwan_rule:option(DummyValue, "use_policy", translate("Policy assigned")) - use_policy.rawhtml = true - function use_policy.cfgvalue(self, s) - return self.map:get(s, "use_policy") or "—" - end +use_policy.rawhtml = true +function use_policy.cfgvalue(self, s) + return self.map:get(s, "use_policy") or "—" +end return m5