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,17 +616,21 @@ function interfaces_status()
connectivity = 'ERROR' connectivity = 'ERROR'
end end
local latency = "-" local latency = ""
local server_ping = 'UP' local server_ping = ''
local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["wan_addr"]) if connectivity ~= "ERROR" then
local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'")) local server_ping_test = sys.exec("ping -W 1 -c 1 -I " .. ifname .. " " .. mArray.openmptcprouter["wan_addr"])
if server_ping_result ~= "" then local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'"))
server_ping = 'DOWN' if server_ping_result ~= "" then
if connectivity == "OK" then server_ping = 'DOWN'
connectivity = 'WARNING' if connectivity == "OK" then
end connectivity = 'WARNING'
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