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:
parent
403488eb53
commit
61bc8cf0b7
2 changed files with 10 additions and 10 deletions
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue