1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Use interface defined name instead of real name in MPTCP graph

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-12-11 18:15:47 +01:00
parent e67d7e2296
commit c428d8a9ba

View file

@ -39,13 +39,24 @@ function multipath_bandwidth()
local uci = luci.model.uci.cursor()
uci:foreach("network", "interface", function(s)
local dev = get_device(s["ifname"])
local intname = s[".name"]
local dev = get_device(intname)
if dev == "" then
dev = get_device(s["ifname"])
end
local multipath = s["multipath"] or ""
if dev ~= "lo" and dev ~= "" then
local multipath = s["multipath"] or "off"
if multipath == "" then
multipath = uci:get("openmptcprouter", intname, "multipath") or ""
end
if multipath == "" then
multipath = "off"
end
if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then
local bwc = luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev) or ""
if bwc ~= nil then
result[dev] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
--result[dev] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
result[intname] = "[" .. string.gsub(bwc, '[\r\n]', '') .. "]"
else
result[dev] = "[]"
end