33faa1523cb5beabca2a1580e126ef3bf18d16a5
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / globalsconfig.lua
1 -- Copyright 2017 Florian Eckert <fe@dev.tdt.de>
2 -- Licensed to the public under the GNU General Public License v2.
3
4 local net = require "luci.model.network".init()
5
6 local s, m, local_source, mask, rtmon, rtlookup
7
8 m = Map("mwan3", translate("MWAN - Globals"))
9
10 s = m:section(NamedSection, "globals", "globals", nil)
11
12 local_source = s:option(ListValue, "local_source",
13 translate("Local source interface"),
14 translate("Use the IP address of this interface as source IP " ..
15 "address for traffic initiated by the router itself"))
16 local_source:value("none")
17 local_source.default = "none"
18 for _, net in ipairs(net:get_networks()) do
19 if net:name() ~= "loopback" then
20 local_source:value(net:name())
21 end
22 end
23 local_source.rmempty = false
24
25 mask = s:option(
26 Value,
27 "mmx_mask",
28 translate("Firewall mask"),
29 translate("Enter value in hex, starting with <code>0x</code>"))
30 mask.datatype = "hex(4)"
31 mask.default = "0xff00"
32
33 rtmon = s:option(
34 Value,
35 "rtmon_interval",
36 translate("Update interval"),
37 translate("How often should rtmon update the interface routing table"))
38 rtmon.datatype = "integer"
39 rtmon.default = "5"
40 rtmon:value("1", translatef("%d second", 1))
41 rtmon:value("3", translatef("%d seconds", 3))
42 rtmon:value("5", translatef("%d seconds", 5))
43 rtmon:value("7", translatef("%d seconds", 7))
44 rtmon:value("10", translatef("%d seconds", 10))
45
46 rtlookup = s:option(DynamicList,
47 "rt_table_lookup",
48 translate("Routing table lookup"),
49 translate("Also scan this Routing table for connected networks"))
50 rtlookup.datatype = "integer"
51 rtlookup:value("1", translatef("Routing table %d", 1))
52 rtlookup:value("2", translatef("Routing table %d", 2))
53 rtlookup:value("220", translatef("Routing table %d", 220))
54
55 return m