1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

No server ping if gw down

This commit is contained in:
Ycarus 2018-07-27 15:36:10 +02:00
parent e781082dbb
commit 17dc28e63c

View file

@ -616,8 +616,9 @@ function interfaces_status()
connectivity = 'ERROR' connectivity = 'ERROR'
end end
local latency = "-" local latency = ""
local server_ping = 'UP' local server_ping = ''
if connectivity ~= "ERROR" then
local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["wan_addr"]) local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["wan_addr"])
local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'")) local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'"))
if server_ping_result ~= "" then if server_ping_result ~= "" then
@ -625,8 +626,11 @@ function interfaces_status()
if connectivity == "OK" then if connectivity == "OK" then
connectivity = 'WARNING' connectivity = 'WARNING'
end end
else
server_ping = 'UP'
latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f4 | cut -d '.' -f1"))
end
end end
local latency = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | cut -d '/' -s -f4 | cut -d '.' -f1"))
if mArray.openmptcprouter["dns"] == true and ifname ~= nil and gateway ~= "" and gw_ping == "UP" then if mArray.openmptcprouter["dns"] == true and ifname ~= nil and gateway ~= "" and gw_ping == "UP" then
-- Test if multipath can work on the connection -- Test if multipath can work on the connection