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 - Route"),
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) ~= "route" then
15 luci.http.redirect(m.redirect)
20 s = m:section(NamedSection, sid, "interface", translate("Route Configuration"))
28 o = s:option(Flag, "ignore", translate("Enable"))
31 function o.cfgvalue(...)
32 local v = Flag.cfgvalue(...)
33 return v == "1" and "0" or "1"
36 function o.write(self, section, value)
37 Flag.write(self, section, value == "1" and "0" or "1")
41 o = s:option(Value, "interface", translate("Interface"),
42 translate("Specifies the logical interface name this section belongs to"))
44 o.template = "cbi/network_netlist"
48 function o.formvalue(...)
49 return Value.formvalue(...) or "-"
52 function o.validate(self, value)
54 return nil, translate("Interface required")
59 function o.write(self, section, value)
60 m.uci:set("radvd", section, "ignore", 0)
61 m.uci:set("radvd", section, "interface", value)
65 o = s:option(DynamicList, "prefix", translate("Prefixes"),
66 translate("Advertised IPv6 prefixes"))
69 o.datatype = "ip6addr"
70 o.placeholder = translate("default")
71 function o.cfgvalue(self, section)
73 local v = m.uci:get_list("radvd", section, "prefix")
74 for v in utl.imatch(v) do
81 o = s:option(Value, "AdvRouteLifetime", translate("Lifetime"),
82 translate("Specifies the lifetime associated with the route in seconds."))
84 o.datatype = 'or(uinteger,"infinity")'
88 o = s:option(ListValue, "AdvRoutePreference", translate("Preference"),
89 translate("Specifies the preference associated with the default router"))
92 o:value("low", translate("low"))
93 o:value("medium", translate("medium"))
94 o:value("high", translate("high"))