mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Check if no ifname defined
This commit is contained in:
parent
c3147b8d5b
commit
19dd424765
1 changed files with 14 additions and 9 deletions
|
@ -527,18 +527,21 @@ function interfaces_status()
|
||||||
if ifname == "" then
|
if ifname == "" then
|
||||||
ifname = get_device(interface)
|
ifname = get_device(interface)
|
||||||
end
|
end
|
||||||
|
|
||||||
--if multipath == "off" and not ifname:match("^tun.*") then return end
|
--if multipath == "off" and not ifname:match("^tun.*") then return end
|
||||||
if multipath == "off" then return end
|
if multipath == "off" then return end
|
||||||
|
|
||||||
local asn
|
local asn
|
||||||
|
|
||||||
local connectivity
|
local connectivity
|
||||||
|
|
||||||
|
if ifname ~= "" and ifname ~= nil then
|
||||||
local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
|
local multipath_state = ut.trim(sys.exec("multipath " .. ifname .. " | grep deactivated"))
|
||||||
if multipath_state == "" and ifname ~= "" then
|
if multipath_state == "" then
|
||||||
connectivity = 'OK'
|
connectivity = 'OK'
|
||||||
else
|
else
|
||||||
connectivity = 'ERROR'
|
connectivity = 'ERROR'
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ipaddr == "" then
|
if ipaddr == "" then
|
||||||
connectivity = 'ERROR'
|
connectivity = 'ERROR'
|
||||||
|
@ -549,7 +552,7 @@ function interfaces_status()
|
||||||
if gateway == "" then
|
if gateway == "" then
|
||||||
gateway = get_gateway(interface)
|
gateway = get_gateway(interface)
|
||||||
end
|
end
|
||||||
if gateway == "" then
|
if gateway == "" and ifname ~= nil then
|
||||||
gateway = ut.trim(sys.exec("ip -4 r list dev " .. ifname .. " | grep kernel | awk '/proto kernel/ {print $1}' | grep -v / | tr -d '\n'"))
|
gateway = ut.trim(sys.exec("ip -4 r list dev " .. ifname .. " | grep kernel | awk '/proto kernel/ {print $1}' | grep -v / | tr -d '\n'"))
|
||||||
end
|
end
|
||||||
if gateway ~= "" then
|
if gateway ~= "" then
|
||||||
|
@ -566,7 +569,7 @@ function interfaces_status()
|
||||||
connectivity = 'ERROR'
|
connectivity = 'ERROR'
|
||||||
end
|
end
|
||||||
|
|
||||||
if mArray.openmptcprouter["dns"] == true and ifname ~= "" and gateway ~= "" and gw_ping == "UP" then
|
if mArray.openmptcprouter["dns"] == true and ifname ~= nil and gateway ~= "" and gw_ping == "UP" then
|
||||||
-- Test if multipath can work on the connection
|
-- Test if multipath can work on the connection
|
||||||
local multipath_available
|
local multipath_available
|
||||||
local multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
local multipath_available_state = ut.trim(sys.exec("omr-mptcp-intf " .. ifname .. " | grep 'Nay, Nay, Nay'"))
|
||||||
|
@ -582,6 +585,7 @@ function interfaces_status()
|
||||||
|
|
||||||
-- Detect if WAN get an IPv6
|
-- Detect if WAN get an IPv6
|
||||||
local ipv6_discover = 'NONE'
|
local ipv6_discover = 'NONE'
|
||||||
|
if ifname ~= nil then
|
||||||
if tonumber((sys.exec("sysctl net.ipv6.conf.all.disable_ipv6")):match(" %d+")) == 0 then
|
if tonumber((sys.exec("sysctl net.ipv6.conf.all.disable_ipv6")):match(" %d+")) == 0 then
|
||||||
local ipv6_result = _ipv6_discover(ifname)
|
local ipv6_result = _ipv6_discover(ifname)
|
||||||
if type(ipv6_result) == "table" and #ipv6_result > 0 then
|
if type(ipv6_result) == "table" and #ipv6_result > 0 then
|
||||||
|
@ -599,6 +603,7 @@ function interfaces_status()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local publicIP = "-"
|
local publicIP = "-"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue