summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-radvd
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-01-29 03:27:37 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-01-29 03:27:37 +0000
commita707d2cb84459d8f92eebadec86eeefb16c0548e (patch)
tree2890b55c1c7c2420211d232bec113a472ac4e57c /applications/luci-radvd
parentc2b107ed46571a1494d74d4c1af3bb22b8b2f821 (diff)
applications/luci-radvd: sync with OpenWrt trunk changes
Diffstat (limited to 'applications/luci-radvd')
-rw-r--r--applications/luci-radvd/luasrc/controller/radvd.lua1
-rw-r--r--applications/luci-radvd/luasrc/model/cbi/radvd.lua118
-rw-r--r--applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua17
-rw-r--r--applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua18
-rw-r--r--applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua22
-rw-r--r--applications/luci-radvd/luasrc/model/cbi/radvd/route.lua18
6 files changed, 159 insertions, 35 deletions
diff --git a/applications/luci-radvd/luasrc/controller/radvd.lua b/applications/luci-radvd/luasrc/controller/radvd.lua
index 1b403a8f92..6ed1176837 100644
--- a/applications/luci-radvd/luasrc/controller/radvd.lua
+++ b/applications/luci-radvd/luasrc/controller/radvd.lua
@@ -24,4 +24,5 @@ function index()
entry({"admin", "network", "radvd", "prefix"}, cbi("radvd/prefix"), nil).leaf = true
entry({"admin", "network", "radvd", "route"}, cbi("radvd/route"), nil).leaf = true
entry({"admin", "network", "radvd", "rdnss"}, cbi("radvd/rdnss"), nil).leaf = true
+ entry({"admin", "network", "radvd", "dnssl"}, cbi("radvd/dnssl"), nil).leaf = true
end
diff --git a/applications/luci-radvd/luasrc/model/cbi/radvd.lua b/applications/luci-radvd/luasrc/model/cbi/radvd.lua
index 18df46b191..5ee196942a 100644
--- a/applications/luci-radvd/luasrc/model/cbi/radvd.lua
+++ b/applications/luci-radvd/luasrc/model/cbi/radvd.lua
@@ -18,6 +18,7 @@ m = Map("radvd", translate("Radvd"),
"as described in RFC 4861."))
local nm = require "luci.model.network".init(m.uci)
+local ut = require "luci.util"
--
@@ -69,9 +70,10 @@ o.template = "cbi/network_netinfo"
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"))
@@ -133,7 +135,9 @@ o.width = "10%"
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
@@ -149,12 +153,20 @@ function o.cfgvalue(self, section)
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"))
@@ -210,12 +222,22 @@ o.width = "10%"
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"))
@@ -265,7 +287,8 @@ o.width = "10%"
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
@@ -281,21 +304,78 @@ function o.cfgvalue(self, section)
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)
diff --git a/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua b/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
index ae8e062cba..519664cdc2 100644
--- a/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
+++ b/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
@@ -13,6 +13,7 @@ $Id$
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - Interface %q", "?"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
@@ -84,6 +85,22 @@ function o.write(self, section, value)
end
+o = s:taboption("general", DynamicList, "client", translate("Clients"),
+ translate("Restrict communication to specified clients, leave empty to use multicast"))
+
+o.rmempty = true
+o.datatype = "ip6addr"
+o.placeholder = "any"
+function o.cfgvalue(...)
+ local v = Value.cfgvalue(...)
+ local l = { }
+ for v in utl.imatch(v) do
+ l[#l+1] = v
+ end
+ return l
+end
+
+
o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"),
translate("Enables router advertisements and solicitations"))
diff --git a/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua b/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua
index d3567cb0e8..6151910649 100644
--- a/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua
+++ b/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua
@@ -13,6 +13,7 @@ $Id$
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - Prefix"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
@@ -75,11 +76,20 @@ function o.write(self, section, value)
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"),
diff --git a/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua b/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua
index 91cf25c665..5313bbe3fa 100644
--- a/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua
+++ b/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua
@@ -13,6 +13,7 @@ $Id$
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - RDNSS"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
@@ -72,16 +73,21 @@ function o.write(self, section, value)
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"),
diff --git a/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua b/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua
index 6e84d0fb25..37fac576b4 100644
--- a/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua
+++ b/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua
@@ -13,6 +13,7 @@ $Id$
]]--
local sid = arg[1]
+local utl = require "luci.util"
m = Map("radvd", translatef("Radvd - Route"),
translate("Radvd is a router advertisement daemon for IPv6. " ..
@@ -72,11 +73,20 @@ function o.write(self, section, value)
end
-o = s:option(Value, "prefix", translate("Prefix"),
- translate("Advertised IPv6 prefix"))
+o = s:option(DynamicList, "prefix", translate("Prefixes"),
+ translate("Advertised IPv6 prefixes"))
-o.rmempty = false
-o.datatype = "ip6addr"
+o.rmempty = false
+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, "AdvRouteLifetime", translate("Lifetime"),