Changeset 6808
- Timestamp:
- 01/29/11 05:27:37 (2 years ago)
- Location:
- luci/trunk/applications/luci-radvd/luasrc
- Files:
-
- 6 modified
-
controller/radvd.lua (modified) (1 diff)
-
model/cbi/radvd.lua (modified) (8 diffs)
-
model/cbi/radvd/interface.lua (modified) (2 diffs)
-
model/cbi/radvd/prefix.lua (modified) (2 diffs)
-
model/cbi/radvd/rdnss.lua (modified) (2 diffs)
-
model/cbi/radvd/route.lua (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/applications/luci-radvd/luasrc/controller/radvd.lua
r6527 r6808 25 25 entry({"admin", "network", "radvd", "route"}, cbi("radvd/route"), nil).leaf = true 26 26 entry({"admin", "network", "radvd", "rdnss"}, cbi("radvd/rdnss"), nil).leaf = true 27 entry({"admin", "network", "radvd", "dnssl"}, cbi("radvd/dnssl"), nil).leaf = true 27 28 end -
luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd.lua
r6715 r6808 19 19 20 20 local nm = require "luci.model.network".init(m.uci) 21 local ut = require "luci.util" 21 22 22 23 … … 70 71 71 72 o = s:option(DummyValue, "UnicastOnly", translate("Multicast")) 72 function o.cfgvalue(...) 73 local v = Value.cfgvalue(...) 74 return v == "1" and translate("no") or translate("yes") 73 function o.cfgvalue(self, section) 74 local v = Value.cfgvalue(self, section) 75 local v2 = m.uci:get("radvd", section, "client") 76 return (v == "1" or (v2 and #v2 > 0)) and translate("no") or translate("yes") 75 77 end 76 78 … … 134 136 o.width = "60%" 135 137 function o.cfgvalue(self, section) 136 local v = Value.cfgvalue(self, section) 138 local v = m.uci:get_list("radvd", section, "prefix") 139 local l = { } 140 137 141 if not v then 138 142 local net = nm:get_network(m.uci:get("radvd", section, "interface")) … … 150 154 end 151 155 end 152 else 156 end 157 158 for v in ut.imatch(v) do 153 159 v = luci.ip.IPv6(v) 154 v = v and v:string() 155 end 156 157 return v or "?" 160 if v then 161 l[#l+1] = v:string() 162 end 163 end 164 165 if #l == 0 then 166 l[1] = "?" 167 end 168 169 return table.concat(l, ", ") 158 170 end 159 171 … … 211 223 o.width = "60%" 212 224 function o.cfgvalue(self, section) 213 local v = Value.cfgvalue(self, section) 225 local v = m.uci:get_list("radvd", section, "prefix") 226 local l = { } 214 227 if v then 215 v = luci.ip.IPv6(v) 216 v = v and v:string() 217 end 218 return v or "?" 228 for v in ut.imatch(v) do 229 v = luci.ip.IPv6(v) 230 if v then 231 l[#l+1] = v:string() 232 end 233 end 234 end 235 236 if #l == 0 then 237 l[1] = "?" 238 end 239 240 return table.concat(l, ", ") 219 241 end 220 242 … … 266 288 o.width = "60%" 267 289 function o.cfgvalue(self, section) 268 local v = Value.cfgvalue(self, section) 290 local v = m.uci:get_list("radvd", section, "addr") 291 local l = { } 269 292 if not v then 270 293 local net = nm:get_network(m.uci:get("radvd", section, "interface")) … … 282 305 end 283 306 end 284 else 307 end 308 309 for v in ut.imatch(v) do 285 310 v = luci.ip.IPv6(v) 286 v = v and v:network(128):string()287 end288 289 return v or "?"290 end 291 292 o = s4:option(DummyValue, "AdvRDNSSOpen", translate("Open")) 293 function o.cfgvalue(self, section) 294 local v = Value.cfgvalue(self, section) 295 return v == "1" and translate("yes") or translate("no")311 if v then 312 l[#l+1] = v:network(128):string() 313 end 314 end 315 316 if #l == 0 then 317 l[1] = "?" 318 end 319 320 return table.concat(l, ", ") 296 321 end 297 322 … … 303 328 304 329 330 -- 331 -- DNSSL 332 -- 333 334 s4 = m:section(TypedSection, "dnssl", translate("DNSSL")) 335 s4.template = "cbi/tblsection" 336 s4.extedit = luci.dispatcher.build_url("admin/network/radvd/dnssl/%s") 337 s4.addremove = true 338 s4.anonymous = true 339 340 function s.create(...) 341 local id = TypedSection.create(...) 342 luci.http.redirect(s4.extedit % id) 343 end 344 345 346 o = s4:option(Flag, "ignore", translate("Enable")) 347 o.rmempty = false 348 o.width = "30px" 349 function o.cfgvalue(...) 350 local v = Flag.cfgvalue(...) 351 return v == "1" and "0" or "1" 352 end 353 function o.write(self, section, value) 354 Flag.write(self, section, value == "1" and "0" or "1") 355 end 356 357 o = s4:option(DummyValue, "interface", translate("Interface")) 358 o.template = "cbi/network_netinfo" 359 o.width = "10%" 360 361 o = s4:option(DummyValue, "suffix", translate("Suffix")) 362 o.width = "60%" 363 function o.cfgvalue(self, section) 364 local v = m.uci:get_list("radvd", section, "suffix") 365 local l = { } 366 367 for v in ut.imatch(v) do 368 l[#l+1] = v 369 end 370 371 if #l == 0 then 372 l[1] = "?" 373 end 374 375 return table.concat(l, ", ") 376 end 377 378 o = s4:option(DummyValue, "AdvDNSSLLifetime", translate("Lifetime")) 379 function o.cfgvalue(self, section) 380 local v = Value.cfgvalue(self, section) or "1200" 381 return translate(v) 382 end 383 384 305 385 return m -
luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua
r6715 r6808 14 14 15 15 local sid = arg[1] 16 local utl = require "luci.util" 16 17 17 18 m = Map("radvd", translatef("Radvd - Interface %q", "?"), … … 85 86 86 87 88 o = s:taboption("general", DynamicList, "client", translate("Clients"), 89 translate("Restrict communication to specified clients, leave empty to use multicast")) 90 91 o.rmempty = true 92 o.datatype = "ip6addr" 93 o.placeholder = "any" 94 function o.cfgvalue(...) 95 local v = Value.cfgvalue(...) 96 local l = { } 97 for v in utl.imatch(v) do 98 l[#l+1] = v 99 end 100 return l 101 end 102 103 87 104 o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"), 88 105 translate("Enables router advertisements and solicitations")) -
luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua
r6715 r6808 14 14 15 15 local sid = arg[1] 16 local utl = require "luci.util" 16 17 17 18 m = Map("radvd", translatef("Radvd - Prefix"), … … 76 77 77 78 78 o = s:taboption("general", Value, "prefix", translate("Prefix"),79 translate("Advertised IPv6 prefix . If empty, the current interface prefix is used"))79 o = s:taboption("general", DynamicList, "prefix", translate("Prefixes"), 80 translate("Advertised IPv6 prefixes. If empty, the current interface prefix is used")) 80 81 81 o.optional = true 82 o.datatype = "ip6addr" 82 o.optional = true 83 o.datatype = "ip6addr" 84 o.placeholder = translate("default") 85 function o.cfgvalue(self, section) 86 local l = { } 87 local v = m.uci:get_list("radvd", section, "prefix") 88 for v in utl.imatch(v) do 89 l[#l+1] = v 90 end 91 return l 92 end 83 93 84 94 -
luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua
r6715 r6808 14 14 15 15 local sid = arg[1] 16 local utl = require "luci.util" 16 17 17 18 m = Map("radvd", translatef("Radvd - RDNSS"), … … 73 74 74 75 75 o = s:option( Value, "addr", translate("Address"),76 o = s:option(DynamicList, "addr", translate("Addresses"), 76 77 translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used")) 77 78 78 o.optional = false 79 o.rmempty = true 80 o.datatype = "ip6addr" 81 82 83 o = s:option(Flag, "AdvRDNSSOpen", translate("Open"), 84 translate("Indicates whether that RDNSS continues to be available to hosts even if they moved to a different subnet ")) 79 o.optional = false 80 o.rmempty = true 81 o.datatype = "ip6addr" 82 o.placeholder = translate("default") 83 function o.cfgvalue(self, section) 84 local l = { } 85 local v = m.uci:get_list("radvd", section, "prefix") 86 for v in utl.imatch(v) do 87 l[#l+1] = v 88 end 89 return l 90 end 85 91 86 92 -
luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua
r6715 r6808 14 14 15 15 local sid = arg[1] 16 local utl = require "luci.util" 16 17 17 18 m = Map("radvd", translatef("Radvd - Route"), … … 73 74 74 75 75 o = s:option( Value, "prefix", translate("Prefix"),76 translate("Advertised IPv6 prefix "))76 o = s:option(DynamicList, "prefix", translate("Prefixes"), 77 translate("Advertised IPv6 prefixes")) 77 78 78 o.rmempty = false 79 o.datatype = "ip6addr" 79 o.rmempty = false 80 o.datatype = "ip6addr" 81 o.placeholder = translate("default") 82 function o.cfgvalue(self, section) 83 local l = { } 84 local v = m.uci:get_list("radvd", section, "prefix") 85 for v in utl.imatch(v) do 86 l[#l+1] = v 87 end 88 return l 89 end 80 90 81 91
