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 - RDNSS"),
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) ~= "rdnss" then
15 luci.http.redirect(m.redirect)
20 s = m:section(NamedSection, sid, "interface", translate("RDNSS 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, "addr", translate("Addresses"),
66 translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used"))
70 o.datatype = "ip6addr"
71 o.placeholder = translate("default")
72 function o.cfgvalue(self, section)
74 local v = m.uci:get_list("radvd", section, "addr")
75 for v in utl.imatch(v) do
82 o = s:option(Value, "AdvRDNSSLifetime", translate("Lifetime"),
83 translate("Specifies the maximum duration how long the RDNSS entries are used for name resolution."))
85 o.datatype = 'or(uinteger,"infinity")'