summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-olsr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-09-13 05:17:20 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-09-13 05:17:20 +0000
commit61fe05ef43b42887ec27dc2f07ef0c73ca91426b (patch)
tree79e071685a2567707ee00b736d981899f999bbc4 /applications/luci-olsr
parentd124dd9bb5f843c2f3c73a37a04c4df470468f1e (diff)
* luci/app-olsr: fix olsrplugins page
Diffstat (limited to 'applications/luci-olsr')
-rw-r--r--applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua2
-rw-r--r--applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua43
2 files changed, 32 insertions, 13 deletions
diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
index 7e134cc6d..1ea3d9762 100644
--- a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
+++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
@@ -120,7 +120,7 @@ adc.disabled = "no"
adc.optional = true
-ipc = m:section(NamedSection, "IpcConnect")
+ipc = m:section(TypedSection, "IpcConnect")
conns = ipc:option(Value, "MaxConnections")
conns.isInteger = true
diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua
index 83ed74ac9..236276d47 100644
--- a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua
+++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua
@@ -25,6 +25,7 @@ p.anonymous = true
ign = p:option(Flag, "ignore")
ign.enabled = "1"
ign.disabled = "0"
+ign.optional = true
lib = p:option(ListValue, "library", translate("library"))
lib:value("")
@@ -41,19 +42,34 @@ local function Range(x,y)
end
local function Cidr2IpMask(val)
- local cidr = luci.ip.IPv4(val) or luci.ip.IPv6(val)
- if not cidr then return val else return cidr end
+ if val then
+ for i = 1, #val do
+ local cidr = luci.ip.IPv4(val[i]) or luci.ip.IPv6(val[i])
+ if cidr then
+ val[i] = cidr:network():string() .. " " .. cidr:mask():string()
+ end
+ end
+ return val
+ end
end
local function IpMask2Cidr(val)
- local ip, mask = val:gmatch("([^%s+])%s+([^%s+])")
- local cidr
- if ip and mask and ip:match(":") then
- cidr = luci.ip.IPv6(ip, mask)
- elseif ip and mask then
- cidr = luci.ip.IPv4(ip, mask)
+ if val then
+ for i = 1, #val do
+ local ip, mask = val[i]:gmatch("([^%s+])%s+([^%s+])")()
+ local cidr
+ if ip and mask and ip:match(":") then
+ cidr = luci.ip.IPv6(ip, mask)
+ elseif ip and mask then
+ cidr = luci.ip.IPv4(ip, mask)
+ end
+
+ if cidr then
+ val[i] = cidr:string()
+ end
+ end
+ return val
end
- if not cidr then return val else return cidr end
end
@@ -66,19 +82,19 @@ local knownPlParams = {
{ ListValue, "BmfMechanism", { "UnicastPromiscuous", "Broadcast" } },
{ Value, "BroadcastRetransmitCount", "2" },
{ Value, "FanOutLimit", "4" },
- { DynamicList, "NonOlsrIf", "eth1" },
+ { DynamicList, "NonOlsrIf", "eth1" }
},
["olsrd_dyn_gw.so.0.4"] = {
{ Value, "Interval", "40" },
{ DynamicList, "Ping", "141.1.1.1" },
- { DynamicList, "HNA", "192.168.80.0/24", Cidr2IpMask, IpMask2Cidr }
+ { DynamicList, "HNA", "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask }
},
["olsrd_httpinfo.so.0.1"] = {
{ Value, "port", "80" },
{ DynamicList, "Host", "163.24.87.3" },
- { DynamicList, "Net", "0.0.0.0/0", Cidr2IpMask, IpMask2Cidr },
+ { DynamicList, "Net", "0.0.0.0/0", IpMask2Cidr, Cidr2IpMask }
},
["olsrd_nameservice.so.0.2"] = {
@@ -165,6 +181,9 @@ for plugin, options in pairs(knownPlParams) do
return cbi2uci(otype.formvalue(self, section))
end
end
+ if otype == DynamicList then
+ field:value( default )
+ end
field.default = default
field:depends({ library = plugin })
end