diff --git a/luci-app-mptcp/luasrc/controller/mptcp.lua b/luci-app-mptcp/luasrc/controller/mptcp.lua index c81458f80..842adc6ef 100644 --- a/luci-app-mptcp/luasrc/controller/mptcp.lua +++ b/luci-app-mptcp/luasrc/controller/mptcp.lua @@ -209,7 +209,7 @@ end function mptcp_monitor_data() luci.http.prepare_content("text/plain") local fullmesh - fullmesh = io.popen("cat /proc/net/mptcp_net/snmp") + fullmesh = io.popen("multipath -m") if fullmesh:read() ~= nil then while true do local ln = fullmesh:read("*l") @@ -217,16 +217,6 @@ function mptcp_monitor_data() luci.http.write(ln) luci.http.write("\n") end - else - fullmesh = io.popen("nstat -z") - 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 end return end diff --git a/mptcp/files/usr/bin/multipath b/mptcp/files/usr/bin/multipath index 62e029da5..42bb1ddff 100755 --- a/mptcp/files/usr/bin/multipath +++ b/mptcp/files/usr/bin/multipath @@ -29,6 +29,7 @@ case $1 in echo "show established conections: -c" echo "show fullmesh info: -f" echo "show kernel config: -k" + echo "show MPTCP info: -m" echo echo "Flag on the device, to enable/disable MPTCP for this interface. The backup-flag" echo "will allow a subflow to be established across this interface, but only be used" @@ -75,6 +76,13 @@ case $1 in fi echo exit 0 ;; + "-m") + if [ -f /proc/net/mptcp_net/snmp ]; then + cat /proc/net/mptcp_net/snmp + else + nstat -z | grep -i mptcp + fi + exit 0 ;; "") for ifpath in /sys/class/net/*; do $0 ${ifpath##*/} @@ -126,6 +134,8 @@ else ID=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $3}') IFF=$(ip mptcp endpoint show | grep "dev $DEVICE" | awk '{print $4}') IP=$(ifconfig $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') + RMID=$(ip mptcp endpoint show | grep '::ffff' | awk '{ print $3 }') + [ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null case $TYPE in "off") [ -n "$ID" ] && ip mptcp endpoint delete id $ID 2>&1 >/dev/null