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

Make status page working when DNS down

This commit is contained in:
Ycarus (Yannick Chabanois) 2019-11-22 19:28:31 +01:00
parent fb834a375e
commit 076ed244d1

View file

@ -669,7 +669,7 @@ function interfaces_status()
-- wanaddr
--mArray.openmptcprouter["wan_addr"] = uci:get("openmptcprouter","omr","public_detected_ipv4") or ""
if uci:get("openmptcprouter","settings","external_check") ~= "0" then
if uci:get("openmptcprouter","settings","external_check") ~= "0" and mArray.openmptcprouter["dns"] == true then
timeout = uci:get("openmptcprouter","settings","status_getip_timeout") or "2"
mArray.openmptcprouter["wan_addr"] = ut.trim(sys.exec("wget -4 -qO- -T " .. timeout .. " " .. check_ipv4_website))
if mArray.openmptcprouter["wan_addr"] == "" then
@ -1097,7 +1097,7 @@ function interfaces_status()
whois = ""
if publicIP ~= "" then
whois = uci:get("openmptcprouter",interface,"asn") or ""
if whois == "" and uci:get("openmptcprouter","settings","external_check") ~= "0" then
if whois == "" and uci:get("openmptcprouter","settings","external_check") ~= "0" and mArray.openmptcprouter["dns"] == true then
--whois = ut.trim(sys.exec("whois " .. publicIP .. " | grep -i 'netname' | awk '{print $2}'"))
whois = ut.trim(sys.exec("wget -4 -qO- -T 1 'http://api.iptoasn.com/v1/as/ip/" .. publicIP .. "' | jsonfilter -q -e '@.as_description'"))
end