From a15336068d14ac900e5f4c65b47430558f438b60 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Tue, 22 May 2018 11:13:28 +0200 Subject: [PATCH] Fix mptcp graph --- luci-app-mptcp/luasrc/controller/mptcp.lua | 9 ++-- .../luasrc/view/mptcp/multipath.htm | 41 ++++++++++--------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index af5a65633..7dcdba960 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -32,14 +32,15 @@ function multipath_bandwidth() local result = { }; local uci = luci.model.uci.cursor() - for _, dev in luci.util.vspairs(luci.sys.net.devices()) do - if dev ~= "lo" then - local multipath = uci:get("network", dev, "multipath") + uci:foreach("network", "interface", function(s) + local dev = s["ifname"] + if dev ~= "lo" and dev ~= "" then + local multipath = s["multipath"] or "off" if multipath == "on" or multipath == "master" or multipath == "backup" or multipath == "handover" then result[dev] = "[" .. string.gsub((luci.sys.exec("luci-bwc -i %q 2>/dev/null" % dev)), '[\r\n]', '') .. "]" end end - end + end) luci.http.prepare_content("application/json") luci.http.write_json(result) diff --git a/luci-app-mptcp/luasrc/view/mptcp/multipath.htm b/luci-app-mptcp/luasrc/view/mptcp/multipath.htm index cc3c75c86..748c5dac7 100644 --- a/luci-app-mptcp/luasrc/view/mptcp/multipath.htm +++ b/luci-app-mptcp/luasrc/view/mptcp/multipath.htm @@ -3,6 +3,7 @@ -- Copyright 2015 OVH (OverTheBox@ovh.net) -- Simon Lelievre (simon.lelievre@corp.ovh.com) -- Sebastien Duponcheel (sebastien.duponcheel@ovh.net) +-- Copyright 2018 Ycarus - Yannick Chabanois (ycarus@zugaina.org) -- -- This file is part of OverTheBox for OpenWrt. -- @@ -48,28 +49,28 @@