Changeset 6808

Show
Ignore:
Timestamp:
01/29/11 05:27:37 (2 years ago)
Author:
jow
Message:

applications/luci-radvd: sync with OpenWrt? trunk changes

Location:
luci/trunk/applications/luci-radvd/luasrc
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/applications/luci-radvd/luasrc/controller/radvd.lua

    r6527 r6808  
    2525    entry({"admin", "network", "radvd", "route"}, cbi("radvd/route"), nil).leaf = true 
    2626    entry({"admin", "network", "radvd", "rdnss"}, cbi("radvd/rdnss"), nil).leaf = true 
     27    entry({"admin", "network", "radvd", "dnssl"}, cbi("radvd/dnssl"), nil).leaf = true 
    2728end 
  • luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd.lua

    r6715 r6808  
    1919 
    2020local nm = require "luci.model.network".init(m.uci) 
     21local ut = require "luci.util" 
    2122 
    2223 
     
    7071 
    7172o = 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") 
     73function 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") 
    7577end 
    7678 
     
    134136o.width = "60%" 
    135137function 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 
    137141    if not v then 
    138142        local net = nm:get_network(m.uci:get("radvd", section, "interface")) 
     
    150154            end 
    151155        end 
    152     else 
     156    end 
     157 
     158    for v in ut.imatch(v) do 
    153159        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, ", ") 
    158170end 
    159171 
     
    211223o.width = "60%" 
    212224function o.cfgvalue(self, section) 
    213     local v = Value.cfgvalue(self, section) 
     225    local v = m.uci:get_list("radvd", section, "prefix") 
     226    local l = { } 
    214227    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, ", ") 
    219241end 
    220242 
     
    266288o.width = "60%" 
    267289function o.cfgvalue(self, section) 
    268     local v = Value.cfgvalue(self, section) 
     290    local v = m.uci:get_list("radvd", section, "addr") 
     291    local l = { } 
    269292    if not v then 
    270293        local net = nm:get_network(m.uci:get("radvd", section, "interface")) 
     
    282305            end 
    283306        end 
    284     else 
     307    end 
     308 
     309    for v in ut.imatch(v) do 
    285310        v = luci.ip.IPv6(v) 
    286         v = v and v:network(128):string() 
    287     end 
    288  
    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, ", ") 
    296321end 
    297322 
     
    303328 
    304329 
     330-- 
     331-- DNSSL 
     332-- 
     333 
     334s4 = m:section(TypedSection, "dnssl", translate("DNSSL")) 
     335s4.template = "cbi/tblsection" 
     336s4.extedit  = luci.dispatcher.build_url("admin/network/radvd/dnssl/%s") 
     337s4.addremove = true 
     338s4.anonymous = true 
     339 
     340function s.create(...) 
     341    local id = TypedSection.create(...) 
     342    luci.http.redirect(s4.extedit % id) 
     343end 
     344 
     345 
     346o = s4:option(Flag, "ignore", translate("Enable")) 
     347o.rmempty = false 
     348o.width   = "30px" 
     349function o.cfgvalue(...) 
     350    local v = Flag.cfgvalue(...) 
     351    return v == "1" and "0" or "1" 
     352end 
     353function o.write(self, section, value) 
     354    Flag.write(self, section, value == "1" and "0" or "1") 
     355end 
     356 
     357o = s4:option(DummyValue, "interface", translate("Interface")) 
     358o.template = "cbi/network_netinfo" 
     359o.width    = "10%" 
     360 
     361o = s4:option(DummyValue, "suffix", translate("Suffix")) 
     362o.width = "60%" 
     363function 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, ", ") 
     376end 
     377 
     378o = s4:option(DummyValue, "AdvDNSSLLifetime", translate("Lifetime")) 
     379function o.cfgvalue(self, section) 
     380    local v = Value.cfgvalue(self, section) or "1200" 
     381    return translate(v) 
     382end 
     383 
     384 
    305385return m 
  • luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/interface.lua

    r6715 r6808  
    1414 
    1515local sid = arg[1] 
     16local utl = require "luci.util" 
    1617 
    1718m = Map("radvd", translatef("Radvd - Interface %q", "?"), 
     
    8586 
    8687 
     88o = s:taboption("general", DynamicList, "client", translate("Clients"), 
     89    translate("Restrict communication to specified clients, leave empty to use multicast")) 
     90 
     91o.rmempty     = true 
     92o.datatype    = "ip6addr" 
     93o.placeholder = "any" 
     94function 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 
     101end 
     102 
     103 
    87104o = s:taboption("general", Flag, "AdvSendAdvert", translate("Enable advertisements"), 
    88105    translate("Enables router advertisements and solicitations")) 
  • luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/prefix.lua

    r6715 r6808  
    1414 
    1515local sid = arg[1] 
     16local utl = require "luci.util" 
    1617 
    1718m = Map("radvd", translatef("Radvd - Prefix"), 
     
    7677 
    7778 
    78 o = s:taboption("general", Value, "prefix", translate("Prefix"), 
    79     translate("Advertised IPv6 prefix. If empty, the current interface prefix is used")) 
     79o = s:taboption("general", DynamicList, "prefix", translate("Prefixes"), 
     80    translate("Advertised IPv6 prefixes. If empty, the current interface prefix is used")) 
    8081 
    81 o.optional = true 
    82 o.datatype = "ip6addr" 
     82o.optional    = true 
     83o.datatype    = "ip6addr" 
     84o.placeholder = translate("default") 
     85function 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 
     92end 
    8393 
    8494 
  • luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/rdnss.lua

    r6715 r6808  
    1414 
    1515local sid = arg[1] 
     16local utl = require "luci.util" 
    1617 
    1718m = Map("radvd", translatef("Radvd - RDNSS"), 
     
    7374 
    7475 
    75 o = s:option(Value, "addr", translate("Address"), 
     76o = s:option(DynamicList, "addr", translate("Addresses"), 
    7677    translate("Advertised IPv6 RDNSS. If empty, the current IPv6 address of the interface is used")) 
    7778 
    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 ")) 
     79o.optional    = false 
     80o.rmempty     = true 
     81o.datatype    = "ip6addr" 
     82o.placeholder = translate("default") 
     83function 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 
     90end 
    8591 
    8692 
  • luci/trunk/applications/luci-radvd/luasrc/model/cbi/radvd/route.lua

    r6715 r6808  
    1414 
    1515local sid = arg[1] 
     16local utl = require "luci.util" 
    1617 
    1718m = Map("radvd", translatef("Radvd - Route"), 
     
    7374 
    7475 
    75 o = s:option(Value, "prefix", translate("Prefix"), 
    76     translate("Advertised IPv6 prefix")) 
     76o = s:option(DynamicList, "prefix", translate("Prefixes"), 
     77    translate("Advertised IPv6 prefixes")) 
    7778 
    78 o.rmempty = false 
    79 o.datatype = "ip6addr" 
     79o.rmempty     = false 
     80o.datatype    = "ip6addr" 
     81o.placeholder = translate("default") 
     82function 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 
     89end 
    8090 
    8191