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

Fix when resolveip doesn't work in API

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-05-03 13:26:21 +02:00
parent 85c74d6aaa
commit 65a10f0910

View file

@ -1501,6 +1501,9 @@ function interfaces_status()
elseif gateway6 ~= "" then
serverip = sys.exec('resolveip -6 ' .. value .. ' | head -n 1')
end
if serverip == "" then
serverip = value
end
if serverip ~= "" then
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'"))