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