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

Ping via interface instead of IP only

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-09-06 18:11:30 +02:00
parent 403488eb53
commit 61bc8cf0b7
2 changed files with 10 additions and 10 deletions

View file

@ -985,13 +985,13 @@ function interfaces_status()
local latency = ""
local server_ping = ""
if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" then
if connectivity ~= "ERROR" and ifname ~= "" and gateway ~= "" and gw_ping ~= "DOWN" and ifname ~= nil and mArray.openmptcprouter["service_addr"] ~= "" and ipaddr ~= "" then
local serverip = mArray.openmptcprouter["service_addr"]
if serverip == "127.0.0.1" then
serverip = mArray.openmptcprouter["wan_addr"]
end
if serverip ~= "" and uci:get("openmptcprouter", "settings", "disableserverping") ~= "1" then
local server_ping_test = sys.exec("ping -w 1 -c 1 -I " .. ifname .. " " .. serverip)
local server_ping_test = sys.exec("ping -B -w 1 -c 1 -I " .. ifname .. " " .. serverip)
local server_ping_result = ut.trim(sys.exec("echo '" .. server_ping_test .. "' | grep '100% packet loss'"))
if server_ping_result ~= "" then
server_ping = "DOWN"