Improve mesh display (#1061)

* Improve tunnel and xlink display information

* Also weight nlq.
This is assumed both ends of a tunnel are equally weighted as we
have no way to get this information directly.
This commit is contained in:
Tim Wilkinson 2024-01-12 22:26:45 -08:00 committed by GitHub
parent ce5521f373
commit b64fd8f8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 5 deletions

View File

@ -125,6 +125,7 @@ local ipalias = {}
local localhosts = {}
local dtd = {}
local midcount = {}
local xlinkcount = {}
local hosts = {}
local services = {}
local history = {}
@ -164,7 +165,7 @@ local iwrates
local prefix = "/sys/kernel/debug/ieee80211/" .. phy .. "/netdev:" .. wifiif .. "/stations/"
for i, node in ipairs(aredn.olsr.getOLSRLinks())
do
links[node.remoteIP] = { lq = node.linkQuality, nlq = node.neighborLinkQuality, mbps = "" }
links[node.remoteIP] = { lq = node.linkQuality, nlq = node.neighborLinkQuality, mbps = "", weight = 65536 / node.lossMultiplier }
neighbor[node.remoteIP] = true
local mac = arpcache[node.remoteIP]
if mac then
@ -285,7 +286,11 @@ if nixio.fs.stat("/var/run/hosts_olsr.stable") then
links[ip].dtd = true
end
elseif name:match("^xlink%d+%.") then
dtd[originator] = true
if not xlinkcount[originator] then
xlinkcount[originator] = 1
else
xlinkcount[originator] = xlinkcount[originator] + 1
end
if links[ip] then
links[ip].xlink = true
end
@ -672,8 +677,8 @@ do
c1 = c1 .. " &nbsp; <small>(" .. nodeiface .. ")</small>"
end
local c2 = ""
local c3 = string.format("%.0f%%", 100 * link.lq)
local c4 = string.format("%.0f%%", 100 * link.nlq)
local c3 = string.format("%.0f%%", math.min(100, math.ceil(100 * link.lq * link.weight)))
local c4 = string.format("%.0f%%", math.min(100, math.ceil(100 * link.nlq * link.weight)))
local c5 = string.format("%s", link.mbps)
local c6 = ""
@ -807,6 +812,10 @@ do
local mycount = 0
if midcount[ip] then
mycount = midcount[ip]
if xlinkcount[ip] then
mycount = mycount - xlinkcount[ip]
nodeiface = "xlink*" .. xlinkcount[ip]
end
end
if dtd[ip] then
mycount = mycount - 1
@ -815,7 +824,11 @@ do
mycount = mycount - 1
end
if mycount > 0 then
nodeiface = "tun*" .. mycount
if nodeiface then
nodeiface = nodeiface .. ",tun*" .. mycount
else
nodeiface = "tun*" .. mycount
end
end
if wangateway[ip] then
if nodeiface then
@ -900,6 +913,7 @@ end
neighbor = nil
dtd = nil
midcount = nil
xlinkcount = nil
wangateway = nil
services = nil