1 -- Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
2 -- Licensed to the public under the Apache License 2.0.
5 local utl = require "luci.util"
7 m = Map("radvd", translatef("Radvd - Interface %q", "?"),
8 translate("Radvd is a router advertisement daemon for IPv6. " ..
9 "It listens to router solicitations and sends router advertisements " ..
10 "as described in RFC 4861."))
12 m.redirect = luci.dispatcher.build_url("admin/network/radvd")
14 if m.uci:get("radvd", sid) ~= "interface" then
15 luci.http.redirect(m.redirect)
19 m.uci:foreach("radvd", "interface",
21 if s['.name'] == sid and s.interface then
22 m.title = translatef("Radvd - Interface %q", s.interface)
28 s = m:section(NamedSection, sid, "interface", translate("Interface Configuration"))
31 s:tab("general", translate("General"))
32 s:tab("timing", translate("Timing"))
33 s:tab("mobile", translate("Mobile IPv6"))
40 o = s:taboption("general", Flag, "ignore", translate("Enable"))
43 function o.cfgvalue(...)
44 local v = Flag.cfgvalue(...)
45 return v == "1" and "0" or "1"
48 function o.write(self, section, value)
49 Flag.write(self, section, value == "1" and "0" or "1")
53 o = s:taboption("general", Value, "interface", translate("Interface"),
54 translate("Specifies the logical interface name this section belongs to"))
56 o.template = "cbi/network_netlist"
60 function o.formvalue(...)
61 return Value.formvalue(...) or "-"
64 function o.validate(self, value)
66 return nil, translate("Interface required")
71 function o.write(self, section, value)
72 m.uci:set("radvd", section, "ignore", 0)
73 m.uci:set("radvd", section, "interface", value)
77 o = s:taboption("general", DynamicList, "client", translate("Clients"),
78 translate("Restrict communication to specified clients, leave empty to use multicast"))
81 o.datatype = "ip6addr"
83 function o.cfgvalue(...)
84 local v = Value.cfgvalue(...)
86 for v in utl.imatch(v) do
93 o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"),
94 translate("Enables router advertisements and solicitations"))
97 function o.write(self, section, value)
99 m.uci:set("radvd", section, "ignore", 0)
100 m.uci:set("radvd", section, "IgnoreIfMissing", 1)
103 m.uci:set("radvd", section, "AdvSendAdvert", value)
107 o = s:taboption("general", Flag, "UnicastOnly", translate("Unicast only"),
108 translate("Indicates that the underlying link is not broadcast capable, prevents unsolicited advertisements from being sent"))
110 o:depends("AdvSendAdvert", "1")
113 o = s:taboption("general", Flag, "AdvManagedFlag", translate("Managed flag"),
114 translate("Enables the additional stateful administered autoconfiguration protocol (RFC2462)"))
116 o:depends("AdvSendAdvert", "1")
119 o = s:taboption("general", Flag, "AdvOtherConfigFlag", translate("Configuration flag"),
120 translate("Enables the autoconfiguration of additional, non address information (RFC2462)"))
122 o:depends("AdvSendAdvert", "1")
125 o = s:taboption("general", Flag, "AdvSourceLLAddress", translate("Source link-layer address"),
126 translate("Includes the link-layer address of the outgoing interface in the RA"))
130 o:depends("AdvSendAdvert", "1")
133 o = s:taboption("general", Value, "AdvLinkMTU", translate("Link MTU"),
134 translate("Advertises the given link MTU in the RA if specified. 0 disables MTU advertisements"))
136 o.datatype = "uinteger"
138 o:depends("AdvSendAdvert", "1")
141 o = s:taboption("general", Value, "AdvCurHopLimit", translate("Current hop limit"),
142 translate("Advertises the default Hop Count value for outgoing unicast packets in the RA. 0 disables hopcount advertisements"))
144 o.datatype = "uinteger"
147 o:depends("AdvSendAdvert", "1")
150 o = s:taboption("general", ListValue, "AdvDefaultPreference", translate("Default preference"),
151 translate("Advertises the default router preference"))
155 o:value("low", translate("low"))
156 o:value("medium", translate("medium"))
157 o:value("high", translate("high"))
158 o:depends("AdvSendAdvert", "1")
165 o = s:taboption("timing", Value, "MinRtrAdvInterval", translate("Minimum advertisement interval"),
166 translate("The minimum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds"))
168 o.datatype = "uinteger"
171 o:depends("AdvSendAdvert", "1")
174 o = s:taboption("timing", Value, "MaxRtrAdvInterval", translate("Maximum advertisement interval"),
175 translate("The maximum time allowed between sending unsolicited multicast router advertisements from the interface, in seconds"))
177 o.datatype = "uinteger"
180 o:depends("AdvSendAdvert", "1")
183 o = s:taboption("timing", Value, "MinDelayBetweenRAs", translate("Minimum advertisement delay"),
184 translate("The minimum time allowed between sending multicast router advertisements from the interface, in seconds"))
186 o.datatype = "uinteger"
189 o:depends("AdvSendAdvert", "1")
192 o = s:taboption("timing", Value, "AdvReachableTime", translate("Reachable time"),
193 translate("Advertises assumed reachability time in milliseconds of neighbours in the RA if specified. 0 disables reachability advertisements"))
195 o.datatype = "uinteger"
198 o:depends("AdvSendAdvert", "1")
201 o = s:taboption("timing", Value, "AdvRetransTimer", translate("Retransmit timer"),
202 translate("Advertises wait time in milliseconds between Neighbor Solicitation messages in the RA if specified. 0 disables retransmit advertisements"))
204 o.datatype = "uinteger"
207 o:depends("AdvSendAdvert", "1")
210 o = s:taboption("timing", Value, "AdvDefaultLifetime", translate("Default lifetime"),
211 translate("Advertises the lifetime of the default router in seconds. 0 indicates that the node is no default router"))
213 o.datatype = "uinteger"
216 o:depends("AdvSendAdvert", "1")
223 o = s:taboption("mobile", Flag, "AdvHomeAgentFlag", translate("Advertise Home Agent flag"),
224 translate("Advertises Mobile IPv6 Home Agent capability (RFC3775)"))
226 o:depends("AdvSendAdvert", "1")
229 o = s:taboption("mobile", Flag, "AdvIntervalOpt", translate("Mobile IPv6 interval option"),
230 translate("Include Mobile IPv6 Advertisement Interval option to RA"))
232 o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"})
235 o = s:taboption("mobile", Flag, "AdvHomeAgentInfo", translate("Home Agent information"),
236 translate("Include Home Agent Information in the RA"))
238 o:depends({AdvHomeAgentFlag = "1", AdvSendAdvert = "1"})
241 o = s:taboption("mobile", Flag, "AdvMobRtrSupportFlag", translate("Mobile IPv6 router registration"),
242 translate("Advertises Mobile Router registration capability (NEMO Basic)"))
244 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})
247 o = s:taboption("mobile", Value, "HomeAgentLifetime", translate("Home Agent lifetime"),
248 translate("Advertises the time in seconds the router is offering Mobile IPv6 Home Agent services"))
250 o.datatype = "uinteger"
253 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})
256 o = s:taboption("mobile", Value, "HomeAgentPreference", translate("Home Agent preference"),
257 translate("The preference for the Home Agent sending this RA"))
259 o.datatype = "uinteger"
262 o:depends({AdvHomeAgentInfo = "1", AdvSendAdvert = "1"})