1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
$Id$
]]--
require("luci.tools.webadmin")
require("luci.fs")
m = Map("olsr", "OLSR")
s = m:section(NamedSection, "general", "olsr")
debug = s:option(ListValue, "DebugLevel")
for i=0, 9 do
debug:value(i)
end
ipv = s:option(ListValue, "IpVersion")
ipv:value("4", "IPv4")
ipv:value("6", "IPv6")
noint = s:option(Flag, "AllowNoInt")
noint.enabled = "yes"
noint.disabled = "no"
s:option(Value, "Pollrate")
tcr = s:option(ListValue, "TcRedundancy")
tcr:value("0", translate("olsr_general_tcredundancy_0"))
tcr:value("1", translate("olsr_general_tcredundancy_1"))
tcr:value("2", translate("olsr_general_tcredundancy_2"))
s:option(Value, "MprCoverage")
lql = s:option(ListValue, "LinkQualityLevel")
lql:value("0", translate("disable"))
lql:value("1", translate("olsr_general_linkqualitylevel_1"))
lql:value("2", translate("olsr_general_linkqualitylevel_2"))
s:option(Value, "LinkQualityAging").optional = true
lqa = s:option(ListValue, "LinkQualityAlgorithm")
lqa.optional = true
lqa:value("etx_fpm", translate("olsr_etx_fpm"))
lqa:value("etx_float", translate("olsr_etx_float"))
lqa:value("etx_ff", translate("olsr_etx_ff"))
lqfish = s:option(Flag, "LinkQualityFishEye")
s:option(Value, "LinkQualityWinSize")
s:option(Value, "LinkQualityDijkstraLimit")
hyst = s:option(Flag, "UseHysteresis")
hyst.enabled = "yes"
hyst.disabled = "no"
fib = s:option(ListValue, "FIBMetric")
fib.optional = true
fib:value("flat")
fib:value("correct")
fib:value("approx")
clrscr = s:option(Flag, "ClearScreen")
clrscr.enabled = "yes"
clrscr.disabled = "no"
willingness = s:option(ListValue, "Willingness")
for i=0,7 do
willingness:value(i)
end
i = m:section(TypedSection, "Interface", translate("interfaces"))
i.anonymous = true
i.addremove = true
i.dynamic = true
network = i:option(ListValue, "Interface", translate("network"))
luci.tools.webadmin.cbi_add_networks(network)
i:option(Value, "Ip4Broadcast")
i:option(Value, "HelloInterval")
i:option(Value, "HelloValidityTime")
i:option(Value, "TcInterval")
i:option(Value, "TcValidityTime")
i:option(Value, "MidInterval")
i:option(Value, "MidValidityTime")
i:option(Value, "HnaInterval")
i:option(Value, "HnaValidityTime")
p = m:section(TypedSection, "LoadPlugin")
p.addremove = true
p.dynamic = true
lib = p:option(ListValue, "Library", translate("library"))
lib:value("")
for k, v in pairs(luci.fs.dir("/usr/lib")) do
if v:sub(1, 6) == "olsrd_" then
lib:value(v)
end
end
for i, sect in ipairs({ "Hna4", "Hna6" }) do
hna = m:section(TypedSection, sect)
hna.addremove = true
hna.anonymous = true
hna.template = "cbi/tblsection"
net = hna:option(Value, "NetAddr")
msk = hna:option(Value, "Prefix")
end
ipc = m:section(NamedSection, "IpcConnect")
conns = ipc:option(Value, "MaxConnections")
conns.isInteger = true
nets = ipc:option(Value, "Net")
nets.optional = true
hosts = ipc:option(Value, "Host")
hosts.optional = true
return m
|