1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-14 19:41:51 +00:00

Test if VPS support MPTCP

This commit is contained in:
Ycarus 2018-08-09 16:57:26 +02:00
parent 15bff6d3a7
commit 368f23be99
4 changed files with 31 additions and 9 deletions

View file

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI Support for OpenMPTCProuter
LUCI_DEPENDS:=+luci-lib-json +rdisc6 +curl +whois +bind-dig
LUCI_DEPENDS:=+luci-lib-json +rdisc6 +curl +whois +bind-dig +tracebox
PKG_LICENSE:=GPLv3
include ../luci/luci.mk

View file

@ -442,7 +442,7 @@ function interfaces_status()
mArray.openmptcprouter["service_addr"] = uci:get("shadowsocks-libev", "sss0", "server") or ""
mArray.openmptcprouter["local_addr"] = uci:get("network", "lan", "ipaddr")
mArray.openmptcprouter["server_mptcp"] = ""
-- dns
mArray.openmptcprouter["dns"] = false
local dns_test = sys.exec("dig openmptcprouter.com | grep 'ANSWER: 0'")
@ -664,15 +664,26 @@ function interfaces_status()
local multipath_available
if connectivity ~= "ERROR" and mArray.openmptcprouter["dns"] == true and ifname ~= nil and ifname ~= "" and gateway ~= "" and gw_ping == "UP" then
-- Test if multipath can work on the connection
local multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
if multipath_available_state == "" then
local multipath_available_state = ""
if mArray.openmptcprouter["service_addr"] ~= "" then
multipath_available_state = ut.trim(sys.exec("omr-tracebox-mptcp " .. mArray.openmptcprouter["service_addr"] .. " " .. ifname .. " | grep 'MPTCP enabled'"))
else
multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'you are MPTCP-capable'"))
end
if multipath_available_state ~= "" then
multipath_available = 'OK'
else
multipath_available = 'ERROR'
if mArray.openmptcprouter["socks_service"] == true and connectivity == "OK" then
connectivity = 'ERROR'
elseif connectivity == "OK" then
connectivity = 'WARNING'
multipath_available_state_wan = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
if multipath_available_state_wan == "" then
multipath_available = 'OK'
mArray.openmptcprouter["server_mptcp"] = false
else
multipath_available = 'ERROR'
if mArray.openmptcprouter["socks_service"] == true and connectivity == "OK" then
connectivity = 'ERROR'
elseif connectivity == "OK" then
connectivity = 'WARNING'
end
end
end
else

View file

@ -110,6 +110,10 @@
{
statusMessage += 'ShadowSocks not working<br/>';
}
if (mArray.openmptcprouter.server_mptcp == false)
{
statusMessage += 'MPTCP not enabled on the server<br/>';
}
}
if (mArray.openmptcprouter.tun_service == false)
{

View file

@ -0,0 +1,7 @@
#!/bin/sh
INTERFACE=$2
if [ -z "$INTERFACE" ]; then
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' else print 'MPTCP disabled' end" $1
else
tracebox -m 20 -l "pkt = ip{dst=to} / tcp{dst=65101} / MPCAPABLE / MSS / WSCALE if string.find(tostring(tracebox(pkt)),'MPTCP') then print 'MPTCP enabled' else print 'MPTCP disabled' end" -i $INTERFACE $1
fi