Merge pull request #2355 from pmelange/freifunk_backport_18.06

Freifunk-berlin backport 18.06 - OLSR changes and community profiles
This commit is contained in:
Jo-Philipp Wich 2018-12-07 00:09:43 +01:00 committed by GitHub
commit 3dea6b5bc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 292 additions and 203 deletions

View file

@ -4,7 +4,7 @@ function index()
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
uci:foreach("olsrd", "LoadPlugin", function(s) uci:foreach("olsrd", "LoadPlugin", function(s)
if s.library == "olsrd_nameservice.so.0.3" then if s.library == "olsrd_nameservice" then
has_serv = true has_serv = true
end end
end) end)

View file

@ -16,7 +16,7 @@ local uci = require "luci.model.uci".cursor()
local ip = require "luci.ip" local ip = require "luci.ip"
uci:foreach("olsrd", "LoadPlugin", function(s) uci:foreach("olsrd", "LoadPlugin", function(s)
if s.library == "olsrd_nameservice.so.0.3" then if s.library == "olsrd_nameservice" then
local services_file=s.services_file local services_file=s.services_file
if services_file and fs.access(services_file) then if services_file and fs.access(services_file) then
has_services = true has_services = true
@ -126,15 +126,20 @@ end
var tbody = document.getElementById('olsr_services'); var tbody = document.getElementById('olsr_services');
if (tbody) if (tbody)
{ {
var s = ''; var s = '<div class="tr cbi-section-table-titles">' +
'<div class="th cbi-section-table-cell"><%:Url%></div>' +
'<div class="th cbi-section-table-cell"><%:Protocol%></div>' +
'<div class="th cbi-section-table-cell"><%:Source%></div>' +
'</div>';
for (var idx = 0; idx < info.length; idx++) for (var idx = 0; idx < info.length; idx++)
{ {
var service = info[idx]; var service = info[idx];
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+'">' +
'<div class="td cbi-section-table-titles"><a href="%s">%s</a></div>' + '<div class="td cbi-section-table-cell left"><a href="%s">%s</a></div>' +
'<div class="td cbi-section-table-titles">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-titles"><a href="http://%s/cgi-bin-status.html">%s</a></div>' + '<div class="td cbi-section-table-cell left"><a href="http://%s/cgi-bin-status.html">%s</a></div>' +
'</div>', '</div>',
service.url, service.descr, service.proto, service.origin_link, service.origin || '?' service.url, service.descr, service.proto, service.origin_link, service.origin || '?'
); );
@ -152,16 +157,13 @@ end
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Internal services%></legend> <legend><%:Internal services%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table" id="olsr_services">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Url%></div> <div class="th cbi-section-table-cell"><%:Url%></div>
<div class="th cbi-section-table-cell"><%:Protocol%></div> <div class="th cbi-section-table-cell"><%:Protocol%></div>
<div class="th cbi-section-table-cell"><%:Source%></div> <div class="th cbi-section-table-cell"><%:Source%></div>
</div> </div>
</div>
<div class="tbody" id="olsr_services">
<% <%
for k, line in ipairs(services) do for k, line in ipairs(services) do
local field = {} local field = {}
@ -178,14 +180,13 @@ end
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%>">
<div class="td cbi-section-table-titles"><a href="<%=url%>"><%=descr%></a></div> <div class="td cbi-section-table-cell left"><a href="<%=url%>"><%=descr%></a></div>
<div class="td cbi-section-table-titles"><%=proto%></div> <div class="td cbi-section-table-cell left"><%=proto%></div>
<div class="td cbi-section-table-titles"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></div> <div class="td cbi-section-table-cell left"><a href="http://<%=origin_link%>/cgi-bin-status.html"><%=origin%></a></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div> </div>
</div>
<br /> <br />
<%=last_update%> <%=last_update%>
</fieldset> </fieldset>

View file

@ -87,8 +87,8 @@ function action_json()
local v4_port = tonumber(uci:get("olsrd", "olsrd_jsoninfo", "port") or "") or 9090 local v4_port = tonumber(uci:get("olsrd", "olsrd_jsoninfo", "port") or "") or 9090
local v6_port = tonumber(uci:get("olsrd6", "olsrd_jsoninfo", "port") or "") or 9090 local v6_port = tonumber(uci:get("olsrd6", "olsrd_jsoninfo", "port") or "") or 9090
jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v4_port) jsonreq4 = utl.exec("(echo /all | nc 127.0.0.1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v4_port)
jsonreq6 = utl.exec("(echo /status | nc ::1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v6_port) jsonreq6 = utl.exec("(echo /all | nc ::1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v6_port)
http.prepare_content("application/json") http.prepare_content("application/json")
if not jsonreq4 or jsonreq4 == "" then if not jsonreq4 or jsonreq4 == "" then
jsonreq4 = "{}" jsonreq4 = "{}"
@ -300,7 +300,7 @@ function action_mid()
local function compare(a,b) local function compare(a,b)
if a.proto == b.proto then if a.proto == b.proto then
return a.ipAddress < b.ipAddress return a.main.ipAddress < b.main.ipAddress
else else
return a.proto < b.proto return a.proto < b.proto
end end
@ -318,18 +318,21 @@ function action_smartgw()
local function compare(a,b) local function compare(a,b)
if a.proto == b.proto then if a.proto == b.proto then
return a.tcPathCost < b.tcPathCost return a.cost < b.cost
else else
return a.proto < b.proto return a.proto < b.proto
end end
end end
table.sort(data, compare) table.sort(data.ipv4, compare)
table.sort(data.ipv6, compare)
luci.template.render("status-olsr/smartgw", {gws=data, has_v4=has_v4, has_v6=has_v6}) luci.template.render("status-olsr/smartgw", {gws=data, has_v4=has_v4, has_v6=has_v6})
end end
function action_interfaces() function action_interfaces()
local data, has_v4, has_v6, error = fetch_jsoninfo('interfaces') local data, has_v4, has_v6, error = fetch_jsoninfo('interfaces')
local ntm = require "luci.model.network".init()
if error then if error then
return return
end end
@ -338,6 +341,13 @@ function action_interfaces()
return a.proto < b.proto return a.proto < b.proto
end end
for k, v in ipairs(data) do
local interface = ntm:get_status_by_address(v.olsrInterface.ipAddress)
if interface then
v.interface = interface
end
end
table.sort(data, compare) table.sort(data, compare)
luci.template.render("status-olsr/interfaces", {iface=data, has_v4=has_v4, has_v6=has_v6}) luci.template.render("status-olsr/interfaces", {iface=data, has_v4=has_v4, has_v6=has_v6})
end end

View file

@ -62,7 +62,7 @@ if arg[1] then
local knownPlParams = { local knownPlParams = {
["olsrd_bmf.so.1.5.3"] = { ["olsrd_bmf"] = {
{ Value, "BmfInterface", "bmf0" }, { Value, "BmfInterface", "bmf0" },
{ Value, "BmfInterfaceIp", "10.10.10.234/24" }, { Value, "BmfInterfaceIp", "10.10.10.234/24" },
{ Flag, "DoLocalBroadcast", "no" }, { Flag, "DoLocalBroadcast", "no" },
@ -73,19 +73,19 @@ if arg[1] then
{ DynamicList, "NonOlsrIf", "br-lan" } { DynamicList, "NonOlsrIf", "br-lan" }
}, },
["olsrd_dyn_gw.so.0.4"] = { ["olsrd_dyn_gw"] = {
{ Value, "Interval", "40" }, { Value, "Interval", "40" },
{ DynamicList, "Ping", "141.1.1.1" }, { DynamicList, "Ping", "141.1.1.1" },
{ DynamicList, "HNA", "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask } { DynamicList, "HNA", "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask }
}, },
["olsrd_httpinfo.so.0.1"] = { ["olsrd_httpinfo"] = {
{ Value, "port", "80" }, { Value, "port", "80" },
{ DynamicList, "Host", "163.24.87.3" }, { DynamicList, "Host", "163.24.87.3" },
{ DynamicList, "Net", "0.0.0.0/0", Cidr2IpMask } { DynamicList, "Net", "0.0.0.0/0", Cidr2IpMask }
}, },
["olsrd_nameservice.so.0.3"] = { ["olsrd_nameservice"] = {
{ DynamicList, "name", "my-name.mesh" }, { DynamicList, "name", "my-name.mesh" },
{ DynamicList, "hosts", "1.2.3.4 name-for-other-interface.mesh" }, { DynamicList, "hosts", "1.2.3.4 name-for-other-interface.mesh" },
{ Value, "suffix", ".olsr" }, { Value, "suffix", ".olsr" },
@ -109,7 +109,7 @@ if arg[1] then
{ Value, "macs_change_script", "/path/to/script" } { Value, "macs_change_script", "/path/to/script" }
}, },
["olsrd_quagga.so.0.2.2"] = { ["olsrd_quagga"] = {
{ StaticList, "redistribute", { { StaticList, "redistribute", {
"system", "kernel", "connect", "static", "rip", "ripng", "ospf", "system", "kernel", "connect", "static", "rip", "ripng", "ospf",
"ospf6", "isis", "bgp", "hsls" "ospf6", "isis", "bgp", "hsls"
@ -119,40 +119,40 @@ if arg[1] then
{ Value, "Distance", Range(0,255) } { Value, "Distance", Range(0,255) }
}, },
["olsrd_secure.so.0.5"] = { ["olsrd_secure"] = {
{ Value, "Keyfile", "/etc/private-olsr.key" } { Value, "Keyfile", "/etc/private-olsr.key" }
}, },
["olsrd_txtinfo.so.0.1"] = { ["olsrd_txtinfo"] = {
{ Value, "accept", "127.0.0.1" } { Value, "accept", "127.0.0.1" }
}, },
["olsrd_jsoninfo.so.0.0"] = { ["olsrd_jsoninfo"] = {
{ Value, "accept", "127.0.0.1" }, { Value, "accept", "127.0.0.1" },
{ Value, "port", "9090" }, { Value, "port", "9090" },
{ Value, "UUIDFile", "/etc/olsrd/olsrd.uuid" }, { Value, "UUIDFile", "/etc/olsrd/olsrd.uuid" },
}, },
["olsrd_watchdog.so.0.1"] = { ["olsrd_watchdog"] = {
{ Value, "file", "/var/run/olsrd.watchdog" }, { Value, "file", "/var/run/olsrd.watchdog" },
{ Value, "interval", "30" } { Value, "interval", "30" }
}, },
["olsrd_mdns.so.1.0.0"] = { ["olsrd_mdns"] = {
{ DynamicList, "NonOlsrIf", "lan" } { DynamicList, "NonOlsrIf", "lan" }
}, },
["olsrd_p2pd.so.0.1.0"] = { ["olsrd_p2pd"] = {
{ DynamicList, "NonOlsrIf", "lan" }, { DynamicList, "NonOlsrIf", "lan" },
{ Value, "P2pdTtl", "10" } { Value, "P2pdTtl", "10" }
}, },
["olsrd_arprefresh.so.0.1"] = {}, ["olsrd_arprefresh"] = {},
["olsrd_dot_draw.so.0.3"] = {}, ["olsrd_dot_draw"] = {},
["olsrd_dyn_gw_plain.so.0.4"] = {}, ["olsrd_dyn_gw_plain"] = {},
["olsrd_pgraph.so.1.1"] = {}, ["olsrd_pgraph"] = {},
["olsrd_tas.so.0.1"] = {} ["olsrd_tas"] = {}
} }
@ -227,6 +227,7 @@ else
-- create a loadplugin section for each found plugin -- create a loadplugin section for each found plugin
for v in fs.dir("/usr/lib") do for v in fs.dir("/usr/lib") do
if v:sub(1, 6) == "olsrd_" then if v:sub(1, 6) == "olsrd_" then
v = string.match(v, "^(olsrd.*)%.so%..*")
if not plugins[v] then if not plugins[v] then
mpi.uci:section( mpi.uci:section(
"olsrd", "LoadPlugin", nil, "olsrd", "LoadPlugin", nil,

View file

@ -62,7 +62,7 @@ if arg[1] then
local knownPlParams = { local knownPlParams = {
["olsrd_bmf.so.1.5.3"] = { ["olsrd_bmf"] = {
{ Value, "BmfInterface", "bmf0" }, { Value, "BmfInterface", "bmf0" },
{ Value, "BmfInterfaceIp", "10.10.10.234/24" }, { Value, "BmfInterfaceIp", "10.10.10.234/24" },
{ Flag, "DoLocalBroadcast", "no" }, { Flag, "DoLocalBroadcast", "no" },
@ -73,19 +73,19 @@ if arg[1] then
{ DynamicList, "NonOlsrIf", "br-lan" } { DynamicList, "NonOlsrIf", "br-lan" }
}, },
["olsrd_dyn_gw.so.0.4"] = { ["olsrd_dyn_gw"] = {
{ Value, "Interval", "40" }, { Value, "Interval", "40" },
{ DynamicList, "Ping", "141.1.1.1" }, { DynamicList, "Ping", "141.1.1.1" },
{ DynamicList, "HNA", "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask } { DynamicList, "HNA", "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask }
}, },
["olsrd_httpinfo.so.0.1"] = { ["olsrd_httpinfo"] = {
{ Value, "port", "80" }, { Value, "port", "80" },
{ DynamicList, "Host", "163.24.87.3" }, { DynamicList, "Host", "163.24.87.3" },
{ DynamicList, "Net", "0.0.0.0/0", Cidr2IpMask } { DynamicList, "Net", "0.0.0.0/0", Cidr2IpMask }
}, },
["olsrd_nameservice.so.0.3"] = { ["olsrd_nameservice"] = {
{ DynamicList, "name", "my-name.mesh" }, { DynamicList, "name", "my-name.mesh" },
{ DynamicList, "hosts", "1.2.3.4 name-for-other-interface.mesh" }, { DynamicList, "hosts", "1.2.3.4 name-for-other-interface.mesh" },
{ Value, "suffix", ".olsr" }, { Value, "suffix", ".olsr" },
@ -109,7 +109,7 @@ if arg[1] then
{ Value, "macs_change_script", "/path/to/script" } { Value, "macs_change_script", "/path/to/script" }
}, },
["olsrd_quagga.so.0.2.2"] = { ["olsrd_quagga"] = {
{ StaticList, "redistribute", { { StaticList, "redistribute", {
"system", "kernel", "connect", "static", "rip", "ripng", "ospf", "system", "kernel", "connect", "static", "rip", "ripng", "ospf",
"ospf6", "isis", "bgp", "hsls" "ospf6", "isis", "bgp", "hsls"
@ -119,40 +119,40 @@ if arg[1] then
{ Value, "Distance", Range(0,255) } { Value, "Distance", Range(0,255) }
}, },
["olsrd_secure.so.0.5"] = { ["olsrd_secure"] = {
{ Value, "Keyfile", "/etc/private-olsr.key" } { Value, "Keyfile", "/etc/private-olsr.key" }
}, },
["olsrd_txtinfo.so.0.1"] = { ["olsrd_txtinfo"] = {
{ Value, "accept", "::1/128" } { Value, "accept", "::1/128" }
}, },
["olsrd_jsoninfo.so.0.0"] = { ["olsrd_jsoninfo"] = {
{ Value, "accept", "::1/128" }, { Value, "accept", "::1/128" },
{ Value, "port", "9090" }, { Value, "port", "9090" },
{ Value, "UUIDFile", "/etc/olsrd/olsrd.uuid.ipv6" }, { Value, "UUIDFile", "/etc/olsrd/olsrd.uuid.ipv6" },
}, },
["olsrd_watchdog.so.0.1"] = { ["olsrd_watchdog"] = {
{ Value, "file", "/var/run/olsrd.watchdog.ipv6" }, { Value, "file", "/var/run/olsrd.watchdog.ipv6" },
{ Value, "interval", "30" } { Value, "interval", "30" }
}, },
["olsrd_mdns.so.1.0.0"] = { ["olsrd_mdns.so"] = {
{ DynamicList, "NonOlsrIf", "lan" } { DynamicList, "NonOlsrIf", "lan" }
}, },
["olsrd_p2pd.so.0.1.0"] = { ["olsrd_p2pd.so"] = {
{ DynamicList, "NonOlsrIf", "lan" }, { DynamicList, "NonOlsrIf", "lan" },
{ Value, "P2pdTtl", "10" } { Value, "P2pdTtl", "10" }
}, },
["olsrd_arprefresh.so.0.1"] = {}, ["olsrd_arprefresh"] = {},
["olsrd_dot_draw.so.0.3"] = {}, ["olsrd_dot_draw"] = {},
["olsrd_dyn_gw_plain.so.0.4"] = {}, ["olsrd_dyn_gw_plain"] = {},
["olsrd_pgraph.so.1.1"] = {}, ["olsrd_pgraph"] = {},
["olsrd_tas.so.0.1"] = {} ["olsrd_tas"] = {}
} }
@ -227,6 +227,7 @@ else
-- create a loadplugin section for each found plugin -- create a loadplugin section for each found plugin
for v in fs.dir("/usr/lib") do for v in fs.dir("/usr/lib") do
if v:sub(1, 6) == "olsrd_" then if v:sub(1, 6) == "olsrd_" then
v=string.match(v, "^(olsrd_.*)%.so%..*")
if not plugins[v] then if not plugins[v] then
mpi.uci:section( mpi.uci:section(
"olsrd6", "LoadPlugin", nil, "olsrd6", "LoadPlugin", nil,

View file

@ -35,7 +35,12 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
var hnadiv = document.getElementById('olsrd_hna'); var hnadiv = document.getElementById('olsrd_hna');
if (hnadiv) if (hnadiv)
{ {
var s = ''; var s = '<div class="tr cbi-section-table-titles">' +
'<div class="th cbi-section-table-cell"><%:Announced network%></div>' +
'<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' +
'<div class="th cbi-section-table-cell"><%:Validity Time%></div>' +
'</div>';
for (var idx = 0; idx < info.length; idx++) for (var idx = 0; idx < info.length; idx++)
{ {
var hna = info[idx]; var hna = info[idx];
@ -60,9 +65,9 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity '<div class="td cbi-section-table-cell left">%s</div>', hna.destination + '/' + hna.genmask, linkgw + hostname, validity
) )
s += '</div>' s += '</div>'
} }
@ -78,21 +83,18 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Overview of currently active OLSR host net announcements%></legend> <legend><%:Overview of currently active OLSR host net announcements%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table" id="olsrd_hna">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Announced network%></div> <div class="th cbi-section-table-cell"><%:Announced network%></div>
<div class="th cbi-section-table-cell"><%:OLSR gateway%></div> <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
<div class="th cbi-section-table-cell"><%:Validity Time%></div> <div class="th cbi-section-table-cell"><%:Validity Time%></div>
</div> </div>
</div>
<div class="tbody" id="olsrd_hna">
<% for k, route in ipairs(hna) do %> <% for k, route in ipairs(hna) do %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=hna[k].proto%>">
<div class="td cbi-section-table-cell"><%=hna[k].destination%>/<%=hna[k].genmask%> </div> <div class="td cbi-section-table-cell left"><%=hna[k].destination%>/<%=hna[k].genmask%> </div>
<div class="td cbi-section-table-cell"> <div class="td cbi-section-table-cell left">
<% if hna[k].proto == '6' then %> <% if hna[k].proto == '6' then %>
<a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a> <a href="http://[<%=hna[k].gateway%>]/cgi-bin-status.html"><%=hna[k].gateway%></a>
<% else %> <% else %>
@ -108,13 +110,12 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
validity = '-' validity = '-'
end %> end %>
<div class="td cbi-section-table-cell"><%=validity%></div> <div class="td cbi-section-table-cell left"><%=validity%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div> </div>
</div>
</fieldset> </fieldset>
<%+status-olsr/common_js%> <%+status-olsr/common_js%>

View file

@ -21,6 +21,7 @@ local i = 1
<div class="table cbi-section-table"> <div class="table cbi-section-table">
<div class="tr"> <div class="tr">
<div class="th cbi-section-table-cell"><%:Interface%></div> <div class="th cbi-section-table-cell"><%:Interface%></div>
<div class="th cbi-section-table-cell"><%:Device%></div>
<div class="th cbi-section-table-cell"><%:State%></div> <div class="th cbi-section-table-cell"><%:State%></div>
<div class="th cbi-section-table-cell"><%:MTU%></div> <div class="th cbi-section-table-cell"><%:MTU%></div>
<div class="th cbi-section-table-cell"><%:WLAN%></div> <div class="th cbi-section-table-cell"><%:WLAN%></div>
@ -32,13 +33,14 @@ local i = 1
<% for k, iface in ipairs(iface) do %> <% for k, iface in ipairs(iface) do %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=iface.proto%>">
<div class="td cbi-section-table-cell"><%=iface.name%></div> <div class="td cbi-section-table-cell left"><%=iface.interface%></div>
<div class="td cbi-section-table-cell"><%=iface.state%></div> <div class="td cbi-section-table-cell left"><%=iface.name%></div>
<div class="td cbi-section-table-cell"><%=iface.olsrMTU%></div> <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.up and luci.i18n.translate('up') or luci.i18n.translate('down')%></div>
<div class="td cbi-section-table-cell"><%=iface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.mtu%></div>
<div class="td cbi-section-table-cell"><%=iface.ipv4Address or iface.ipv6Address%></div> <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.wireless and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=iface.netmask%></div> <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipAddress%></div>
<div class="td cbi-section-table-cell"><%=iface.broadcast or iface.multicast%></div> <div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Netmask%></div>
<div class="td cbi-section-table-cell left"><%=iface.olsrInterface.ipv4Address ~= '0.0.0.0' and iface.olsrInterface.ipv4Broadcast or iface.olsrInterface.ipv6Multicast%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>

View file

@ -31,15 +31,15 @@ local i = 1
end end
aliases = v.ipAddress .. sep .. aliases aliases = v.ipAddress .. sep .. aliases
end end
local host = mid.ipAddress local host = mid.main.ipAddress
if mid.proto == '6' then if mid.proto == '6' then
host = '[' .. mid.ipAddress .. ']' host = '[' .. mid.main.ipAddress .. ']'
end end
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=mid.proto%>">
<div class="td cbi-section-table-cell"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.ipAddress%></a></div> <div class="td cbi-section-table-cell left"><a href="http://<%=host%>/cgi-bin-status.html"><%=mid.main.ipAddress%></a></div>
<div class="td cbi-section-table-cell"><%=aliases%></div> <div class="td cbi-section-table-cell left"><%=aliases%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)

View file

@ -56,7 +56,17 @@ end
var nt = document.getElementById('olsr_neigh_table'); var nt = document.getElementById('olsr_neigh_table');
if (nt) if (nt)
{ {
var s = ''; var s = '<div class="tr cbi-section-table-cell">' +
'<div class="th cbi-section-table-cell"><%:Neighbour IP%></div>' +
'<div class="th cbi-section-table-cell"><%:Hostname%></div>' +
'<div class="th cbi-section-table-cell"><%:Interface%></div>' +
'<div class="th cbi-section-table-cell"><%:Local interface IP%></div>' +
'<div class="th cbi-section-table-cell">LQ</div>' +
'<div class="th cbi-section-table-cell">NLQ</div>' +
'<div class="th cbi-section-table-cell">ETX</div>' +
'<div class="th cbi-section-table-cell">SNR</div>' +
'</div>';
for (var idx = 0; idx < info.length; idx++) for (var idx = 0; idx < info.length; idx++)
{ {
var neigh = info[idx]; var neigh = info[idx];
@ -64,34 +74,34 @@ end
if (neigh.proto == '6') { if (neigh.proto == '6') {
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://[%s]/cgi-bin-status.html">%s</a></div>',
neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
); );
} else { } else {
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>',
neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip neigh.proto, neigh.dfgcolor, neigh.rip, neigh.rip
); );
} }
if (neigh.hn) { if (neigh.hn) {
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>', '<div class="td cbi-section-table-cell left" style="background-color:%s"><a href="http://%s/cgi-bin-status.html">%s</a></div>',
neigh.dfgcolor, neigh.hn, neigh.hn neigh.dfgcolor, neigh.hn, neigh.hn
); );
} else { } else {
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s">?</div>', '<div class="td cbi-section-table-cell left" style="background-color:%s">?</div>',
neigh.dfgcolor neigh.dfgcolor
); );
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'<div class="td cbi-section-table-titles" style="background-color:%s" title="Signal: %s Noise: %s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s" title="Signal: %s Noise: %s">%s</div>' +
'</div>', '</div>',
neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?' neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?'
); );
@ -111,9 +121,8 @@ end
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Overview of currently established OLSR connections%></legend> <legend><%:Overview of currently established OLSR connections%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table" id="olsr_neigh_table">
<div class="thead"> <div class="tr cbi-section-table-cell">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Neighbour IP%></div> <div class="th cbi-section-table-cell"><%:Neighbour IP%></div>
<div class="th cbi-section-table-cell"><%:Hostname%></div> <div class="th cbi-section-table-cell"><%:Hostname%></div>
<div class="th cbi-section-table-cell"><%:Interface%></div> <div class="th cbi-section-table-cell"><%:Interface%></div>
@ -123,9 +132,7 @@ end
<div class="th cbi-section-table-cell">ETX</div> <div class="th cbi-section-table-cell">ETX</div>
<div class="th cbi-section-table-cell">SNR</div> <div class="th cbi-section-table-cell">SNR</div>
</div> </div>
</div>
<div class="tbody" id="olsr_neigh_table">
<% local i = 1 <% local i = 1
for k, link in ipairs(links) do for k, link in ipairs(links) do
link.linkCost = tonumber(link.linkCost) or 0 link.linkCost = tonumber(link.linkCost) or 0
@ -148,23 +155,22 @@ end
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=link.proto%>">
<% if link.proto == "6" then %> <% if link.proto == "6" then %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://[<%=link.remoteIP%>]/cgi-bin-status.html"><%=link.remoteIP%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.remoteIP%>/cgi-bin-status.html"><%=link.remoteIP%></a></div>
<% end %> <% end %>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><a href="http://<%=link.hostname%>/cgi-bin-status.html"><%=link.hostname%></a></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.interface%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=link.interface%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=link.localIP%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.linkQuality)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=defaultgw_color%>"><%=string.format("%.3f", link.neighborLinkQuality)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=string.format("%.3f", link.linkCost)%></div>
<div class="td cbi-section-table-titles" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=snr_color%>" title="Signal: <%=link.signal%> Noise: <%=link.noise%>"><%=link.snr%></div>
</div> </div>
<% <%
i = ((i % 2) + 1) i = ((i % 2) + 1)
end %> end %>
</div> </div>
</div>
<br /> <br />
<%+status-olsr/legend%> <%+status-olsr/legend%>

View file

@ -61,12 +61,12 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { },
if (e = document.getElementById('version')) if (e = document.getElementById('version'))
var version; var version;
var date; var date;
if (info.v4.config.olsrdVersion != undefined) { if (info.v4.version.version != undefined) {
version = info.v4.config.olsrdVersion version = info.v4.version.version
date = info.v4.config.olsrdBuildDate date = info.v4.version.date
} else if (info.v6.config.olsrdVersion != undefined) { } else if (info.v6.version.version != undefined) {
version = info.v6.config.olsrdVersion version = info.v6.version.version
date = info.v6.config.olsrdBuildDate date = info.v6.version.date
} else { } else {
version = 'unknown' version = 'unknown'
date = 'unknown' date = 'unknown'

View file

@ -13,7 +13,7 @@ local i = 1
if luci.http.formvalue("status") == "1" then if luci.http.formvalue("status") == "1" then
local rv = {} local rv = {}
for k, route in ipairs(routes) do for k, route in ipairs(routes) do
local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0) local ETX = string.format("%.3f", tonumber(route.etx) or 0)
rv[#rv+1] = { rv[#rv+1] = {
hostname = route.hostname, hostname = route.hostname,
dest = route.destination, dest = route.destination,
@ -43,21 +43,28 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
var rt = document.getElementById('olsrd_routes'); var rt = document.getElementById('olsrd_routes');
if (rt) if (rt)
{ {
var s = ''; var s = '<div class="tr cbi-section-table-cell">' +
'<div class="th cbi-section-table-cell"><%:Announced network%></div>' +
'<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' +
'<div class="th cbi-section-table-cell"><%:Interface%></div>' +
'<div class="th cbi-section-table-cell"><%:Metric%></div>' +
'<div class="th cbi-section-table-cell">ETX</div>' +
'</div>';
for (var idx = 0; idx < info.length; idx++) for (var idx = 0; idx < info.length; idx++)
{ {
var route = info[idx]; var route = info[idx];
s += String.format( s += String.format(
'<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' + '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-%s">' +
'<div class="td cbi-section-table-cell">%s/%s</div>' + '<div class="td cbi-section-table-cell left">%s/%s</div>' +
'<div class="td cbi-section-table-cell">' + '<div class="td cbi-section-table-cell left">' +
'<a href="http://%s/cgi-bin-status.html">%s</a>', '<a href="http://%s/cgi-bin-status.html">%s</a>',
route.proto, route.dest, route.genmask, route.gw, route.gw route.proto, route.dest, route.genmask, route.gw, route.gw
) )
if (route.hostname) { if (route.hostname) {
if (hna.proto == '6') { if (route.proto == '6') {
s += String.format( s += String.format(
' / <a href="http://[%s]/cgi-bin-status.html">%s</a>', ' / <a href="http://[%s]/cgi-bin-status.html">%s</a>',
route.hostname, route.hostname || '?' route.hostname, route.hostname || '?'
@ -72,9 +79,9 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
} }
s += String.format( s += String.format(
'</div>' + '</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell" style="background-color:%s">%s</div>' + '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
'</div>', '</div>',
route.interface, route.metric, route.color, route.etx || '?' route.interface, route.metric, route.color, route.etx || '?'
); );
@ -95,27 +102,23 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Overview of currently known routes to other OLSR nodes%></legend> <legend><%:Overview of currently known routes to other OLSR nodes%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table" id="olsrd_routes">
<div class="thead"> <div class="tr cbi-section-table-cell">
<div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Announced network%></div> <div class="th cbi-section-table-cell"><%:Announced network%></div>
<div class="th cbi-section-table-cell"><%:OLSR gateway%></div> <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
<div class="th cbi-section-table-cell"><%:Interface%></div> <div class="th cbi-section-table-cell"><%:Interface%></div>
<div class="th cbi-section-table-cell"><%:Metric%></div> <div class="th cbi-section-table-cell"><%:Metric%></div>
<div class="th cbi-section-table-cell">ETX</div> <div class="th cbi-section-table-cell">ETX</div>
</div> </div>
</div>
<div class="tbody" id="olsrd_routes">
<% for k, route in ipairs(routes) do <% for k, route in ipairs(routes) do
ETX = tonumber(route.rtpMetricCost)/1024 or '0' ETX = tonumber(route.etx) or '0'
color = olsrtools.etx_color(ETX) color = olsrtools.etx_color(ETX)
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=route.proto%>">
<div class="td cbi-section-table-cell"><%=route.destination%>/<%=route.genmask%></div> <div class="td cbi-section-table-cell left"><%=route.destination%>/<%=route.genmask%></div>
<div class="td cbi-section-table-cell"> <div class="td cbi-section-table-cell left">
<% if route.proto == '6' then %> <% if route.proto == '6' then %>
<a href="http://[<%=route.gateway%>]/cgi-bin-status.html"><%=route.gateway%></a> <a href="http://[<%=route.gateway%>]/cgi-bin-status.html"><%=route.gateway%></a>
<% else %> <% else %>
@ -125,15 +128,14 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
/ <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.hostname%></a> / <a href="http://<%=route.Hostname%>/cgi-bin-status.html"><%=route.hostname%></a>
<% end %> <% end %>
</div> </div>
<div class="td cbi-section-table-cell"><%=route.networkInterface%></div> <div class="td cbi-section-table-cell left"><%=route.networkInterface%></div>
<div class="td cbi-section-table-cell"><%=route.metric%></div> <div class="td cbi-section-table-cell left"><%=route.metric%></div>
<div class="td cbi-section-table-cell" style="background-color:<%=color%>"><%=string.format("%.3f", ETX)%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=string.format("%.3f", ETX)%></div>
</div> </div>
<% <%
i = ((i % 2) + 1) i = ((i % 2) + 1)
end %> end %>
</div> </div>
</div>
<%+status-olsr/legend%> <%+status-olsr/legend%>
</fieldset> </fieldset>

View file

@ -17,23 +17,23 @@ end)
if luci.http.formvalue("status") == "1" then if luci.http.formvalue("status") == "1" then
local rv = {} local rv = {}
for k, gw in ipairs(gws) do for k, gw in ipairs(gws.ipv4, gws.ipv6) do
gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 gw.cost = tonumber(gw.cost)/1024 or 0
if gw.tcPathCost == 4096 then if gw.cost >= 100 then
gw.tcPathCost = 0 gw.cost = 0
end end
rv[#rv+1] = { rv[#rv+1] = {
proto = gw.proto, proto = gw.IPv4 and '4' or '6',
ipAddress = gw.ipAddress, originator = gw.originator,
status = gw.ipv4Status or gw.ipv6Status, selected = gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no'),
tcPathCost = string.format("%.3f", gw.tcPathCost), cost = gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinate'),
hopCount = gw.hopCount, hops = gw.hops,
uplinkSpeed = gw.uplinkSpeed, uplink = gw.uplink,
downlinkSpeed = gw.downlinkSpeed, downlink = gw.downlink,
v4 = gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no'), v4 = gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no'),
v6 = gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no'), v6 = gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no'),
externalPrefix = gw.externalPrefix prefix = gw.prefix
} }
end end
luci.http.prepare_content("application/json") luci.http.prepare_content("application/json")
@ -51,28 +51,39 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
var smartgwdiv = document.getElementById('olsrd_smartgw'); var smartgwdiv = document.getElementById('olsrd_smartgw');
if (smartgwdiv) if (smartgwdiv)
{ {
var s = ''; var s = '<div class="tr cbi-section-table-titles">' +
'<div class="th cbi-section-table-cell"><%:Gateway%></div>' +
'<div class="th cbi-section-table-cell"><%:Selected%></div>' +
'<div class="th cbi-section-table-cell"><%:ETX%></div>' +
'<div class="th cbi-section-table-cell"><%:Hops%></div>' +
'<div class="th cbi-section-table-cell"><%:Uplink%></div>' +
'<div class="th cbi-section-table-cell"><%:Downlink%></div>' +
'<div class="th cbi-section-table-cell"><%:IPv4%></div>' +
'<div class="th cbi-section-table-cell"><%:IPv6%></div>' +
'<div class="th cbi-section-table-cell"><%:Prefix%></div>' +
'</div>';
for (var idx = 0; idx < info.length; idx++) for (var idx = 0; idx < info.length; idx++)
{ {
var smartgw = info[idx]; var smartgw = info[idx];
s += '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + smartgw.proto + '">' s += '<div class="tr cbi-section-table-row cbi-rowstyle-'+(1 + (idx % 2))+' proto-' + smartgw.proto + '">'
if (smartgw.proto == '6') { if (smartgw.proto == '6') {
linkgw = '<a href="http://[' + smartgw.ipAddress + ']/cgi-bin-status.html">' + smartgw.ipAddress + '</a>' linkgw = '<a href="http://[' + smartgw.originator + ']/cgi-bin-status.html">' + smartgw.originator + '</a>'
} else { } else {
linkgw = '<a href="http://' + smartgw.ipAddress + '/cgi-bin-status.html">' + smartgw.ipAddress + '</a>' linkgw = '<a href="http://' + smartgw.originator + '/cgi-bin-status.html">' + smartgw.originator + '</a>'
} }
s += String.format( s += String.format(
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>' + '<div class="td cbi-section-table-cell left">%s</div>' +
'<div class="td cbi-section-table-cell">%s</div>', '<div class="td cbi-section-table-cell left">%s</div>',
linkgw, smartgw.status, smartgw.tcPathCost, smartgw.hopCount, smartgw.uplinkSpeed, smartgw.downlinkSpeed, smartgw.v4, smartgw.v6, smartgw.externalPrefix linkgw, smartgw.selected, smartgw.cost, smartgw.hops, smartgw.uplink, smartgw.downlink, smartgw.v4, smartgw.v6, smartgw.prefix
) )
s += '</div>' s += '</div>'
} }
@ -82,9 +93,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
); );
//]]></script> //]]></script>
<%+header%>
<h2 name="content"><%:SmartGW announcements%></h2> <h2 name="content"><%:SmartGW announcements%></h2>
<div id="togglebuttons"></div> <div id="togglebuttons"></div>
@ -93,11 +101,10 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<fieldset class="cbi-section"> <fieldset class="cbi-section">
<legend><%:Overview of smart gateways in this network%></legend> <legend><%:Overview of smart gateways in this network%></legend>
<div class="table cbi-section-table"> <div class="table cbi-section-table" id="olsrd_smartgw">
<div class="thead">
<div class="tr cbi-section-table-titles"> <div class="tr cbi-section-table-titles">
<div class="th cbi-section-table-cell"><%:Gateway%></div> <div class="th cbi-section-table-cell"><%:Gateway%></div>
<div class="th cbi-section-table-cell"><%:Status%></div> <div class="th cbi-section-table-cell"><%:Selected%></div>
<div class="th cbi-section-table-cell"><%:ETX%></div> <div class="th cbi-section-table-cell"><%:ETX%></div>
<div class="th cbi-section-table-cell"><%:Hops%></div> <div class="th cbi-section-table-cell"><%:Hops%></div>
<div class="th cbi-section-table-cell"><%:Uplink%></div> <div class="th cbi-section-table-cell"><%:Uplink%></div>
@ -105,40 +112,36 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
<div class="th cbi-section-table-cell"><%:IPv4%></div> <div class="th cbi-section-table-cell"><%:IPv4%></div>
<div class="th cbi-section-table-cell"><%:IPv6%></div> <div class="th cbi-section-table-cell"><%:IPv6%></div>
<div class="th cbi-section-table-cell"><%:Prefix%></div> <div class="th cbi-section-table-cell"><%:Prefix%></div>
</div>
</div> </div>
<div class="tbody" id="olsrd_smartgw"> <% for k, gw in ipairs(gws.ipv4, gws.ipv6) do
<% for k, gw in ipairs(gws) do
gw.tcPathCost = tonumber(gw.tcPathCost)/1024 or 0 gw.cost = tonumber(gw.cost)/1024 or 0
if gw.tcPathCost == 4096 then if gw.cost >= 100 then
gw.tcPathCost = 0 gw.cost = 0
end end
%> %>
<div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>"> <div class="tr cbi-section-table-row cbi-rowstyle-<%=i%> proto-<%=proto%>">
<% if gw.proto == '6' then %> <% if gw.proto == '6' then %>
<div class="td cbi-section-table-cell"><a href="http://[<%=gw.ipAddress%>]/cgi-bin-status.html"><%=gw.ipAddress%></a></div> <div class="td cbi-section-table-cell left"><a href="http://[<%=gw.originator%>]/cgi-bin-status.html"><%=gw.originator%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-cell"><a href="http://<%=gw.ipAddress%>/cgi-bin-status.html"><%=gw.ipAddress%></a></div> <div class="td cbi-section-table-cell left"><a href="http://<%=gw.originator%>/cgi-bin-status.html"><%=gw.originator%></a></div>
<% end %> <% end %>
<div class="td cbi-section-table-cell"><%=gw.ipv4Status or gw.ipv6Status or '-' %></div> <div class="td cbi-section-table-cell left"><%=gw.selected and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=string.format("%.3f", gw.tcPathCost)%></div> <div class="td cbi-section-table-cell left"><%=gw.cost > 0 and string.format("%.3f", gw.cost) or luci.i18n.translate('infinate')%></div>
<div class="td cbi-section-table-cell"><%=gw.hopCount%></div> <div class="td cbi-section-table-cell left"><%=gw.hops%></div>
<div class="td cbi-section-table-cell"><%=gw.uplinkSpeed%></div> <div class="td cbi-section-table-cell left"><%=gw.uplink%></div>
<div class="td cbi-section-table-cell"><%=gw.downlinkSpeed%></div> <div class="td cbi-section-table-cell left"><%=gw.downlink%></div>
<div class="td cbi-section-table-cell"><%=gw.ipv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell left"><%=gw.IPv4 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=gw.ipv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div> <div class="td cbi-section-table-cell left"><%=gw.IPv6 and luci.i18n.translate('yes') or luci.i18n.translate('no')%></div>
<div class="td cbi-section-table-cell"><%=gw.externalPrefix%></div> <div class="td cbi-section-table-cell left"><%=gw.prefix%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)
end %> end %>
</div> </div>
</div>
</fieldset> </fieldset>
<% else %> <% else %>

View file

@ -27,7 +27,7 @@ local olsrtools = require "luci.tools.olsr"
</div> </div>
<% for k, route in ipairs(routes) do <% for k, route in ipairs(routes) do
local cost = string.format("%.3f", tonumber(route.tcEdgeCost/1024) or 0) local cost = string.format("%.3f", tonumber(route.tcEdgeCost) or 0)
local color = olsrtools.etx_color(tonumber(cost)) local color = olsrtools.etx_color(tonumber(cost))
local lq = string.format("%.3f", tonumber(route.linkQuality) or 0) local lq = string.format("%.3f", tonumber(route.linkQuality) or 0)
local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0) local nlq = string.format("%.3f", tonumber(route.neighborLinkQuality) or 0)
@ -37,19 +37,19 @@ local olsrtools = require "luci.tools.olsr"
<% if route.proto == "6" then %> <% if route.proto == "6" then %>
<div class="td cbi-section-table-cell"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></div> <div class="td cbi-section-table-cell left"><a href="http://[<%=route.destinationIP%>]/cgi-bin-status.html"><%=route.destinationIP%></a></div>
<div class="td cbi-section-table-cell"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></div> <div class="td cbi-section-table-cell left"><a href="http://[<%=route.lastHopIP%>]/cgi-bin-status.html"><%=route.lastHopIP%></a></div>
<% else %> <% else %>
<div class="td cbi-section-table-cell"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></div> <div class="td cbi-section-table-cell left"><a href="http://<%=route.destinationIP%>/cgi-bin-status.html"><%=route.destinationIP%></a></div>
<div class="td cbi-section-table-cell"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></div> <div class="td cbi-section-table-cell left"><a href="http://<%=route.lastHopIP%>/cgi-bin-status.html"><%=route.lastHopIP%></a></div>
<%end%> <%end%>
<div class="td cbi-section-table-cell"><%=lq%></div> <div class="td cbi-section-table-cell left"><%=lq%></div>
<div class="td cbi-section-table-cell"><%=nlq%></div> <div class="td cbi-section-table-cell left"><%=nlq%></div>
<div class="td cbi-section-table-cell" style="background-color:<%=color%>"><%=cost%></div> <div class="td cbi-section-table-cell left" style="background-color:<%=color%>"><%=cost%></div>
</div> </div>
<% i = ((i % 2) + 1) <% i = ((i % 2) + 1)

View file

@ -803,6 +803,13 @@ msgstr ""
msgid "yes" msgid "yes"
msgstr "" msgstr ""
#~ msgid "Status"
#~ msgstr "Status"
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr "Ausgewählt"
#~ msgid "Device" #~ msgid "Device"
#~ msgstr "Schnittstelle" #~ msgstr "Schnittstelle"

View file

@ -693,6 +693,10 @@ msgstr ""
msgid "yes" msgid "yes"
msgstr "" msgstr ""
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr ""
#~ msgid "" #~ msgid ""
#~ "Make sure that OLSRd is running, the \"txtinfo\" plugin is loaded, " #~ "Make sure that OLSRd is running, the \"txtinfo\" plugin is loaded, "
#~ "configured on port 2006 and accepts connections from \"127.0.0.1\"." #~ "configured on port 2006 and accepts connections from \"127.0.0.1\"."

View file

@ -678,3 +678,8 @@ msgstr ""
msgid "yes" msgid "yes"
msgstr "" msgstr ""
#: application/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm:97
msgid "Selected"
msgstr ""

View file

@ -342,9 +342,9 @@ function mode.write(self, section, value)
-- txtinfo v6 & olsrd nameservice -- txtinfo v6 & olsrd nameservice
uci:foreach("olsrd", "LoadPlugin", uci:foreach("olsrd", "LoadPlugin",
function(s) function(s)
if s.library == "olsrd_txtinfo.so.0.1" then if s.library == "olsrd_txtinfo" then
uci:set("olsrd", s['.name'], "accept", "::1") uci:set("olsrd", s['.name'], "accept", "::1")
elseif s.library == "olsrd_nameservice.so.0.3" then elseif s.library == "olsrd_nameservice" then
uci:set("olsrd", s['.name'], "name", hostname) uci:set("olsrd", s['.name'], "name", hostname)
end end
end) end)

View file

@ -3,7 +3,7 @@ config 'community' 'profile'
option 'homepage' 'http://berlin.freifunk.net' option 'homepage' 'http://berlin.freifunk.net'
option 'ssid' 'berlin.freifunk.net' option 'ssid' 'berlin.freifunk.net'
option 'ssid_scheme' 'addchannelbefore' option 'ssid_scheme' 'addchannelbefore'
option 'mesh_network' '104.0.0.0/8' option 'mesh_network' '10.0.0.0/8'
option 'splash_network' '10.104.0.0/16' option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27' option 'splash_prefix' '27'
option 'latitude' '52.52075' option 'latitude' '52.52075'
@ -33,7 +33,7 @@ config 'defaults' 'ssidscheme'
config 'defaults' 'interface' config 'defaults' 'interface'
option 'netmask' '255.255.255.255' option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 194.150.168.168 2001:4ce8::53 2001:910:800::12' option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp' config 'dhcp' 'dhcp'
option leasetime '5m' option leasetime '5m'

View file

@ -31,7 +31,7 @@ config 'defaults' 'ssidscheme'
config 'defaults' 'interface' config 'defaults' 'interface'
option 'netmask' '255.255.255.255' option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 194.150.168.168 2001:4ce8::53 2001:910:800::12' option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp' config 'dhcp' 'dhcp'
option 'leasetime' '5m' option 'leasetime' '5m'

View file

@ -0,0 +1,38 @@
config 'community' 'profile'
option 'name' 'Freifunk Fürstenwalde'
option 'homepage' 'http://fuerstenwalde.freifunk.net'
option 'ssid' 'fuerstenwalde.freifunk.net'
option 'ssid_scheme' 'addchannelbefore'
option 'mesh_network' '10.0.0.0/8'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '27'
option 'latitude' '52.35844'
option 'longitude' '14.063696'
option 'owm_api' 'http://util.berlin.freifunk.net'
config 'defaults' 'wifi_device'
option 'channel' '13'
config 'defaults' 'wifi_device_5'
option 'channel' '36'
config 'defaults' 'wifi_iface'
option 'mcast_rate' '6000'
config 'defaults' 'wifi_iface_5'
option 'mcast_rate' '12000'
config 'defaults' 'bssidscheme'
option '13' 'D2:CA:FF:EE:BA:BE'
option '36' '02:36:CA:FF:EE:EE'
config 'defaults' 'ssidscheme'
option '13' 'intern-ch13.freifunk.net'
option '36' 'intern-ch36.freifunk.net'
config 'defaults' 'interface'
option 'netmask' '255.255.255.255'
option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168 2001:4ce8::53 2001:910:800::12'
config 'dhcp' 'dhcp'
option leasetime '5m'

View file

@ -11,7 +11,7 @@ config 'community' 'profile'
config 'defaults' 'interface' config 'defaults' 'interface'
option 'netmask' '255.255.0.0' option 'netmask' '255.255.0.0'
option 'dns' '85.214.20.141 194.150.168.168' option 'dns' '85.214.20.141 80.67.169.40 194.150.168.168'
option 'delegate' '0' option 'delegate' '0'
config 'defaults' 'wifi_device' config 'defaults' 'wifi_device'

View file

@ -7,4 +7,4 @@ config 'community' 'profile'
option 'splash_prefix' '28' option 'splash_prefix' '28'
config 'defaults' 'interface' config 'defaults' 'interface'
option 'dns' '216.87.84.211' option 'dns' '80.67.169.40 216.87.84.211'

View file

@ -10,7 +10,7 @@ hostsfile_getname()
while value="$( uci -q get $config.@LoadPlugin[$i].library )"; do { while value="$( uci -q get $config.@LoadPlugin[$i].library )"; do {
case "$value" in case "$value" in
'olsrd_nameservice.so.'*) 'olsrd_nameservice'*)
file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )" file="$( uci -q get $config.@LoadPlugin[$i].hosts_file )"
break break
;; ;;

View file

@ -11,7 +11,7 @@ if fs.access("/var/run/olsrd.pid") or fs.access("/var/run/olsrd4.pid") then
x:foreach("olsrd", "LoadPlugin", x:foreach("olsrd", "LoadPlugin",
function(s) function(s)
if s.library == "olsrd_watchdog.so.0.1" then if s.library == "olsrd_watchdog" then
intv = tonumber(s.interval) intv = tonumber(s.interval)
stamp = s.file stamp = s.file
end end

View file

@ -8,7 +8,7 @@ MAPSERVER="$(uci -q get freifunk-mapupdate.mapupdate.mapserver)"
[ -z "$MAPSERVER" ] && logger -t "freifunk-mapupdate:" "No mapserver configured" && exit 1 [ -z "$MAPSERVER" ] && logger -t "freifunk-mapupdate:" "No mapserver configured" && exit 1
#check if nameservice plugin is installed and enabled, else exit #check if nameservice plugin is installed and enabled, else exit
nslib=`uci show olsrd |grep olsrd_nameservice.so |awk {' FS="."; print $1"."$2 '}` nslib=`uci show olsrd |grep olsrd_nameservice |awk {' FS="."; print $1"."$2 '}`
if [ -n "$nslib" ]; then if [ -n "$nslib" ]; then
LATLONFILE="$(uci -q get $nslib.latlon_file)" LATLONFILE="$(uci -q get $nslib.latlon_file)"
if [ -z "$LATLONFILE" ]; then if [ -z "$LATLONFILE" ]; then

View file

@ -73,7 +73,7 @@ setup_nameservice() {
uci batch <<- EOF uci batch <<- EOF
set $cfg.olsrd_nameservice=LoadPlugin set $cfg.olsrd_nameservice=LoadPlugin
set $cfg.olsrd_nameservice.library="olsrd_nameservice.so.0.4" set $cfg.olsrd_nameservice.library="olsrd_nameservice"
set $cfg.olsrd_nameservice.latlon_file="$llfile" set $cfg.olsrd_nameservice.latlon_file="$llfile"
set $cfg.olsrd_nameservice.hosts_file="$hosts" set $cfg.olsrd_nameservice.hosts_file="$hosts"
set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid" set $cfg.olsrd_nameservice.sighup_pid_file="/var/run/dnsmasq.pid"
@ -91,7 +91,7 @@ setup_dyngw_plain() {
if [ "$general_sharenet" == 1 ]; then if [ "$general_sharenet" == 1 ]; then
uci set $cfg.dyngw_plain=LoadPlugin uci set $cfg.dyngw_plain=LoadPlugin
uci set $cfg.dyngw_plain.ignore=0 uci set $cfg.dyngw_plain.ignore=0
uci set $cfg.dyngw_plain.library="olsrd_dyn_gw_plain.so.0.4" uci set $cfg.dyngw_plain.library="olsrd_dyn_gw_plain"
uci_commitverbose "Setup olsrd_dyngw_plain plugin" $cfg uci_commitverbose "Setup olsrd_dyngw_plain plugin" $cfg
fi fi
@ -106,7 +106,7 @@ setup_watchdog() {
uci batch <<- EOF uci batch <<- EOF
set $cfg.olsrd_watchdog=LoadPlugin set $cfg.olsrd_watchdog=LoadPlugin
set $cfg.olsrd_watchdog.library="olsrd_watchdog.so.0.1" set $cfg.olsrd_watchdog.library="olsrd_watchdog"
set $cfg.olsrd_watchdog.file="$watchdogfile" set $cfg.olsrd_watchdog.file="$watchdogfile"
set $cfg.olsrd_watchdog.interval=30 set $cfg.olsrd_watchdog.interval=30
EOF EOF
@ -118,7 +118,7 @@ setup_jsoninfo() {
proto="$1" proto="$1"
uci batch <<- EOF uci batch <<- EOF
set $cfg.olsrd_jsoninfo=LoadPlugin set $cfg.olsrd_jsoninfo=LoadPlugin
set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo.so.1.1" set $cfg.olsrd_jsoninfo.library="olsrd_jsoninfo"
EOF EOF
if [ "$proto" = "6" ]; then if [ "$proto" = "6" ]; then
uci set $cfg.olsrd_jsoninfo.ipv6only='1' uci set $cfg.olsrd_jsoninfo.ipv6only='1'
@ -130,7 +130,7 @@ setup_txtinfo() {
proto="$1" proto="$1"
uci batch <<- EOF uci batch <<- EOF
set $cfg.olsrd_txtinfo=LoadPlugin set $cfg.olsrd_txtinfo=LoadPlugin
set $cfg.olsrd_txtinfo.library="olsrd_txtinfo.so.1.1" set $cfg.olsrd_txtinfo.library="olsrd_txtinfo"
EOF EOF
if [ "$proto" = "6" ]; then if [ "$proto" = "6" ]; then
uci set $cfg.olsrd_txtinfo.ipv6only='1' uci set $cfg.olsrd_txtinfo.ipv6only='1'

View file

@ -852,6 +852,14 @@ function get_status_by_address(self, addr)
end end
end end
end end
if s and s['ipv6-prefix-assignment'] then
local a
for _, a in ipairs(s['ipv6-prefix-assignment']) do
if a and a['local-address'] and a['local-address'].address == addr then
return net, s
end
end
end
end end
end end
end end

View file

@ -4,7 +4,7 @@
local has_latlon = false local has_latlon = false
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
uci:foreach("olsrd", "LoadPlugin", function(s) uci:foreach("olsrd", "LoadPlugin", function(s)
if s.library == "olsrd_nameservice.so.0.3" and s.latlon_file then if s.library == "olsrd_nameservice" and s.latlon_file then
has_latlon = true has_latlon = true
end end
end) end)

View file

@ -85,7 +85,7 @@
local uci = require "luci.model.uci".cursor() local uci = require "luci.model.uci".cursor()
uci:foreach("olsrd", "LoadPlugin", function(s) uci:foreach("olsrd", "LoadPlugin", function(s)
if s.library == "olsrd_nameservice.so.0.3" and s.latlon_file then if s.library == "olsrd_nameservice" and s.latlon_file then
fd = io.open(s.latlon_file) fd = io.open(s.latlon_file)
end end
end) end)