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

Fix link status in status page

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-03-25 16:36:28 +01:00
parent f943f64d14
commit 8b5816e4f9
2 changed files with 19 additions and 18 deletions

View file

@ -428,11 +428,13 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
var whois = mArray.wans[i].whois;
var whois6 = mArray.wans[i].whois6;
var signal = mArray.wans[i].signal;
var status = mArray.wans[i].status;
var multipath = mArray.wans[i].multipath;
if(multipath == 'master')
{
master++;
}
var zonewan = mArray.wans[i].zonewan;
var latency = mArray.wans[i].latency;
var mtu = mArray.wans[i].mtu;
var operator = mArray.wans[i].operator;
@ -568,12 +570,12 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
{
statusMessage += '<%:No Server http response after 1 second%>' + '<br />';
}
if (stat == 'Offline' && ipaddr != '' && ipaddr == mArray.wans[i].gateway)
if (status == 'ERROR' && ipaddr != '' && ipaddr == mArray.wans[i].gateway)
{
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
statusMessageClass = "error";
}
if (stat == 'Offline' && ip6addr != '' && ip6addr == mArray.wans[i].gateway6)
if (status == 'ERROR' && ip6addr != '' && ip6addr == mArray.wans[i].gateway6)
{
statusMessage += '<%:Wan IP and gateway are identical%>' + '<br />';
statusMessageClass = "error";
@ -612,6 +614,11 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
statusMessage += '<%:Network interface MAC address duplicated%>' + '<br />';
statusMessageClass = "error";
}
if(zonewan == "NO")
{
statusMessage += '<%:Network interface not in WAN firewall zone%>' + '<br />';
statusMessageClass = "error";
}
if(ipv6_discover == 'DETECTED')
{
statusMessage += '<%:IPv6 route received%>' + '<br />'
@ -621,6 +628,11 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
statusMessageClass = "warning";
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
}
if (statusMessage !== "" && statusMessageClass == "error")
{
statusMessageClass = "error";
statusIcon = "<%=resource%>/openmptcprouter/images/statusError.png";
}
content += String.format('<%:multipath:%> %s<br />',multipath);
if(mArray.wans[i].qos && mArray.wans[i].download > 0 && mArray.wans[i].upload > 0)
{

View file

@ -1121,7 +1121,7 @@ function interfaces_status()
local ipv6 = section["ipv6"] or "0"
local mac = section ["macaddr"] or ""
local itype = section ["type"] or ""
local state = section ["state"] or ""
local state = uci:get("openmptcprouter", interface, "state") or ""
--if not ipaddr or not gateway then return end
-- Don't show if0 in the overview
@ -1358,28 +1358,17 @@ function interfaces_status()
if mArray.openmptcprouter["service_addr_ip"] ~= "" then
server_http_test = sys.exec("httping -l " .. mArray.openmptcprouter["service_addr_ip"] .. ":" .. adminport .. " -y " .. ipaddr .. " -t 1 -c 1")
server_http_result = ut.trim(sys.exec("echo '" .. server_http_test .. "' | grep '100.00% failed'"))
if server_http_result ~= "" then
server_http = "DOWN"
if connectivity == "OK" then
connectivity = "WARNING"
end
end
end
if mArray.openmptcprouter["service_addr_ip6"] ~= "" then
elseif mArray.openmptcprouter["service_addr_ip6"] ~= "" then
server_http_test = sys.exec("httping -l [" .. mArray.openmptcprouter["service_addr_ip6"] .. "]:" .. adminport .. " -y " .. ipaddr .. " -t 1 -c 1")
server_http_result = ut.trim(sys.exec("echo '" .. server_http_test .. "' | grep '100.00% failed'"))
if server_http_result ~= "" then
server_http = "DOWN"
if connectivity == "OK" then
connectivity = "WARNING"
end
end
end
if server_http_result ~= "" then
server_http = "DOWN"
if connectivity == "OK" then
connectivity = "WARNING"
end
else
server_http = "UP"
end
end
end
@ -1401,7 +1390,7 @@ function interfaces_status()
end
local zonewan = "NO"
if ut.trim(sys.exec("uci -q get firewall.zone_wan.networks | grep '" .. interface .. "'")) ~= "" then
if ut.trim(sys.exec("uci -q get firewall.zone_wan.network | grep '" .. interface .. "'")) ~= "" then
zonewan = "OK"
end