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 local utl = require "luci.util"
18 m = Map("radvd", translatef("Radvd - Interface %q", "?"),
19 translate("Radvd is a router advertisement daemon for IPv6. " ..
20 "It listens to router solicitations and sends router advertisements " ..
21 "as described in RFC 4861."))
23 m.redirect = luci.dispatcher.build_url("admin/network/radvd")
25 if m.uci:get("radvd", sid) ~= "interface" then
26 luci.http.redirect(m.redirect)
30 m.uci:foreach("radvd", "interface",
32 if s['.name'] == sid and s.interface then
33 m.title = translatef("Radvd - Interface %q", s.interface)
39 s = m:section(NamedSection, sid, "interface", translate("Interface Configuration"))
42 s:tab("general", translate("General"))
43 s:tab("timing", translate("Timing"))
44 s:tab("mobile", translate("Mobile IPv6"))
51 o = s:taboption("general", Flag, "ignore", translate("Enable"))
54 function o.cfgvalue(...)
55 local v = Flag.cfgvalue(...)
56 return v == "1" and "0" or "1"
59 function o.write(self, section, value)
60 Flag.write(self, section, value == "1" and "0" or "1")
64 o = s:taboption("general", Value, "interface", translate("Interface"),
65 translate("Specifies the logical interface name this section belongs to"))
67 o.template = "cbi/network_netlist"
71 function o.formvalue(...)
72 return Value.formvalue(...) or "-"
75 function o.validate(self, value)
77 return nil, translate("Interface required")
82 function o.write(self, section, value)
83 m.uci:set("radvd", section, "ignore", 0)
84 m.uci:set("radvd", section, "interface", value)
88 o = s:taboption("general", DynamicList, "client", translate("Clients"),
89 translate("Restrict communication to specified clients, leave empty to use multicast"))
92 o.datatype = "ip6addr"
94 function o.cfgvalue(...)
95 local v = Value.cfgvalue(...)
97 for v in utl.imatch(v) do
104 o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"),
105 translate("Enables router advertisements and solicitations"))
108 function o.write(self, section, value)
110 m.uci:set("radvd", section, "ignore", 0)
111 m.uci:set("radvd", section, "IgnoreIfMissing", 1)
114 m.uci:set("radvd", section, "AdvSendAdvert", value)
118 o = s:taboption("general", Flag, "UnicastOnly", translate("Unicast only"),
119 translate("Indicates that the underlying link is not broadcast capable, prevents unsolicited advertisements from being sent"))
121 o:depends("AdvSendAdvert", "1")
124 o = s:taboption("general", Flag, "AdvManagedFlag", translate("Managed flag"),
125 translate("Enables the additional stateful administered autoconfiguration protocol (RFC2462)"))
127 o:depends("AdvSendAdvert", "1")
130 o = s:taboption("general", Flag, "AdvOtherConfigFlag", translate("Configuration flag"),
131 translate("Enables the autoconfiguration of additional, non address information (RFC2462)"))
133 o:depends("AdvSendAdvert", "1")
136 o = s:taboption("general", Flag, "AdvSourceLLAddress", translate("Source link-layer address"),
137 translate("Includes the link-layer address of the outgoing interface in the RA"))
141 o:depends("AdvSendAdvert", "1")
144 o = s:taboption("general", Value, "AdvLinkMTU", translate("Link MTU"),
145 translate("Advertises the given link MTU in the RA if specified. 0 disables MTU advertisements"))
147 o.datatype = "uinteger"
149 o:depends("AdvSendAdvert", "1")
152 o = s:taboption("general", Value, "AdvCurHopLimit", translate("Current hop limit"),
153 translate("Advertises the default Hop Count value for outgoing unicast packets in the RA. 0 disables hopcount advertisements"))
155 o.datatype = "uinteger"
158 o:depends("AdvSendAdvert", "1")
161 o = s:taboption("general", ListValue, "AdvDefaultPreference", translate("Default preference"),
162 translate("Advertises the default router preference"))
166 o:value("low", translate("low"))
167 o:value("medium", translate("medium"))
168 o:value("high", translate("high"))
169 o:depends("AdvSendAdvert", "1")
176 o = s:taboption("timing", Value, "MinRtrAdvInterval", translate("Minimum advertisement interval"),
177 translate("The minimum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds"))
179 o.datatype = "uinteger"
182 o:depends("AdvSendAdvert", "1")
185 o = s:taboption("timing", Value, "MaxRtrAdvInterval", translate("Maximum advertisement interval"),
186 translate("The maximum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds"))
188 o.datatype = "uinteger"
191 o:depends("AdvSendAdvert", "1")
194 o = s:taboption("timing", Value, "MinDelayBetweenRAs", translate("Minimum advertisement delay"),
195 translate("The minimum time allowed between sending multicast router advertisements from the interface, in seconds"))
197 o.datatype = "uinteger"
200 o:depends("AdvSendAdvert", "1")
203 o = s:taboption("timing", Value, "AdvReachableTime", translate("Reachable time"),
204 translate("Advertises assumed reachability time in milliseconds of neighbours in the RA if specified. 0 disables reachability advertisements"))
206 o.datatype = "uinteger"
209 o:depends("AdvSendAdvert", "1")
212 o = s:taboption("timing", Value, "AdvRetransTimer", translate("Retransmit timer"),
213 translate("Advertises wait time in milliseconds between Neighbor Solicitation messages in the RA if specified. 0 disables retransmit advertisements"))
215 o.datatype = "uinteger"
218 o:depends("AdvSendAdvert", "1")
221 o = s:taboption("timing", Value, "AdvDefaultLifetime", translate("Default lifetime"),
222 translate("Advertises the lifetime of the default router in seconds. 0 indicates that the node is no default router"))
224 o.datatype = "uinteger"
227 o:depends("AdvSendAdvert", "1")
234 o = s:taboption("mobile", Flag, "AdvHomeAgentFlag", translate("Advertise Home Agent flag"),
235 translate("Advertises Mobile IPv6 Home Agent capability (RFC3775)"))
237 o:depends("AdvSendAdvert", "1")
240 o = s:taboption("mobile", Flag, "AdvIntervalOpt", translate("Mobile IPv6 interval option"),
241 translate("Include Mobile IPv6 Advertisement Interval option to RA"))
243 o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"})
246 o = s:taboption("mobile", Flag, "AdvHomeAgentInfo", translate("Home Agent information"),
247 translate("Include Home Agent Information in the RA"))
249 o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"})
252 o = s:taboption("mobile", Flag, "AdvMobRtrSupportFlag", translate("Mobile IPv6 router registration"),
253 translate("Advertises Mobile Router registration capability (NEMO Basic)"))
255 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})
258 o = s:taboption("mobile", Value, "HomeAgentLifetime", translate("Home Agent lifetime"),
259 translate("Advertises the time in seconds the router is offering Mobile IPv6 Home Agent services"))
261 o.datatype = "uinteger"
264 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})
267 o = s:taboption("mobile", Value, "HomeAgentPreference", translate("Home Agent preference"),
268 translate("The preference for the Home Agent sending this RA"))
270 o.datatype = "uinteger"
273 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})