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