module("luci.controller.olsr", package.seeall)
function index()
- if not luci.fs.isfile("/etc/config/olsrd") then
+ if not nixio.fs.access("/etc/config/olsrd") then
return
end
page.target = call("action_index")
page.title = "OLSR"
page.i18n = "olsr"
+ page.subindex = true
local page = node("admin", "status", "olsr", "routes")
page.target = call("action_routes")
page.title = "MID"
page.order = 50
- entry(
+ local ol = entry(
{"admin", "services", "olsrd"},
cbi("olsr/olsrd"), "OLSR"
- ).i18n = "olsr"
+ )
+ ol.i18n = "olsr"
+ ol.subindex = true
entry(
{"admin", "services", "olsrd", "hna"},
cbi("olsr/olsrdhna"), "HNA Announcements"
- ).i18n = "olsr"
+ )
- entry(
+ oplg = entry(
{"admin", "services", "olsrd", "plugins"},
cbi("olsr/olsrdplugins"), "Plugins"
- ).i18n = "olsr"
+ )
+ oplg.i18n = "olsr"
+ oplg.leaf = true
+ oplg.subindex = true
+
+ local uci = require("luci.model.uci").cursor()
+ uci:foreach("olsrd", "LoadPlugin",
+ function (section)
+ local lib = section.library
+ entry(
+ {"admin", "services", "olsrd", "plugins", lib },
+ cbi("olsr/olsrdplugins"),
+ nil --'Plugin "%s"' % lib:gsub("^olsrd_",""):gsub("%.so.+$","")
+ )
+ end
+ )
end
function action_index()
end
local function compare(a, b)
- local c = tonumber(a.ETX)
- local d = tonumber(b.ETX)
+ local c = tonumber(a.Cost)
+ local d = tonumber(b.Cost)
if not c or c == 0 then
return false
end
local function compare(a, b)
- return a["Destination IP"] < b["Destination IP"]
+ return a["Dest. IP"] < b["Dest. IP"]
end
table.sort(data.Topology, compare)
end
local function compare(a, b)
- return a.Network < b.Network
+ return a.Destination < b.Destination
end
table.sort(data.HNA, compare)
end
local function compare(a, b)
- return a.IP < b.IP
+ return a["IP address"] < b["IP address"]
end
table.sort(data.MID, compare)
local rawdata = luci.sys.httpget("http://127.0.0.1:2006/"..otable)
if #rawdata == 0 then
- return nil
+ if nixio.fs.access("/proc/net/ipv6_route", "r") then
+ rawdata = luci.sys.httpget("http://[::1]:2006/"..otable)
+ if #rawdata == 0 then
+ return nil
+ end
+ else
+ return nil
+ end
end
local data = {}