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 - Route"),
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) ~= "route" then
26 luci.http.redirect(m.redirect)
31 s = m:section(NamedSection, sid, "interface", translate("Route Configuration"))
39 o = s:option(Flag, "ignore", translate("Enable"))
42 function o.cfgvalue(...)
43 local v = Flag.cfgvalue(...)
44 return v == "1" and "0" or "1"
47 function o.write(self, section, value)
48 Flag.write(self, section, value == "1" and "0" or "1")
52 o = s:option(Value, "interface", translate("Interface"),
53 translate("Specifies the logical interface name this section belongs to"))
55 o.template = "cbi/network_netlist"
59 function o.formvalue(...)
60 return Value.formvalue(...) or "-"
63 function o.validate(self, value)
65 return nil, translate("Interface required")
70 function o.write(self, section, value)
71 m.uci:set("radvd", section, "ignore", 0)
72 m.uci:set("radvd", section, "interface", value)
76 o = s:option(DynamicList, "prefix", translate("Prefixes"),
77 translate("Advertised IPv6 prefixes"))
80 o.datatype = "ip6addr"
81 o.placeholder = translate("default")
82 function o.cfgvalue(self, section)
84 local v = m.uci:get_list("radvd", section, "prefix")
85 for v in utl.imatch(v) do
92 o = s:option(Value, "AdvRouteLifetime", translate("Lifetime"),
93 translate("Specifies the lifetime associated with the route in seconds."))
95 o.datatype = 'or(uinteger,"infinity")'
99 o = s:option(ListValue, "AdvRoutePreference", translate("Preference"),
100 translate("Specifies the preference associated with the default router"))
103 o:value("low", translate("low"))
104 o:value("medium", translate("medium"))
105 o:value("high", translate("high"))