1 require("luci.tools.webadmin")
3 m = Map("multiwan", translate("Multi-WAN"),
4 translate("Multi-WAN allows for the use of multiple uplinks for load balancing and failover."))
6 s = m:section(NamedSection, "config", "multiwan", "")
8 e = s:option(Flag, "enabled", translate("Enable"))
12 function e.write(self, section, value)
14 os.execute("/etc/init.d/multiwan stop")
16 os.execute("/etc/init.d/multiwan enable")
18 Flag.write(self, section, value)
21 s = m:section(TypedSection, "mwanfw", translate("Multi-WAN Traffic Rules"),
22 translate("Configure rules for directing outbound traffic through specified WAN Uplinks."))
23 s.template = "cbi/tblsection"
27 src = s:option(Value, "src", translate("Source Address"))
29 src:value("", translate("all"))
30 luci.tools.webadmin.cbi_add_knownips(src)
32 dst = s:option(Value, "dst", translate("Destination Address"))
34 dst:value("", translate("all"))
35 luci.tools.webadmin.cbi_add_knownips(dst)
37 proto = s:option(Value, "proto", translate("Protocol"))
38 proto:value("", translate("all"))
39 proto:value("tcp", "TCP")
40 proto:value("udp", "UDP")
41 proto:value("icmp", "ICMP")
44 ports = s:option(Value, "ports", translate("Ports"))
46 ports:value("", translate("all", translate("all")))
48 wanrule = s:option(ListValue, "wanrule", translate("WAN Uplink"))
49 luci.tools.webadmin.cbi_add_networks(wanrule)
50 wanrule:value("fastbalancer", translate("Load Balancer(Performance)"))
51 wanrule:value("balancer", translate("Load Balancer(Compatibility)"))
52 wanrule.default = "fastbalancer"
53 wanrule.optional = false
54 wanrule.rmempty = false
56 s = m:section(NamedSection, "config", "", "")
59 default_route = s:option(ListValue, "default_route", translate("Default Route"))
60 luci.tools.webadmin.cbi_add_networks(default_route)
61 default_route:value("fastbalancer", translate("Load Balancer(Performance)"))
62 default_route:value("balancer", translate("Load Balancer(Compatibility)"))
63 default_route.default = "balancer"
64 default_route.optional = false
65 default_route.rmempty = false