diff --git a/luci-app-mptcp/Makefile b/luci-app-mptcp/Makefile index 08e313f28..b098b8a2a 100644 --- a/luci-app-mptcp/Makefile +++ b/luci-app-mptcp/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2018 Ycarus (Yannick Chabanois) +# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) # # diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index 95e04aba1..4a24a7014 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -13,8 +13,10 @@ 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"}, template("mptcp/mptcp_fullmesh"), _("MPTCP Fullmesh"), 5).leaf = true entry({"admin", "network", "mptcp", "mptcp_fullmesh_data"}, post("mptcp_fullmesh_data")).leaf = true + entry({"admin", "network", "mptcp", "mptcp_connections"}, template("mptcp/mptcp_connections"), _("Established connections"), 6).leaf = true + entry({"admin", "network", "mptcp", "mptcp_connections_data"}, post("mptcp_connections_data")).leaf = true end function interface_bandwidth(iface) @@ -85,7 +87,7 @@ end function mptcp_fullmesh_data() luci.http.prepare_content("text/plain") - local fullmash + local fullmesh fullmesh = io.popen("multipath -f") if fullmesh then while true do @@ -97,3 +99,18 @@ function mptcp_fullmesh_data() end return end + +function mptcp_connections_data() + luci.http.prepare_content("text/plain") + local connections + connections = io.popen("multipath -c") + if connections then + while true do + local ln = connections: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_connections.htm b/luci-app-mptcp/luasrc/view/mptcp/mptcp_connections.htm new file mode 100644 index 000000000..ee9f51a1a --- /dev/null +++ b/luci-app-mptcp/luasrc/view/mptcp/mptcp_connections.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%>