2 LuCI - Lua Configuration Interface
4 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
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
10 http://www.apache.org/licenses/LICENSE-2.0
16 function write_float(self, section, value)
17 local n = tonumber(value)
19 return Value.write(self, section, "%.1f" % n)
23 m = Map("olsrd", translate("OLSR Daemon - Interface"),
24 translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. "..
25 "As such it allows mesh routing for any network equipment. "..
26 "It runs on any wifi card that supports ad-hoc mode and of course on any ethernet device. "..
27 "Visit <a href='http://www.olsr.org'>olsrd.org</a> for help and documentation."))
29 m.redirect = luci.dispatcher.build_url("admin/services/olsrd")
31 if not arg[1] or m.uci:get("olsrd", arg[1]) ~= "Interface" then
32 luci.http.redirect(m.redirect)
36 i = m:section(NamedSection, arg[1], "Interface", translate("Interface"))
40 i:tab("general", translate("General Settings"))
41 i:tab("addrs", translate("IP Addresses"))
42 i:tab("timing", translate("Timing and Validity"))
44 ign = i:taboption("general", Flag, "ignore", translate("Enable"),
45 translate("Enable this interface."))
49 function ign.cfgvalue(self, section)
50 return Flag.cfgvalue(self, section) or "0"
53 network = i:taboption("general", Value, "interface", translate("Network"),
54 translate("The interface OLSRd should serve."))
56 network.template = "cbi/network_netlist"
57 network.widget = "radio"
58 network.nocreate = true
60 mode = i:taboption("general", ListValue, "Mode", translate("Mode"),
61 translate("Interface Mode is used to prevent unnecessary packet forwarding on switched ethernet interfaces. "..
62 "valid Modes are \"mesh\" and \"ether\". Default is \"mesh\"."))
69 weight = i:taboption("general", Value, "Weight", translate("Weight"),
70 translate("When multiple links exist between hosts the weight of interface is used to determine the link to use. "..
71 "Normally the weight is automatically calculated by olsrd based on the characteristics of the interface, "..
72 "but here you can specify a fixed value. Olsrd will choose links with the lowest value.<br />"..
73 "<b>Note:</b> Interface weight is used only when LinkQualityLevel is set to 0. "..
74 "For any other value of LinkQualityLevel, the interface ETX value is used instead."))
75 weight.optional = true
76 weight.datatype = "uinteger"
77 weight.placeholder = "0"
79 lqmult = i:taboption("general", DynamicList, "LinkQualityMult", translate("LinkQuality Multiplicator"),
80 translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1. "..
81 "It is only used when LQ-Level is greater than 0. Examples:<br />"..
82 "reduce LQ to 192.168.0.1 by half: 192.168.0.1 0.5<br />"..
83 "reduce LQ to all nodes on this interface by 20%: default 0.8"))
84 lqmult.optional = true
87 lqmult.placeholder = "default 1.0"
90 ip4b = i:taboption("addrs", Value, "Ip4Broadcast", translate("IPv4 broadcast"),
91 translate("IPv4 broadcast address for outgoing OLSR packets. One useful example would be 255.255.255.255. "..
92 "Default is \"0.0.0.0\", which triggers the usage of the interface broadcast IP."))
94 ip4b.datatype = "ip4addr"
95 ip4b.placeholder = "0.0.0.0"
97 ip6m = i:taboption("addrs", Value, "IPv6Multicast", translate("IPv6 multicast"),
98 translate("IPv6 multicast address. Default is \"FF02::6D\", the manet-router linklocal multicast."))
100 ip6m.datatype = "ip6addr"
101 ip6m.placeholder = "FF02::6D"
103 ip4s = i:taboption("addrs", Value, "IPv4Src", translate("IPv4 source"),
104 translate("IPv4 src address for outgoing OLSR packages. Default is \"0.0.0.0\", which triggers usage of the interface IP."))
106 ip4s.datatype = "ip4addr"
107 ip4s.placeholder = "0.0.0.0"
109 ip6s = i:taboption("addrs", Value, "IPv6Src", translate("IPv6 source"),
110 translate("IPv6 src prefix. OLSRd will choose one of the interface IPs which matches the prefix of this parameter. "..
111 "Default is \"0::/0\", which triggers the usage of a not-linklocal interface IP."))
113 ip6s.datatype = "ip6addr"
114 ip6s.placeholder = "0::/0"
116 hi = i:taboption("timing", Value, "HelloInterval", translate("Hello interval"))
118 hi.datatype = "ufloat"
119 hi.placeholder = "5.0"
120 hi.write = write_float
122 hv = i:taboption("timing", Value, "HelloValidityTime", translate("Hello validity time"))
124 hv.datatype = "ufloat"
125 hv.placeholder = "40.0"
126 hv.write = write_float
128 ti = i:taboption("timing", Value, "TcInterval", translate("TC interval"))
130 ti.datatype = "ufloat"
131 ti.placeholder = "2.0"
132 ti.write = write_float
134 tv = i:taboption("timing", Value, "TcValidityTime", translate("TC validity time"))
136 tv.datatype = "ufloat"
137 tv.placeholder = "256.0"
138 tv.write = write_float
140 mi = i:taboption("timing", Value, "MidInterval", translate("MID interval"))
142 mi.datatype = "ufloat"
143 mi.placeholder = "18.0"
144 mi.write = write_float
146 mv = i:taboption("timing", Value, "MidValidityTime", translate("MID validity time"))
148 mv.datatype = "ufloat"
149 mv.placeholder = "324.0"
150 mv.write = write_float
152 ai = i:taboption("timing", Value, "HnaInterval", translate("HNA interval"))
154 ai.datatype = "ufloat"
155 ai.placeholder = "18.0"
156 ai.write = write_float
158 av = i:taboption("timing", Value, "HnaValidityTime", translate("HNA validity time"))
160 av.datatype = "ufloat"
161 av.placeholder = "108.0"
162 av.write = write_float