1 -- ------ extra functions ------ --
3 function policyCheck() -- check to see if this policy's name exceed the maximum of 15 characters
4 policyNameLength = string.len(arg[1])
5 if policyNameLength > 15 then
10 function policyWarn() -- display status and warning messages at the top of the page
11 if nameTooLong == 1 then
12 return "<font color=\"ff0000\"><strong>WARNING: this policy's name is " .. policyNameLength .. " characters exceeding the maximum of 15!</strong></font>"
18 function cbiAddMember(field)
19 uci.cursor():foreach("mwan3", "member",
21 field:value(section[".name"])
26 -- ------ policy configuration ------ --
28 dsp = require "luci.dispatcher"
35 m5 = Map("mwan3", translate("MWAN Policy Configuration - " .. arg[1]),
36 translate(policyWarn()))
37 m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "policy")
40 mwan_policy = m5:section(NamedSection, arg[1], "policy", "")
41 mwan_policy.addremove = false
42 mwan_policy.dynamic = false
45 use_member = mwan_policy:option(DynamicList, "use_member", translate("Member used"))
46 cbiAddMember(use_member)
48 last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resort"),
49 translate("When all policy members are offline use this behavior for matched traffic"))
50 last_resort.default = "unreachable"
51 last_resort:value("unreachable", translate("unreachable (reject)"))
52 last_resort:value("blackhole", translate("blackhole (drop)"))
53 last_resort:value("default", translate("default (use main routing table)"))
56 -- ------ currently configured members ------ --
58 mwan_member = m5:section(TypedSection, "member", translate("Currently Configured Members"))
59 mwan_member.addremove = false
60 mwan_member.dynamic = false
61 mwan_member.sortable = false
62 mwan_member.template = "cbi/tblsection"