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

Try to find why we have unknown status in some cases

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-09-20 19:52:38 +02:00
parent 44b8789388
commit 8ae235cf3d
2 changed files with 4 additions and 3 deletions

View file

@ -445,13 +445,13 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
cssc = 'rgb(144, 240, 144)'; cssc = 'rgb(144, 240, 144)';
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png"; statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
statusMessageClass = "warning"; statusMessageClass = "warning";
statusMessage = "Some connectivity tests failed"; statusMessage = "Some connectivity tests failed" + '<br />';
default: default:
stat = 'Unknown'; stat = 'Unknown';
cssc = 'rgb(144, 240, 144)'; cssc = 'rgb(144, 240, 144)';
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png"; statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
statusMessageClass = "warning"; statusMessageClass = "warning";
statusMessage = "Unknown status"; statusMessage = "Unknown status (" + mArray.wans[i].status + ")" + '<br />';
} }
// Populate info // Populate info
var wanip = mArray.wans[i].wanip; var wanip = mArray.wans[i].wanip;

View file

@ -1273,6 +1273,7 @@ function interfaces_status()
local mac = section ["macaddr"] or "" local mac = section ["macaddr"] or ""
local itype = section ["type"] or "" local itype = section ["type"] or ""
local state = uci:get("openmptcprouter", interface, "state") or "" local state = uci:get("openmptcprouter", interface, "state") or ""
local connectivity = "OK"
--if not ipaddr or not gateway then return end --if not ipaddr or not gateway then return end
-- Don't show if0 in the overview -- Don't show if0 in the overview
@ -1311,7 +1312,7 @@ function interfaces_status()
if enabled == "0" then return end if enabled == "0" then return end
local connectivity = "OK" --local connectivity = "OK"
if ipaddr == "" and ifname ~= nil and ifname ~= "" and proto ~= "dhcpv6" then if ipaddr == "" and ifname ~= nil and ifname ~= "" and proto ~= "dhcpv6" then
ipaddr = ut.trim(sys.exec("ip -4 -br addr ls dev " .. ifname .. " | awk -F'[ /]+' '{print $3}' | tr -d '\n'")) ipaddr = ut.trim(sys.exec("ip -4 -br addr ls dev " .. ifname .. " | awk -F'[ /]+' '{print $3}' | tr -d '\n'"))
end end