"as described in RFC 4861."))
local nm = require "luci.model.network".init(m.uci)
+local ut = require "luci.util"
--
o.width = "10%"
o = s:option(DummyValue, "UnicastOnly", translate("Multicast"))
-function o.cfgvalue(...)
- local v = Value.cfgvalue(...)
- return v == "1" and translate("no") or translate("yes")
+function o.cfgvalue(self, section)
+ local v = Value.cfgvalue(self, section)
+ local v2 = m.uci:get("radvd", section, "client")
+ return (v == "1" or (v2 and #v2 > 0)) and translate("no") or translate("yes")
end
o = s:option(DummyValue, "AdvSendAdvert", translate("Advertising"))
o = s2:option(DummyValue, "prefix", translate("Prefix"))
o.width = "60%"
function o.cfgvalue(self, section)
- local v = Value.cfgvalue(self, section)
+ local v = m.uci:get_list("radvd", section, "prefix")
+ local l = { }
+
if not v then
local net = nm:get_network(m.uci:get("radvd", section, "interface"))
if net then
end
end
end
- else
+ end
+
+ for v in ut.imatch(v) do
v = luci.ip.IPv6(v)
- v = v and v:string()
+ if v then
+ l[#l+1] = v:string()
+ end
+ end
+
+ if #l == 0 then
+ l[1] = "?"
end
- return v or "?"
+ return table.concat(l, ", ")
end
o = s2:option(DummyValue, "AdvAutonomous", translate("Autonomous"))
o = s3:option(DummyValue, "prefix", translate("Prefix"))
o.width = "60%"
function o.cfgvalue(self, section)
- local v = Value.cfgvalue(self, section)
+ local v = m.uci:get_list("radvd", section, "prefix")
+ local l = { }
if v then
- v = luci.ip.IPv6(v)
- v = v and v:string()
+ for v in ut.imatch(v) do
+ v = luci.ip.IPv6(v)
+ if v then
+ l[#l+1] = v:string()
+ end
+ end
end
- return v or "?"
+
+ if #l == 0 then
+ l[1] = "?"
+ end
+
+ return table.concat(l, ", ")
end
o = s3:option(DummyValue, "AdvRouteLifetime", translate("Lifetime"))
o = s4:option(DummyValue, "addr", translate("Address"))
o.width = "60%"
function o.cfgvalue(self, section)
- local v = Value.cfgvalue(self, section)
+ local v = m.uci:get_list("radvd", section, "addr")
+ local l = { }
if not v then
local net = nm:get_network(m.uci:get("radvd", section, "interface"))
if net then
end
end
end
- else
+ end
+
+ for v in ut.imatch(v) do
v = luci.ip.IPv6(v)
- v = v and v:network(128):string()
+ if v then
+ l[#l+1] = v:network(128):string()
+ end
+ end
+
+ if #l == 0 then
+ l[1] = "?"
end
- return v or "?"
+ return table.concat(l, ", ")
end
-o = s4:option(DummyValue, "AdvRDNSSOpen", translate("Open"))
+o = s4:option(DummyValue, "AdvRDNSSLifetime", translate("Lifetime"))
function o.cfgvalue(self, section)
- local v = Value.cfgvalue(self, section)
- return v == "1" and translate("yes") or translate("no")
+ local v = Value.cfgvalue(self, section) or "1200"
+ return translate(v)
end
-o = s4:option(DummyValue, "AdvRDNSSLifetime", translate("Lifetime"))
+
+--
+-- DNSSL
+--
+
+s4 = m:section(TypedSection, "dnssl", translate("DNSSL"))
+s4.template = "cbi/tblsection"
+s4.extedit = luci.dispatcher.build_url("admin/network/radvd/dnssl/%s")
+s4.addremove = true
+s4.anonymous = true
+
+function s.create(...)
+ local id = TypedSection.create(...)
+ luci.http.redirect(s4.extedit % id)
+end
+
+
+o = s4:option(Flag, "ignore", translate("Enable"))
+o.rmempty = false
+o.width = "30px"
+function o.cfgvalue(...)
+ local v = Flag.cfgvalue(...)
+ return v == "1" and "0" or "1"
+end
+function o.write(self, section, value)
+ Flag.write(self, section, value == "1" and "0" or "1")
+end
+
+o = s4:option(DummyValue, "interface", translate("Interface"))
+o.template = "cbi/network_netinfo"
+o.width = "10%"
+
+o = s4:option(DummyValue, "suffix", translate("Suffix"))
+o.width = "60%"
+function o.cfgvalue(self, section)
+ local v = m.uci:get_list("radvd", section, "suffix")
+ local l = { }
+
+ for v in ut.imatch(v) do
+ l[#l+1] = v
+ end
+
+ if #l == 0 then
+ l[1] = "?"
+ end
+
+ return table.concat(l, ", ")
+end
+
+o = s4:option(DummyValue, "AdvDNSSLLifetime", translate("Lifetime"))
function o.cfgvalue(self, section)
local v = Value.cfgvalue(self, section) or "1200"
return translate(v)
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - Prefix"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
end
-o = s:taboption("general", Value, "prefix", translate("Prefix"),
- translate("Advertised IPv6 prefix. If empty, the current interface prefix is used"))
+o = s:taboption("general", DynamicList, "prefix", translate("Prefixes"),
+ translate("Advertised IPv6 prefixes. If empty, the current interface prefix is used"))
-o.optional = true
-o.datatype = "ip6addr"
+o.optional = true
+o.datatype = "ip6addr"
+o.placeholder = translate("default")
+function o.cfgvalue(self, section)
+ local l = { }
+ local v = m.uci:get_list("radvd", section, "prefix")
+ for v in utl.imatch(v) do
+ l[#l+1] = v
+ end
+ return l
+end
o = s:taboption("general", Flag, "AdvOnLink", translate("On-link determination"),
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - RDNSS"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
end
-o = s:option(Value, "addr", translate("Address"),
+o = s:option(DynamicList, "addr", translate("Addresses"),
translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used"))
-o.optional = false
-o.rmempty = true
-o.datatype = "ip6addr"
-
-
-o = s:option(Flag, "AdvRDNSSOpen", translate("Open"),
- translate("Indicates whether that RDNSS continues to be available to hosts even if they moved to a different subnet "))
+o.optional = false
+o.rmempty = true
+o.datatype = "ip6addr"
+o.placeholder = translate("default")
+function o.cfgvalue(self, section)
+ local l = { }
+ local v = m.uci:get_list("radvd", section, "prefix")
+ for v in utl.imatch(v) do
+ l[#l+1] = v
+ end
+ return l
+end
o = s:option(Value, "AdvRDNSSLifetime", translate("Lifetime"),