mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Display mtu in status page
This commit is contained in:
parent
70edb5abaa
commit
9d536f9192
2 changed files with 24 additions and 10 deletions
|
@ -462,16 +462,22 @@ function interfaces_status()
|
||||||
local tracker_ip = ""
|
local tracker_ip = ""
|
||||||
if mArray.openmptcprouter["dns"] == true then
|
if mArray.openmptcprouter["dns"] == true then
|
||||||
-- shadowsocksaddr
|
-- shadowsocksaddr
|
||||||
tracker_ip = uci:get("shadowsocks-libev","tracker","local_address") or ""
|
mArray.openmptcprouter["ss_addr"] = uci:get("openmptcprouter","vps","ipv4") or ""
|
||||||
local tracker_port = uci:get("shadowsocks-libev","tracker","local_port")
|
if mArray.openmptcprouter["ss_addr"] == "" then
|
||||||
if tracker_ip ~= "" then
|
tracker_ip = uci:get("shadowsocks-libev","tracker","local_address") or ""
|
||||||
mArray.openmptcprouter["ss_addr"] = sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ip.openmptcprouter.com")
|
if tracker_ip ~= "" then
|
||||||
--mArray.openmptcprouter["ss_addr6"] = sys.exec("curl -s -6 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ipv6.openmptcprouter.com")
|
local tracker_port = uci:get("shadowsocks-libev","tracker","local_port")
|
||||||
|
mArray.openmptcprouter["ss_addr"] = sys.exec("curl -s -4 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ip.openmptcprouter.com")
|
||||||
|
--mArray.openmptcprouter["ss_addr6"] = sys.exec("curl -s -6 --socks5 " .. tracker_ip .. ":" .. tracker_port .. " -m 3 http://ipv6.openmptcprouter.com")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- wanaddr
|
-- wanaddr
|
||||||
mArray.openmptcprouter["wan_addr"] = sys.exec("wget -4 -qO- -T 1 http://ip.openmptcprouter.com")
|
mArray.openmptcprouter["wan_addr"] = sys.exec("wget -4 -qO- -T 1 http://ip.openmptcprouter.com")
|
||||||
if mArray.openmptcprouter["ipv6"] == "enabled" then
|
if mArray.openmptcprouter["ipv6"] == "enabled" then
|
||||||
mArray.openmptcprouter["wan_addr6"] = sys.exec("wget -6 -qO- -T 1 http://ipv6.openmptcprouter.com")
|
mArray.openmptcprouter["wan_addr6"] = uci:get("openmptcprouter","vps","ipv6") or ""
|
||||||
|
if mArray.openmptcprouter["wan_addr6"] == "" then
|
||||||
|
mArray.openmptcprouter["wan_addr6"] = sys.exec("wget -6 -qO- -T 1 http://ipv6.openmptcprouter.com")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -657,22 +663,22 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
server_ping = "UP"
|
server_ping = "UP"
|
||||||
latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f4 | cut -d '.' -f1"))
|
latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f5 | cut -d '.' -f1"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local multipath_available
|
local multipath_available
|
||||||
if connectivity ~= "ERROR" and mArray.openmptcprouter["dns"] == true and ifname ~= nil and ifname ~= "" and gateway ~= "" and gw_ping == "UP" then
|
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
|
-- Test if multipath can work on the connection
|
||||||
local multipath_available_state = uci:get("openmptcprouter",interface,"publicip") or ""
|
local multipath_available_state = uci:get("openmptcprouter",interface,"mptcp_status") or ""
|
||||||
if multipath_available_state == "" then
|
if multipath_available_state == "" then
|
||||||
--if mArray.openmptcprouter["service_addr"] ~= "" then
|
--if mArray.openmptcprouter["service_addr"] ~= "" then
|
||||||
multipath_available_state = ut.trim(sys.exec("omr-tracebox-mptcp " .. mArray.openmptcprouter["service_addr"] .. " " .. ifname .. " | grep 'MPTCP disabled'"))
|
-- multipath_available_state = ut.trim(sys.exec("omr-tracebox-mptcp " .. mArray.openmptcprouter["service_addr"] .. " " .. ifname .. " | grep 'MPTCP disabled'"))
|
||||||
--else
|
--else
|
||||||
multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
||||||
--end
|
--end
|
||||||
else
|
else
|
||||||
multipath_available_state = ut.trim(sys.exec("echo " .. multipath_available_state .. " | grep 'MPTCP disabled'"))
|
multipath_available_state = ut.trim(sys.exec("echo '" .. multipath_available_state .. "' | grep 'MPTCP disabled'"))
|
||||||
end
|
end
|
||||||
if multipath_available_state == "" then
|
if multipath_available_state == "" then
|
||||||
multipath_available = "OK"
|
multipath_available = "OK"
|
||||||
|
@ -734,6 +740,8 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local mtu = uci:get("openmptcprouter",interface,"mtu") or ""
|
||||||
|
|
||||||
local data = {
|
local data = {
|
||||||
label = section["label"] or interface,
|
label = section["label"] or interface,
|
||||||
name = interface,
|
name = interface,
|
||||||
|
@ -745,6 +753,7 @@ function interfaces_status()
|
||||||
status = connectivity,
|
status = connectivity,
|
||||||
wanip = publicIP,
|
wanip = publicIP,
|
||||||
latency = latency,
|
latency = latency,
|
||||||
|
mtu = mtu,
|
||||||
whois = whois or "unknown",
|
whois = whois or "unknown",
|
||||||
qos = section["trafficcontrol"],
|
qos = section["trafficcontrol"],
|
||||||
download = section["download"],
|
download = section["download"],
|
||||||
|
|
|
@ -220,6 +220,7 @@
|
||||||
master++;
|
master++;
|
||||||
}
|
}
|
||||||
var latency = mArray.wans[i].latency;
|
var latency = mArray.wans[i].latency;
|
||||||
|
var mtu = mArray.wans[i].mtu;
|
||||||
var gateway = mArray.wans[i].gateway;
|
var gateway = mArray.wans[i].gateway;
|
||||||
var gw_ping = mArray.wans[i].gw_ping;
|
var gw_ping = mArray.wans[i].gw_ping;
|
||||||
var server_ping = mArray.wans[i].server_ping;
|
var server_ping = mArray.wans[i].server_ping;
|
||||||
|
@ -249,6 +250,10 @@
|
||||||
{
|
{
|
||||||
content += String.format('latency: %s ms<br />', latency);
|
content += String.format('latency: %s ms<br />', latency);
|
||||||
}
|
}
|
||||||
|
if(mtu !== '')
|
||||||
|
{
|
||||||
|
content += String.format('mtu: %s<br />', mtu);
|
||||||
|
}
|
||||||
if(ipaddr == '')
|
if(ipaddr == '')
|
||||||
{
|
{
|
||||||
statusMessage += 'No IP defined<br />'
|
statusMessage += 'No IP defined<br />'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue