From 42a8d0317ceb3ddf06a7ed2534bf7ca7c98d8f62 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Thu, 3 Jan 2019 11:47:02 +0100 Subject: [PATCH] Add MPTCP fullmesh info in interface --- luci-app-mptcp/luasrc/controller/mptcp.lua | 17 +++++++ .../luasrc/view/mptcp/mptcp_fullmesh.htm | 49 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index b64283e7c..95e04aba1 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -13,6 +13,8 @@ function index() entry({"admin", "network", "mptcp", "interface_bandwidth"}, call("interface_bandwidth")).leaf = true entry({"admin", "network", "mptcp", "mptcp_check"}, template("mptcp/mptcp_check"), _("MPTCP Support Check"), 4).leaf = true entry({"admin", "network", "mptcp", "mptcp_check_trace"}, post("mptcp_check_trace")).leaf = true + entry({"admin", "network", "mptcp", "mptcp_fullmesh"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 4).leaf = true + entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true end function interface_bandwidth(iface) @@ -80,3 +82,18 @@ function mptcp_check_trace(iface) end return end + +function mptcp_fullmesh_data() + luci.http.prepare_content("text/plain") + local fullmash + fullmesh = io.popen("multipath -f") + if fullmesh then + while true do + local ln = fullmesh:read("*l") + if not ln then break end + luci.http.write(ln) + luci.http.write("\n") + end + end + return +end diff --git a/luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm b/luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm new file mode 100644 index 000000000..e8600b9db --- /dev/null +++ b/luci-app-mptcp/luasrc/view/mptcp/mptcp_fullmesh.htm @@ -0,0 +1,49 @@ +<%+header%> + +<% + local uci = require("luci.model.uci").cursor() + local sys = require "luci.sys" + local ifaces = sys.net:devices() + local net = require "luci.model.network".init() +%> + + + + +<% if stderr and #stderr > 0 then %>
<%=pcdata(stderr)%>
<% end %> +
+ + +
+<%+footer%>