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

Detect Direct Output or not

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-05-01 17:22:39 +02:00
parent 9ee03b8f62
commit a8ab9477d9
2 changed files with 18 additions and 3 deletions

View file

@ -240,12 +240,15 @@ local statuslogo = ucic:get("openmptcprouter","settings","statuslogo") or "openm
} else if (mArray.openmptcprouter.wan_addr6 != "" && mArray.openmptcprouter.service_addr == "127.0.0.1")
{
var title = String.format("%s (%s)", mArray.openmptcprouter.vps_hostname, mArray.openmptcprouter.wan_addr6);
} else if (mArray.openmptcprouter.wan_addr != "")
} else if (mArray.openmptcprouter.direct_output == false)
{
var title = String.format("%s (%s)", mArray.openmptcprouter.vps_hostname, mArray.openmptcprouter.wan_addr6);
} else if (mArray.openmptcprouter.wan_addr != "" && mArray.openmptcprouter.direct_output == true)
{
var title = String.format("%s (%s)", _('Direct output'), mArray.openmptcprouter.wan_addr);
statusMessageClass = "warning";
statusIcon = "<%=resource%>/openmptcprouter/images/statusWarning.png";
} else if (mArray.openmptcprouter.wan_addr6 != "")
} else if (mArray.openmptcprouter.wan_addr6 != "" && mArray.openmptcprouter.direct_output == true)
{
var title = String.format("%s (%s)", _('Direct output'), mArray.openmptcprouter.wan_addr6);
statusMessageClass = "warning";

View file

@ -743,7 +743,8 @@ function interfaces_status()
mArray.openmptcprouter["service_addr"] = ""
ucic:foreach("openmptcprouter", "server", function(s)
local serverip = uci:get("openmptcprouter",s[".name"],"ip") or ""
if serverip ~= "" then
local disabled = uci:get("openmptcprouter",s[".name"],"disabled") or "0"
if serverip ~= "" and disabled ~= "1" then
mArray.openmptcprouter["service_addr"] = serverip
end
end)
@ -1102,6 +1103,8 @@ function interfaces_status()
end
end
mArray.openmptcprouter["direct_output"] = false
-- overview status
mArray.wans = {}
mArray.tunnels = {}
@ -1175,6 +1178,15 @@ function interfaces_status()
end
if ipaddr == "" and ip6addr == "" then
connectivity = "ERROR"
else
if mArray.openmptcprouter["wan_addr"] == ipaddr then
mArray.openmptcprouter["direct_output"] = true
end
if mArray.openmptcprouter["ipv6"] == "enabled" or ( mArray.openmptcprouter["service_addr_ip6"] ~= "" and mArray.openmptcprouter["service_addr_ip6"] ~= nil) then
if mArray.openmptcprouter["wan_addr6"] == ip6addr then
mArray.openmptcprouter["direct_output"] = true
end
end
end
local multipath_state = ""