|
@ -60,9 +60,9 @@ function index() |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function getInterfaceStatus(ruleNumber, interfaceName) |
|
|
function getInterfaceStatus(ruleNumber, interfaceName) |
|
|
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".enabled")) == "1" then |
|
|
|
|
|
|
|
|
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then |
|
|
if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then |
|
|
if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then |
|
|
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".track_ip")) ~= "" then |
|
|
|
|
|
|
|
|
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then |
|
|
return "online" |
|
|
return "online" |
|
|
else |
|
|
else |
|
|
return "notMonitored" |
|
|
return "notMonitored" |
|
@ -98,7 +98,7 @@ function interfaceStatus() |
|
|
wansid = {} |
|
|
wansid = {} |
|
|
|
|
|
|
|
|
for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do |
|
|
for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do |
|
|
local wanInterfaceName = ut.trim(sys.exec("uci get -p /var/state network." .. wanName .. ".ifname")) |
|
|
|
|
|
|
|
|
local wanInterfaceName = ut.trim(sys.exec("uci -p /var/state get network." .. wanName .. ".ifname")) |
|
|
if wanInterfaceName == "" then |
|
|
if wanInterfaceName == "" then |
|
|
wanInterfaceName = "X" |
|
|
wanInterfaceName = "X" |
|
|
end |
|
|
end |
|
@ -159,7 +159,7 @@ function diagnosticsData(interface, tool, task) |
|
|
results = "MWAN3 started" |
|
|
results = "MWAN3 started" |
|
|
end |
|
|
end |
|
|
else |
|
|
else |
|
|
local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interface .. ".ifname")) |
|
|
|
|
|
|
|
|
local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interface .. ".ifname")) |
|
|
if interfaceDevice ~= "" then |
|
|
if interfaceDevice ~= "" then |
|
|
if tool == "ping" then |
|
|
if tool == "ping" then |
|
|
local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'")) |
|
|
local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'")) |
|
@ -168,7 +168,7 @@ function diagnosticsData(interface, tool, task) |
|
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway |
|
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway |
|
|
results = pingCommand .. "\n\n" .. sys.exec(pingCommand) |
|
|
results = pingCommand .. "\n\n" .. sys.exec(pingCommand) |
|
|
else |
|
|
else |
|
|
local tracked = ut.trim(sys.exec("uci get -p /var/state mwan3." .. interface .. ".track_ip")) |
|
|
|
|
|
|
|
|
local tracked = ut.trim(sys.exec("uci -p /var/state get mwan3." .. interface .. ".track_ip")) |
|
|
if tracked ~= "" then |
|
|
if tracked ~= "" then |
|
|
for z in tracked:gmatch("[^ ]+") do |
|
|
for z in tracked:gmatch("[^ ]+") do |
|
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z |
|
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z |
|
@ -223,16 +223,18 @@ function diagnosticsData(interface, tool, task) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function troubleshootingData() |
|
|
function troubleshootingData() |
|
|
|
|
|
local ver = require "luci.version" |
|
|
|
|
|
|
|
|
local mArray = {} |
|
|
local mArray = {} |
|
|
|
|
|
|
|
|
-- software versions |
|
|
-- software versions |
|
|
local wrtRelease = ut.trim(luci.version.distversion) |
|
|
|
|
|
|
|
|
local wrtRelease = ut.trim(ver.distversion) |
|
|
if wrtRelease ~= "" then |
|
|
if wrtRelease ~= "" then |
|
|
wrtRelease = "OpenWrt - " .. wrtRelease |
|
|
wrtRelease = "OpenWrt - " .. wrtRelease |
|
|
else |
|
|
else |
|
|
wrtRelease = "OpenWrt - unknown" |
|
|
wrtRelease = "OpenWrt - unknown" |
|
|
end |
|
|
end |
|
|
local luciRelease = ut.trim(luci.version.luciversion) |
|
|
|
|
|
|
|
|
local luciRelease = ut.trim(ver.luciversion) |
|
|
if luciRelease ~= "" then |
|
|
if luciRelease ~= "" then |
|
|
luciRelease = "\nLuCI - " .. luciRelease |
|
|
luciRelease = "\nLuCI - " .. luciRelease |
|
|
else |
|
|
else |
|
@ -300,7 +302,7 @@ function troubleshootingData() |
|
|
mArray.routelist = { routeString } |
|
|
mArray.routelist = { routeString } |
|
|
|
|
|
|
|
|
-- default firewall output policy |
|
|
-- default firewall output policy |
|
|
local firewallOut = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output")) |
|
|
|
|
|
|
|
|
local firewallOut = ut.trim(sys.exec("uci -p /var/state get firewall.@defaults[0].output")) |
|
|
if firewallOut == "" then |
|
|
if firewallOut == "" then |
|
|
firewallOut = "No data found" |
|
|
firewallOut = "No data found" |
|
|
end |
|
|
end |
|
|