mwan3-luci: update to 1.3-5
new naming/wording - more generically mwan than mwan3 renamed cryptic variables/functions/etc everywhere removed unused and unnecessary variables everywhere cleaned up ugly and inefficient Lua and Javascript Signed-off-by: Aedan Renner chipdankly@gmail.com
This commit is contained in:
parent
80ea53d1f4
commit
0d93a49757
30 changed files with 915 additions and 989 deletions
|
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=luci-app-mwan3
|
PKG_NAME:=luci-app-mwan3
|
||||||
PKG_VERSION:=1.3
|
PKG_VERSION:=1.3
|
||||||
PKG_RELEASE:=4
|
PKG_RELEASE:=5
|
||||||
PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
|
PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
|
||||||
PKG_LICENSE:=GPLv2
|
PKG_LICENSE:=GPLv2
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ define Package/luci-app-mwan3
|
||||||
CATEGORY:=LuCI
|
CATEGORY:=LuCI
|
||||||
SUBMENU:=3. Applications
|
SUBMENU:=3. Applications
|
||||||
TITLE:=LuCI support for the MWAN3 multiwan hotplug script
|
TITLE:=LuCI support for the MWAN3 multiwan hotplug script
|
||||||
DEPENDS:=+mwan3 +luci-mod-admin-full +luci-lib-nixio
|
DEPENDS:=+mwan3 +luci-mod-admin-full +luci-app-firewall +luci-lib-nixio
|
||||||
PKGARCH:=all
|
PKGARCH:=all
|
||||||
MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
|
MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# to enable this script uncomment the case loop at the bottom
|
# to enable this script uncomment the case loop at the bottom
|
||||||
# to report mwan3 status on interface hotplug ifup/ifdown events modify the lines in the send_alert function
|
# to report mwan status on interface hotplug ifup/ifdown events modify the lines in the send_alert function
|
||||||
|
|
||||||
send_alert()
|
send_alert()
|
||||||
{
|
{
|
||||||
# variable "$1" stores the mwan3 status information
|
# variable "$1" stores the MWAN status information
|
||||||
# insert your code here to send the contents of "$1"
|
# insert your code here to send the contents of "$1"
|
||||||
echo "$1"
|
echo "$1"
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,11 @@ gather_event_info()
|
||||||
# get current interface, policy and rule status
|
# get current interface, policy and rule status
|
||||||
local CURRENT_STATUS="$(/usr/sbin/mwan3 status)"
|
local CURRENT_STATUS="$(/usr/sbin/mwan3 status)"
|
||||||
|
|
||||||
# get last 50 mwan3 systemlog messages
|
# get last 50 MWAN systemlog messages
|
||||||
local MWAN3_LOG="$(echo -e "Last 50 MWAN3 systemlog entries. Newest entries sorted at the top:\n$(logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x')")"
|
local MWAN_LOG="$(echo -e "Last 50 MWAN systemlog entries. Newest entries sorted at the top:\n$(logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x')")"
|
||||||
|
|
||||||
# pass event info to send_alert function
|
# pass event info to send_alert function
|
||||||
send_alert "$(echo -e "$EVENT_INFO\n\n$CURRENT_STATUS\n\n$MWAN3_LOG")"
|
send_alert "$(echo -e "$EVENT_INFO\n\n$CURRENT_STATUS\n\n$MWAN_LOG")"
|
||||||
}
|
}
|
||||||
|
|
||||||
#case "$ACTION" in
|
#case "$ACTION" in
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# replace existing mwan3-luci ucitrack entry
|
# replace existing mwan ucitrack entry
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
del ucitrack.@mwan3[-1]
|
del ucitrack.@mwan3[-1]
|
||||||
add ucitrack mwan3
|
add ucitrack mwan3
|
|
@ -8,348 +8,311 @@ function index()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
entry({"admin", "network", "mwan3"},
|
entry({"admin", "network", "mwan"},
|
||||||
alias("admin", "network", "mwan3", "overview"),
|
alias("admin", "network", "mwan", "overview"),
|
||||||
_("Load Balancing"), 600)
|
_("Load Balancing"), 600)
|
||||||
|
|
||||||
entry({"admin", "network", "mwan3", "overview"},
|
entry({"admin", "network", "mwan", "overview"},
|
||||||
alias("admin", "network", "mwan3", "overview", "over_iface"),
|
alias("admin", "network", "mwan", "overview", "overview_interface"),
|
||||||
_("Overview"), 10)
|
_("Overview"), 10)
|
||||||
entry({"admin", "network", "mwan3", "overview", "over_iface"},
|
entry({"admin", "network", "mwan", "overview", "overview_interface"},
|
||||||
template("mwan3/mwan3_over_interface"))
|
template("mwan/overview_interface"))
|
||||||
entry({"admin", "network", "mwan3", "overview", "iface_status"},
|
entry({"admin", "network", "mwan", "overview", "interface_status"},
|
||||||
call("mwan3_iface_status"))
|
call("interfaceStatus"))
|
||||||
entry({"admin", "network", "mwan3", "overview", "over_detail"},
|
entry({"admin", "network", "mwan", "overview", "overview_detailed"},
|
||||||
template("mwan3/mwan3_over_detail"))
|
template("mwan/overview_detailed"))
|
||||||
entry({"admin", "network", "mwan3", "overview", "detail_status"},
|
entry({"admin", "network", "mwan", "overview", "detailed_status"},
|
||||||
call("mwan3_detail_status"))
|
call("detailedStatus"))
|
||||||
|
|
||||||
entry({"admin", "network", "mwan3", "configuration"},
|
entry({"admin", "network", "mwan", "configuration"},
|
||||||
alias("admin", "network", "mwan3", "configuration", "interface"),
|
alias("admin", "network", "mwan", "configuration", "interface"),
|
||||||
_("Configuration"), 20)
|
_("Configuration"), 20)
|
||||||
entry({"admin", "network", "mwan3", "configuration", "interface"},
|
entry({"admin", "network", "mwan", "configuration", "interface"},
|
||||||
arcombine(cbi("mwan3/mwan3_interface"), cbi("mwan3/mwan3_interfaceconfig")),
|
arcombine(cbi("mwan/interface"), cbi("mwan/interfaceconfig")),
|
||||||
_("Interfaces"), 10).leaf = true
|
_("Interfaces"), 10).leaf = true
|
||||||
entry({"admin", "network", "mwan3", "configuration", "member"},
|
entry({"admin", "network", "mwan", "configuration", "member"},
|
||||||
arcombine(cbi("mwan3/mwan3_member"), cbi("mwan3/mwan3_memberconfig")),
|
arcombine(cbi("mwan/member"), cbi("mwan/memberconfig")),
|
||||||
_("Members"), 20).leaf = true
|
_("Members"), 20).leaf = true
|
||||||
entry({"admin", "network", "mwan3", "configuration", "policy"},
|
entry({"admin", "network", "mwan", "configuration", "policy"},
|
||||||
arcombine(cbi("mwan3/mwan3_policy"), cbi("mwan3/mwan3_policyconfig")),
|
arcombine(cbi("mwan/policy"), cbi("mwan/policyconfig")),
|
||||||
_("Policies"), 30).leaf = true
|
_("Policies"), 30).leaf = true
|
||||||
entry({"admin", "network", "mwan3", "configuration", "rule"},
|
entry({"admin", "network", "mwan", "configuration", "rule"},
|
||||||
arcombine(cbi("mwan3/mwan3_rule"), cbi("mwan3/mwan3_ruleconfig")),
|
arcombine(cbi("mwan/rule"), cbi("mwan/ruleconfig")),
|
||||||
_("Rules"), 40).leaf = true
|
_("Rules"), 40).leaf = true
|
||||||
|
|
||||||
entry({"admin", "network", "mwan3", "advanced"},
|
entry({"admin", "network", "mwan", "advanced"},
|
||||||
alias("admin", "network", "mwan3", "advanced", "hotplug"),
|
alias("admin", "network", "mwan", "advanced", "hotplugscript"),
|
||||||
_("Advanced"), 100)
|
_("Advanced"), 100)
|
||||||
entry({"admin", "network", "mwan3", "advanced", "hotplug"},
|
entry({"admin", "network", "mwan", "advanced", "hotplugscript"},
|
||||||
form("mwan3/mwan3_adv_hotplug"))
|
form("mwan/advanced_hotplugscript"))
|
||||||
entry({"admin", "network", "mwan3", "advanced", "mwan3"},
|
entry({"admin", "network", "mwan", "advanced", "mwanconfig"},
|
||||||
form("mwan3/mwan3_adv_mwan3"))
|
form("mwan/advanced_mwanconfig"))
|
||||||
entry({"admin", "network", "mwan3", "advanced", "network"},
|
entry({"admin", "network", "mwan", "advanced", "networkconfig"},
|
||||||
form("mwan3/mwan3_adv_network"))
|
form("mwan/advanced_networkconfig"))
|
||||||
entry({"admin", "network", "mwan3", "advanced", "diag"},
|
entry({"admin", "network", "mwan", "advanced", "diagnostics"},
|
||||||
template("mwan3/mwan3_adv_diagnostics"))
|
template("mwan/advanced_diagnostics"))
|
||||||
entry({"admin", "network", "mwan3", "advanced", "diag_display"},
|
entry({"admin", "network", "mwan", "advanced", "diagnostics_display"},
|
||||||
call("mwan3_diag_data"), nil).leaf = true
|
call("diagnosticsData"), nil).leaf = true
|
||||||
entry({"admin", "network", "mwan3", "advanced", "tshoot"},
|
entry({"admin", "network", "mwan", "advanced", "troubleshooting"},
|
||||||
template("mwan3/mwan3_adv_troubleshoot"))
|
template("mwan/advanced_troubleshooting"))
|
||||||
entry({"admin", "network", "mwan3", "advanced", "tshoot_display"},
|
entry({"admin", "network", "mwan", "advanced", "troubleshooting_display"},
|
||||||
call("mwan3_tshoot_data"))
|
call("troubleshootingData"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_get_iface_status(rulenum, ifname)
|
function getInterfaceStatus(ruleNumber, interfaceName)
|
||||||
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".enabled")) == "1" then
|
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".enabled")) == "1" then
|
||||||
if ut.trim(sys.exec("ip route list table " .. rulenum)) ~= "" then
|
if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then
|
||||||
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".track_ip")) ~= "" then
|
if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".track_ip")) ~= "" then
|
||||||
return "on"
|
return "online"
|
||||||
else
|
else
|
||||||
return "nm"
|
return "notMonitored"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return "off"
|
return "offline"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return "ne"
|
return "notEnabled"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_get_iface()
|
function getInterfaceName()
|
||||||
local rulenum, str = 0, ""
|
local ruleNumber, status = 0, ""
|
||||||
uci.cursor():foreach("mwan3", "interface",
|
uci.cursor():foreach("mwan3", "interface",
|
||||||
function (section)
|
function (section)
|
||||||
rulenum = rulenum+1
|
ruleNumber = ruleNumber+1
|
||||||
str = str .. section[".name"] .. "[" .. mwan3_get_iface_status(rulenum, section[".name"]) .. "]"
|
status = status .. section[".name"] .. "[" .. getInterfaceStatus(ruleNumber, section[".name"]) .. "]"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
return str
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_iface_status()
|
function interfaceStatus()
|
||||||
local ntm = require "luci.model.network".init()
|
local ntm = require "luci.model.network".init()
|
||||||
|
|
||||||
local rv = { }
|
local mArray = {}
|
||||||
|
|
||||||
-- overview status
|
-- overview status
|
||||||
local statstr = mwan3_get_iface()
|
local statusString = getInterfaceName()
|
||||||
if statstr ~= "" then
|
if statusString ~= "" then
|
||||||
rv.wans = { }
|
mArray.wans = {}
|
||||||
wansid = {}
|
wansid = {}
|
||||||
|
|
||||||
for wanname, ifstat in string.gfind(statstr, "([^%[]+)%[([^%]]+)%]") do
|
for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do
|
||||||
local wanifname = ut.trim(sys.exec("uci get -p /var/state network." .. wanname .. ".ifname"))
|
local wanInterfaceName = ut.trim(sys.exec("uci get -p /var/state network." .. wanName .. ".ifname"))
|
||||||
if wanifname == "" then
|
if wanInterfaceName == "" then
|
||||||
wanifname = "X"
|
wanInterfaceName = "X"
|
||||||
end
|
end
|
||||||
local wanlink = ntm:get_interface(wanifname)
|
local wanDeviceLink = ntm:get_interface(wanInterfaceName)
|
||||||
wanlink = wanlink and wanlink:get_network()
|
wanDeviceLink = wanDeviceLink and wanDeviceLink:get_network()
|
||||||
wanlink = wanlink and wanlink:adminlink() or "#"
|
wanDeviceLink = wanDeviceLink and wanDeviceLink:adminlink() or "#"
|
||||||
wansid[wanname] = #rv.wans + 1
|
wansid[wanName] = #mArray.wans + 1
|
||||||
rv.wans[wansid[wanname]] = { name = wanname, link = wanlink, ifname = wanifname, status = ifstat }
|
mArray.wans[wansid[wanName]] = { name = wanName, link = wanDeviceLink, ifname = wanInterfaceName, status = interfaceState }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- overview status log
|
-- overview status log
|
||||||
local mwlg = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x'"))
|
local mwanLog = ut.trim(sys.exec("logread | grep mwan3 | tail -n 50 | sed 'x;1!H;$!d;x'"))
|
||||||
if mwlg ~= "" then
|
if mwanLog ~= "" then
|
||||||
rv.mwan3log = { }
|
mArray.mwanlog = { mwanLog }
|
||||||
mwlog = {}
|
|
||||||
mwlog[mwlg] = #rv.mwan3log + 1
|
|
||||||
rv.mwan3log[mwlog[mwlg]] = { mwanlog = mwlg }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(mArray)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_detail_status()
|
function detailedStatus()
|
||||||
local rv = { }
|
local mArray = {}
|
||||||
|
|
||||||
-- detailed mwan3 status
|
-- detailed mwan status
|
||||||
local dst = ut.trim(sys.exec("mwan3 status"))
|
local detailStatusInfo = ut.trim(sys.exec("/usr/sbin/mwan3 status"))
|
||||||
if dst ~= "" then
|
if detailStatusInfo ~= "" then
|
||||||
rv.mwan3dst = { }
|
mArray.mwandetail = { detailStatusInfo }
|
||||||
dstat = {}
|
|
||||||
dstat[dst] = #rv.mwan3dst + 1
|
|
||||||
rv.mwan3dst[dstat[dst]] = { detailstat = dst }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(mArray)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_diag_data(iface, tool, alt)
|
function diagnosticsData(interface, tool, task)
|
||||||
function get_ifnum()
|
function getInterfaceNumber()
|
||||||
local num = 0
|
local number = 0
|
||||||
uci.cursor():foreach("mwan3", "interface",
|
uci.cursor():foreach("mwan3", "interface",
|
||||||
function (section)
|
function (section)
|
||||||
num = num+1
|
number = number+1
|
||||||
if section[".name"] == iface then
|
if section[".name"] == interface then
|
||||||
ifnum = num
|
interfaceNumber = number
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
local rv = { }
|
local mArray = {}
|
||||||
|
|
||||||
local res = ""
|
local results = ""
|
||||||
if tool == "service" then
|
if tool == "service" then
|
||||||
os.execute("mwan3 " .. alt)
|
os.execute("/usr/sbin/mwan3 " .. task)
|
||||||
if alt == "restart" then
|
if task == "restart" then
|
||||||
res = "MWAN3 restarted"
|
results = "MWAN3 restarted"
|
||||||
elseif alt == "stop" then
|
elseif task == "stop" then
|
||||||
res = "MWAN3 stopped"
|
results = "MWAN3 stopped"
|
||||||
else
|
else
|
||||||
res = "MWAN3 started"
|
results = "MWAN3 started"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. iface .. ".ifname"))
|
local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interface .. ".ifname"))
|
||||||
if ifdev ~= "" then
|
if interfaceDevice ~= "" then
|
||||||
if tool == "ping" then
|
if tool == "ping" then
|
||||||
local gateway = ut.trim(sys.exec("route -n | awk '{ if ($8 == \"" .. ifdev .. "\" && $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}'"))
|
||||||
if gateway ~= "" then
|
if gateway ~= "" then
|
||||||
if alt == "gateway" then
|
if task == "gateway" then
|
||||||
local cmd = "ping -c 3 -W 2 -I " .. ifdev .. " " .. gateway
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway
|
||||||
res = cmd .. "\n\n" .. sys.exec(cmd)
|
results = pingCommand .. "\n\n" .. sys.exec(pingCommand)
|
||||||
else
|
else
|
||||||
local str = ut.trim(sys.exec("uci get -p /var/state mwan3." .. iface .. ".track_ip"))
|
local tracked = ut.trim(sys.exec("uci get -p /var/state mwan3." .. interface .. ".track_ip"))
|
||||||
if str ~= "" then
|
if tracked ~= "" then
|
||||||
for z in str:gmatch("[^ ]+") do
|
for z in tracked:gmatch("[^ ]+") do
|
||||||
local cmd = "ping -c 3 -W 2 -I " .. ifdev .. " " .. z
|
local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z
|
||||||
res = res .. cmd .. "\n\n" .. sys.exec(cmd) .. "\n\n"
|
results = results .. pingCommand .. "\n\n" .. sys.exec(pingCommand) .. "\n\n"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
res = "No tracking IP addresses configured on " .. iface
|
results = "No tracking IP addresses configured on " .. interface
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
res = "No default gateway for " .. iface .. " found. Default route does not exist or is configured incorrectly"
|
results = "No default gateway for " .. interface .. " found. Default route does not exist or is configured incorrectly"
|
||||||
end
|
end
|
||||||
elseif tool == "rulechk" then
|
elseif tool == "rulechk" then
|
||||||
get_ifnum()
|
getInterfaceNumber()
|
||||||
local rule1 = sys.exec("ip rule | grep $(echo $((" .. ifnum .. " + 1000)))")
|
local rule1 = sys.exec("ip rule | grep $(echo $((" .. interfaceNumber .. " + 1000)))")
|
||||||
local rule2 = sys.exec("ip rule | grep $(echo $((" .. ifnum .. " + 2000)))")
|
local rule2 = sys.exec("ip rule | grep $(echo $((" .. interfaceNumber .. " + 2000)))")
|
||||||
if rule1 ~= "" and rule2 ~= "" then
|
if rule1 ~= "" and rule2 ~= "" then
|
||||||
res = "All required interface IP rules found:\n\n" .. rule1 .. rule2
|
results = "All required interface IP rules found:\n\n" .. rule1 .. rule2
|
||||||
elseif rule1 ~= "" or rule2 ~= "" then
|
elseif rule1 ~= "" or rule2 ~= "" then
|
||||||
res = "Missing 1 of the 2 required interface IP rules\n\n\nRules found:\n\n" .. rule1 .. rule2
|
results = "Missing 1 of the 2 required interface IP rules\n\n\nRules found:\n\n" .. rule1 .. rule2
|
||||||
else
|
else
|
||||||
res = "Missing both of the required interface IP rules"
|
results = "Missing both of the required interface IP rules"
|
||||||
end
|
end
|
||||||
elseif tool == "routechk" then
|
elseif tool == "routechk" then
|
||||||
get_ifnum()
|
getInterfaceNumber()
|
||||||
local table = sys.exec("ip route list table " .. ifnum)
|
local routeTable = sys.exec("ip route list table " .. interfaceNumber)
|
||||||
if table ~= "" then
|
if routeTable ~= "" then
|
||||||
res = "Interface routing table " .. ifnum .. " was found:\n\n" .. table
|
results = "Interface routing table " .. interfaceNumber .. " was found:\n\n" .. routeTable
|
||||||
else
|
else
|
||||||
res = "Missing required interface routing table " .. ifnum
|
results = "Missing required interface routing table " .. interfaceNumber
|
||||||
end
|
end
|
||||||
elseif tool == "hotplug" then
|
elseif tool == "hotplug" then
|
||||||
if alt == "ifup" then
|
if task == "ifup" then
|
||||||
os.execute("mwan3 ifup " .. iface)
|
os.execute("/usr/sbin/mwan3 ifup " .. interface)
|
||||||
res = "Hotplug ifup sent to interface " .. iface .. "..."
|
results = "Hotplug ifup sent to interface " .. interface .. "..."
|
||||||
else
|
else
|
||||||
os.execute("mwan3 ifdown " .. iface)
|
os.execute("/usr/sbin/mwan3 ifdown " .. interface)
|
||||||
res = "Hotplug ifdown sent to interface " .. iface .. "..."
|
results = "Hotplug ifdown sent to interface " .. interface .. "..."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
res = "Unable to perform diagnostic tests on " .. iface .. ". There is no physical or virtual device associated with this interface"
|
results = "Unable to perform diagnostic tests on " .. interface .. ". There is no physical or virtual device associated with this interface"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if res ~= "" then
|
if results ~= "" then
|
||||||
res = ut.trim(res)
|
results = ut.trim(results)
|
||||||
rv.diagres = { }
|
mArray.diagnostics = { results }
|
||||||
dres = {}
|
|
||||||
dres[res] = #rv.diagres + 1
|
|
||||||
rv.diagres[dres[res]] = { diagresult = res }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(mArray)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mwan3_tshoot_data()
|
function troubleshootingData()
|
||||||
local rv = { }
|
local mArray = {}
|
||||||
|
|
||||||
-- software versions
|
-- software versions
|
||||||
local wrtrelease = ut.trim(luci.version.distversion)
|
local wrtRelease = ut.trim(luci.version.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(luci.version.luciversion)
|
||||||
if lucirelease ~= "" then
|
if luciRelease ~= "" then
|
||||||
lucirelease = "\nLuCI - " .. lucirelease
|
luciRelease = "\nLuCI - " .. luciRelease
|
||||||
else
|
else
|
||||||
lucirelease = "\nLuCI - unknown"
|
luciRelease = "\nLuCI - unknown"
|
||||||
end
|
end
|
||||||
local mwan3version = ut.trim(sys.exec("opkg info mwan3 | grep Version | awk '{ print $2 }'"))
|
local mwanVersion = ut.trim(sys.exec("opkg info mwan3 | grep Version | awk '{print $2}'"))
|
||||||
if mwan3version ~= "" then
|
if mwanVersion ~= "" then
|
||||||
mwan3version = "\n\nmwan3 - " .. mwan3version
|
mwanVersion = "\n\nmwan3 - " .. mwanVersion
|
||||||
else
|
else
|
||||||
mwan3version = "\nmwan3 - unknown"
|
mwanVersion = "\n\nmwan3 - unknown"
|
||||||
end
|
end
|
||||||
local mwan3lversion = ut.trim(sys.exec("opkg info luci-app-mwan3 | grep Version | awk '{ print $2 }'"))
|
local mwanLuciVersion = ut.trim(sys.exec("opkg info luci-app-mwan3 | grep Version | awk '{print $2}'"))
|
||||||
if mwan3lversion ~= "" then
|
if mwanLuciVersion ~= "" then
|
||||||
mwan3lversion = "\nmwan3-luci - " .. mwan3lversion
|
mwanLuciVersion = "\nmwan3-luci - " .. mwanLuciVersion
|
||||||
else
|
else
|
||||||
mwan3lversion = "\nmwan3-luci - unknown"
|
mwanLuciVersion = "\nmwan3-luci - unknown"
|
||||||
end
|
end
|
||||||
local softrev = wrtrelease .. lucirelease .. mwan3version .. mwan3lversion
|
mArray.versions = { wrtRelease .. luciRelease .. mwanVersion .. mwanLuciVersion }
|
||||||
rv.mw3ver = { }
|
|
||||||
mwv = {}
|
|
||||||
mwv[softrev] = #rv.mw3ver + 1
|
|
||||||
rv.mw3ver[mwv[softrev]] = { mwan3v = softrev }
|
|
||||||
|
|
||||||
-- mwan3 config
|
-- mwan config
|
||||||
local mwcg = ut.trim(sys.exec("cat /etc/config/mwan3"))
|
local mwanConfig = ut.trim(sys.exec("cat /etc/config/mwan3"))
|
||||||
if mwcg == "" then
|
if mwanConfig == "" then
|
||||||
mwcg = "No data found"
|
mwanConfig = "No data found"
|
||||||
end
|
end
|
||||||
rv.mwan3config = { }
|
mArray.mwanconfig = { mwanConfig }
|
||||||
mwan3cfg = {}
|
|
||||||
mwan3cfg[mwcg] = #rv.mwan3config + 1
|
|
||||||
rv.mwan3config[mwan3cfg[mwcg]] = { mwn3cfg = mwcg }
|
|
||||||
|
|
||||||
-- network config
|
-- network config
|
||||||
local netcg = ut.trim(sys.exec("cat /etc/config/network | sed -e 's/.*username.*/ USERNAME HIDDEN/' -e 's/.*password.*/ PASSWORD HIDDEN/'"))
|
local networkConfig = ut.trim(sys.exec("cat /etc/config/network | sed -e 's/.*username.*/ USERNAME HIDDEN/' -e 's/.*password.*/ PASSWORD HIDDEN/'"))
|
||||||
if netcg == "" then
|
if networkConfig == "" then
|
||||||
netcg = "No data found"
|
networkConfig = "No data found"
|
||||||
end
|
end
|
||||||
rv.netconfig = { }
|
mArray.netconfig = { networkConfig }
|
||||||
ncfg = {}
|
|
||||||
ncfg[netcg] = #rv.netconfig + 1
|
|
||||||
rv.netconfig[ncfg[netcg]] = { netcfg = netcg }
|
|
||||||
|
|
||||||
-- ifconfig
|
-- ifconfig
|
||||||
local ifcg = ut.trim(sys.exec("ifconfig"))
|
local ifconfig = ut.trim(sys.exec("ifconfig"))
|
||||||
if ifcg == "" then
|
if ifconfig == "" then
|
||||||
ifcg = "No data found"
|
ifconfig = "No data found"
|
||||||
end
|
end
|
||||||
rv.ifconfig = { }
|
mArray.ifconfig = { ifconfig }
|
||||||
icfg = {}
|
|
||||||
icfg[ifcg] = #rv.ifconfig + 1
|
|
||||||
rv.ifconfig[icfg[ifcg]] = { ifcfg = ifcg }
|
|
||||||
|
|
||||||
-- route -n
|
-- route -n
|
||||||
local routeshow = ut.trim(sys.exec("route -n"))
|
local routeShow = ut.trim(sys.exec("route -n"))
|
||||||
if routeshow == "" then
|
if routeShow == "" then
|
||||||
routeshow = "No data found"
|
routeShow = "No data found"
|
||||||
end
|
end
|
||||||
rv.rtshow = { }
|
mArray.routeshow = { routeShow }
|
||||||
rshw = {}
|
|
||||||
rshw[routeshow] = #rv.rtshow + 1
|
|
||||||
rv.rtshow[rshw[routeshow]] = { iprtshow = routeshow }
|
|
||||||
|
|
||||||
-- ip rule show
|
-- ip rule show
|
||||||
local ipr = ut.trim(sys.exec("ip rule show"))
|
local ipRuleShow = ut.trim(sys.exec("ip rule show"))
|
||||||
if ipr == "" then
|
if ipRuleShow == "" then
|
||||||
ipr = "No data found"
|
ipRuleShow = "No data found"
|
||||||
end
|
end
|
||||||
rv.iprule = { }
|
mArray.iprule = { ipRuleShow }
|
||||||
ipruleid = {}
|
|
||||||
ipruleid[ipr] = #rv.iprule + 1
|
|
||||||
rv.iprule[ipruleid[ipr]] = { rule = ipr }
|
|
||||||
|
|
||||||
-- ip route list table 1-250
|
-- ip route list table 1-250
|
||||||
local routelisting, rlstr = ut.trim(sys.exec("ip rule | sed 's/://g' | awk '$1>=2001 && $1<=2250' | awk '{ print $NF }'")), ""
|
local routeList, routeString = ut.trim(sys.exec("ip rule | sed 's/://g' | awk '$1>=2001 && $1<=2250' | awk '{print $NF}'")), ""
|
||||||
if routelisting ~= "" then
|
if routeList ~= "" then
|
||||||
for line in routelisting:gmatch("[^\r\n]+") do
|
for line in routeList:gmatch("[^\r\n]+") do
|
||||||
rlstr = rlstr .. line .. "\n" .. sys.exec("ip route list table " .. line)
|
routeString = routeString .. line .. "\n" .. sys.exec("ip route list table " .. line)
|
||||||
end
|
end
|
||||||
rlstr = ut.trim(rlstr)
|
routeString = ut.trim(routeString)
|
||||||
else
|
else
|
||||||
rlstr = "No data found"
|
routeString = "No data found"
|
||||||
end
|
end
|
||||||
rv.routelist = { }
|
mArray.routelist = { routeString }
|
||||||
rtlist = {}
|
|
||||||
rtlist[rlstr] = #rv.routelist + 1
|
|
||||||
rv.routelist[rtlist[rlstr]] = { iprtlist = rlstr }
|
|
||||||
|
|
||||||
-- default firewall output policy
|
-- default firewall output policy
|
||||||
local defout = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output"))
|
local firewallOut = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output"))
|
||||||
if defout == "" then
|
if firewallOut == "" then
|
||||||
defout = "No data found"
|
firewallOut = "No data found"
|
||||||
end
|
end
|
||||||
rv.fidef = { }
|
mArray.firewallout = { firewallOut }
|
||||||
fwdf = {}
|
|
||||||
fwdf[defout] = #rv.fidef + 1
|
|
||||||
rv.fidef[fwdf[defout]] = { firedef = defout }
|
|
||||||
|
|
||||||
-- iptables
|
-- iptables
|
||||||
local iptbl = ut.trim(sys.exec("iptables -L -t mangle -v -n"))
|
local iptables = ut.trim(sys.exec("iptables -L -t mangle -v -n"))
|
||||||
if iptbl == "" then
|
if iptables == "" then
|
||||||
iptbl = "No data found"
|
iptables = "No data found"
|
||||||
end
|
end
|
||||||
rv.iptables = { }
|
mArray.iptables = { iptables }
|
||||||
tables = {}
|
|
||||||
tables[iptbl] = #rv.iptables + 1
|
|
||||||
rv.iptables[tables[iptbl]] = { iptbls = iptbl }
|
|
||||||
|
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(rv)
|
luci.http.write_json(mArray)
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,21 +4,21 @@ fs = require "nixio.fs"
|
||||||
sys = require "luci.sys"
|
sys = require "luci.sys"
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
|
|
||||||
script = "/etc/hotplug.d/iface/16-mwan3custom"
|
script = "/etc/hotplug.d/iface/16-mwancustom"
|
||||||
scriptbak = "/etc/hotplug.d/iface/16-mwan3custombak"
|
scriptBackup = "/etc/hotplug.d/iface/16-mwancustombak"
|
||||||
|
|
||||||
if luci.http.formvalue("cbid.luci.1._restorebak") then -- restore button has been clicked
|
if luci.http.formvalue("cbid.luci.1._restorebak") then -- restore button has been clicked
|
||||||
luci.http.redirect(luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug") .. "?restore=yes")
|
luci.http.redirect(luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript") .. "?restore=yes")
|
||||||
elseif luci.http.formvalue("restore") == "yes" then -- restore script from backup
|
elseif luci.http.formvalue("restore") == "yes" then -- restore script from backup
|
||||||
os.execute("cp -f " .. scriptbak .. " " .. script)
|
os.execute("cp -f " .. scriptBackup .. " " .. script)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
m5 = SimpleForm("luci", nil)
|
m5 = SimpleForm("luci", nil)
|
||||||
m5:append(Template("mwan3/mwan3_adv_hotplug")) -- highlight current tab
|
m5:append(Template("mwan/advanced_hotplugscript")) -- highlight current tab
|
||||||
|
|
||||||
f = m5:section(SimpleSection, nil,
|
f = m5:section(SimpleSection, nil,
|
||||||
translate("This section allows you to modify the contents of /etc/hotplug.d/iface/16-mwan3custom<br />" ..
|
translate("This section allows you to modify the contents of /etc/hotplug.d/iface/16-mwancustom<br />" ..
|
||||||
"This is useful for running system commands and/or scripts based on interface ifup or ifdown hotplug events<br /><br />" ..
|
"This is useful for running system commands and/or scripts based on interface ifup or ifdown hotplug events<br /><br />" ..
|
||||||
"Notes:<br />" ..
|
"Notes:<br />" ..
|
||||||
"The first line of the script must be "#!/bin/sh" without quotes<br />" ..
|
"The first line of the script must be "#!/bin/sh" without quotes<br />" ..
|
||||||
|
@ -40,7 +40,7 @@ t = f:option(TextValue, "lines")
|
||||||
function t.cfgvalue()
|
function t.cfgvalue()
|
||||||
local hps = fs.readfile(script)
|
local hps = fs.readfile(script)
|
||||||
if not hps or hps == "" then -- if script does not exist or is blank restore from backup
|
if not hps or hps == "" then -- if script does not exist or is blank restore from backup
|
||||||
sys.call("cp -f " .. scriptbak .. " " .. script)
|
sys.call("cp -f " .. scriptBackup .. " " .. script)
|
||||||
return fs.readfile(script)
|
return fs.readfile(script)
|
||||||
else
|
else
|
||||||
return hps
|
return hps
|
|
@ -1,12 +1,12 @@
|
||||||
-- ------ mwan3 configuration ------ --
|
-- ------ mwan configuration ------ --
|
||||||
|
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
|
|
||||||
mwan3file = "/etc/config/mwan3"
|
mwanConfig = "/etc/config/mwan3"
|
||||||
|
|
||||||
|
|
||||||
m5 = SimpleForm("luci", nil)
|
m5 = SimpleForm("luci", nil)
|
||||||
m5:append(Template("mwan3/mwan3_adv_mwan3")) -- highlight current tab
|
m5:append(Template("mwan/advanced_mwanconfig")) -- highlight current tab
|
||||||
|
|
||||||
|
|
||||||
f = m5:section(SimpleSection, nil,
|
f = m5:section(SimpleSection, nil,
|
||||||
|
@ -17,11 +17,11 @@ t = f:option(TextValue, "lines")
|
||||||
t.rows = 20
|
t.rows = 20
|
||||||
|
|
||||||
function t.cfgvalue()
|
function t.cfgvalue()
|
||||||
return nixio.fs.readfile(mwan3file) or ""
|
return nixio.fs.readfile(mwanConfig) or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
function t.write(self, section, data) -- format and write new data to script
|
function t.write(self, section, data) -- format and write new data to script
|
||||||
return nixio.fs.writefile(mwan3file, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
|
return nixio.fs.writefile(mwanConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function f.handle(self, state, data)
|
function f.handle(self, state, data)
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
|
|
||||||
netfile = "/etc/config/network"
|
networkConfig = "/etc/config/network"
|
||||||
|
|
||||||
|
|
||||||
m5 = SimpleForm("networkconf", nil)
|
m5 = SimpleForm("networkconf", nil)
|
||||||
m5:append(Template("mwan3/mwan3_adv_network")) -- highlight current tab
|
m5:append(Template("mwan/advanced_networkconfig")) -- highlight current tab
|
||||||
|
|
||||||
|
|
||||||
f = m5:section(SimpleSection, nil,
|
f = m5:section(SimpleSection, nil,
|
||||||
|
@ -17,11 +17,11 @@ t = f:option(TextValue, "lines")
|
||||||
t.rows = 20
|
t.rows = 20
|
||||||
|
|
||||||
function t.cfgvalue()
|
function t.cfgvalue()
|
||||||
return nixio.fs.readfile(netfile) or ""
|
return nixio.fs.readfile(networkConfig) or ""
|
||||||
end
|
end
|
||||||
|
|
||||||
function t.write(self, section, data) -- format and write new data to script
|
function t.write(self, section, data) -- format and write new data to script
|
||||||
return nixio.fs.writefile(netfile, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
|
return nixio.fs.writefile(networkConfig, "\n" .. ut.trim(data:gsub("\r\n", "\n")) .. "\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
function f.handle(self, state, data)
|
function f.handle(self, state, data)
|
|
@ -0,0 +1,266 @@
|
||||||
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
|
function interfaceCheck() -- find issues with too many interfaces, reliability and metric
|
||||||
|
uci.cursor():foreach("mwan3", "interface",
|
||||||
|
function (section)
|
||||||
|
local interfaceName = section[".name"]
|
||||||
|
interfaceNumber = interfaceNumber+1 -- count number of mwan interfaces configured
|
||||||
|
-- create list of metrics for none and duplicate checking
|
||||||
|
local metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName .. ".metric"))
|
||||||
|
if metricValue == "" then
|
||||||
|
errorFound = 1
|
||||||
|
errorNoMetricList = errorNoMetricList .. interfaceName .. " "
|
||||||
|
else
|
||||||
|
metricList = metricList .. interfaceName .. " " .. metricValue .. "\n"
|
||||||
|
end
|
||||||
|
-- check if any interfaces have a higher reliability requirement than tracking IPs configured
|
||||||
|
local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. interfaceName .. ".track_ip) | wc -w")))
|
||||||
|
if trackingNumber > 0 then
|
||||||
|
local reliabilityNumber = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".reliability")))
|
||||||
|
if reliabilityNumber and reliabilityNumber > trackingNumber then
|
||||||
|
errorFound = 1
|
||||||
|
errorReliabilityList = errorReliabilityList .. interfaceName .. " "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
|
||||||
|
if ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName)) == "interface" then
|
||||||
|
local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interfaceName .. ".ifname"))
|
||||||
|
if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then
|
||||||
|
errorFound = 1
|
||||||
|
errorNetConfigList = errorNetConfigList .. interfaceName .. " "
|
||||||
|
errorRouteList = errorRouteList .. interfaceName .. " "
|
||||||
|
else
|
||||||
|
local routeCheck = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1}'"))
|
||||||
|
if routeCheck == "" then
|
||||||
|
errorFound = 1
|
||||||
|
errorRouteList = errorRouteList .. interfaceName .. " "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
errorFound = 1
|
||||||
|
errorNetConfigList = errorNetConfigList .. interfaceName .. " "
|
||||||
|
errorRouteList = errorRouteList .. interfaceName .. " "
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
-- check if any interfaces have duplicate metrics
|
||||||
|
local metricDuplicateNumbers = sys.exec("echo '" .. metricList .. "' | awk '{print $2}' | uniq -d")
|
||||||
|
if metricDuplicateNumbers ~= "" then
|
||||||
|
errorFound = 1
|
||||||
|
local metricDuplicates = ""
|
||||||
|
for line in metricDuplicateNumbers:gmatch("[^\r\n]+") do
|
||||||
|
metricDuplicates = sys.exec("echo '" .. metricList .. "' | grep '" .. line .. "' | awk '{print $1}'")
|
||||||
|
errorDuplicateMetricList = errorDuplicateMetricList .. metricDuplicates
|
||||||
|
end
|
||||||
|
errorDuplicateMetricList = sys.exec("echo '" .. errorDuplicateMetricList .. "' | tr '\n' ' '")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function interfaceWarnings() -- display status and warning messages at the top of the page
|
||||||
|
local warnings = ""
|
||||||
|
if interfaceNumber <= 250 then
|
||||||
|
warnings = "<strong>There are currently " .. interfaceNumber .. " of 250 supported interfaces configured</strong>"
|
||||||
|
else
|
||||||
|
warnings = "<font color=\"ff0000\"><strong>WARNING: " .. interfaceNumber .. " interfaces are configured exceeding the maximum of 250!</strong></font>"
|
||||||
|
end
|
||||||
|
if errorReliabilityList ~= " " then
|
||||||
|
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!</strong></font>"
|
||||||
|
end
|
||||||
|
if errorRouteList ~= " " then
|
||||||
|
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no default route in the main routing table!</strong></font>"
|
||||||
|
end
|
||||||
|
if errorNetConfigList ~= " " then
|
||||||
|
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!</strong></font>"
|
||||||
|
end
|
||||||
|
if errorNoMetricList ~= " " then
|
||||||
|
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no metric configured in /etc/config/network!</strong></font>"
|
||||||
|
end
|
||||||
|
if errorDuplicateMetricList ~= " " then
|
||||||
|
warnings = warnings .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have duplicate metrics configured in /etc/config/network!</strong></font>"
|
||||||
|
end
|
||||||
|
return warnings
|
||||||
|
end
|
||||||
|
|
||||||
|
-- ------ interface configuration ------ --
|
||||||
|
|
||||||
|
dsp = require "luci.dispatcher"
|
||||||
|
sys = require "luci.sys"
|
||||||
|
ut = require "luci.util"
|
||||||
|
|
||||||
|
interfaceNumber = 0
|
||||||
|
metricList = ""
|
||||||
|
errorFound = 0
|
||||||
|
errorDuplicateMetricList = " "
|
||||||
|
errorNetConfigList = " "
|
||||||
|
errorNoMetricList = " "
|
||||||
|
errorReliabilityList = " "
|
||||||
|
errorRouteList = " "
|
||||||
|
interfaceCheck()
|
||||||
|
|
||||||
|
|
||||||
|
m5 = Map("mwan3", translate("MWAN Interface Configuration"),
|
||||||
|
translate(interfaceWarnings()))
|
||||||
|
m5:append(Template("mwan/config_css"))
|
||||||
|
|
||||||
|
|
||||||
|
mwan_interface = m5:section(TypedSection, "interface", translate("Interfaces"),
|
||||||
|
translate("MWAN supports up to 250 physical and/or logical interfaces<br />" ..
|
||||||
|
"MWAN requires that all interfaces have a unique metric configured in /etc/config/network<br />" ..
|
||||||
|
"Names must match the interface name found in /etc/config/network (see advanced tab)<br />" ..
|
||||||
|
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
||||||
|
"Interfaces may not share the same name as configured members, policies or rules"))
|
||||||
|
mwan_interface.addremove = true
|
||||||
|
mwan_interface.dynamic = false
|
||||||
|
mwan_interface.sectionhead = "Interface"
|
||||||
|
mwan_interface.sortable = true
|
||||||
|
mwan_interface.template = "cbi/tblsection"
|
||||||
|
mwan_interface.extedit = dsp.build_url("admin", "network", "mwan", "configuration", "interface", "%s")
|
||||||
|
function mwan_interface.create(self, section)
|
||||||
|
TypedSection.create(self, section)
|
||||||
|
m5.uci:save("mwan3")
|
||||||
|
luci.http.redirect(dsp.build_url("admin", "network", "mwan", "configuration", "interface", section))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
enabled = mwan_interface:option(DummyValue, "enabled", translate("Enabled"))
|
||||||
|
enabled.rawhtml = true
|
||||||
|
function enabled.cfgvalue(self, s)
|
||||||
|
if self.map:get(s, "enabled") == "1" then
|
||||||
|
return "Yes"
|
||||||
|
else
|
||||||
|
return "No"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
track_ip = mwan_interface:option(DummyValue, "track_ip", translate("Tracking IP"))
|
||||||
|
track_ip.rawhtml = true
|
||||||
|
function track_ip.cfgvalue(self, s)
|
||||||
|
tracked = self.map:get(s, "track_ip")
|
||||||
|
if tracked then
|
||||||
|
local ipList = ""
|
||||||
|
for k,v in pairs(tracked) do
|
||||||
|
ipList = ipList .. v .. "<br />"
|
||||||
|
end
|
||||||
|
return ipList
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracking reliability"))
|
||||||
|
reliability.rawhtml = true
|
||||||
|
function reliability.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
return self.map:get(s, "reliability") or "—"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
count = mwan_interface:option(DummyValue, "count", translate("Ping count"))
|
||||||
|
count.rawhtml = true
|
||||||
|
function count.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
return self.map:get(s, "count") or "—"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
timeout = mwan_interface:option(DummyValue, "timeout", translate("Ping timeout"))
|
||||||
|
timeout.rawhtml = true
|
||||||
|
function timeout.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
local timeoutValue = self.map:get(s, "timeout")
|
||||||
|
if timeoutValue then
|
||||||
|
return timeoutValue .. "s"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
interval = mwan_interface:option(DummyValue, "interval", translate("Ping interval"))
|
||||||
|
interval.rawhtml = true
|
||||||
|
function interval.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
local intervalValue = self.map:get(s, "interval")
|
||||||
|
if intervalValue then
|
||||||
|
return intervalValue .. "s"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
down = mwan_interface:option(DummyValue, "down", translate("Interface down"))
|
||||||
|
down.rawhtml = true
|
||||||
|
function down.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
return self.map:get(s, "down") or "—"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
up = mwan_interface:option(DummyValue, "up", translate("Interface up"))
|
||||||
|
up.rawhtml = true
|
||||||
|
function up.cfgvalue(self, s)
|
||||||
|
if tracked then
|
||||||
|
return self.map:get(s, "up") or "—"
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
metric = mwan_interface:option(DummyValue, "metric", translate("Metric"))
|
||||||
|
metric.rawhtml = true
|
||||||
|
function metric.cfgvalue(self, s)
|
||||||
|
local metricValue = sys.exec("uci get -p /var/state network." .. s .. ".metric")
|
||||||
|
if metricValue ~= "" then
|
||||||
|
return metricValue
|
||||||
|
else
|
||||||
|
return "—"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
errors = mwan_interface:option(DummyValue, "errors", translate("Errors"))
|
||||||
|
errors.rawhtml = true
|
||||||
|
function errors.cfgvalue(self, s)
|
||||||
|
if errorFound == 1 then
|
||||||
|
local mouseOver, lineBreak = "", ""
|
||||||
|
if string.find(errorReliabilityList, " " .. s .. " ") then
|
||||||
|
mouseOver = "Higher reliability requirement than there are tracking IP addresses"
|
||||||
|
lineBreak = " "
|
||||||
|
end
|
||||||
|
if string.find(errorRouteList, " " .. s .. " ") then
|
||||||
|
mouseOver = mouseOver .. lineBreak .. "No default route in the main routing table"
|
||||||
|
lineBreak = " "
|
||||||
|
end
|
||||||
|
if string.find(errorNetConfigList, " " .. s .. " ") then
|
||||||
|
mouseOver = mouseOver .. lineBreak .. "Configured incorrectly or not at all in /etc/config/network"
|
||||||
|
lineBreak = " "
|
||||||
|
end
|
||||||
|
if string.find(errorNoMetricList, " " .. s .. " ") then
|
||||||
|
mouseOver = mouseOver .. lineBreak .. "No metric configured in /etc/config/network"
|
||||||
|
lineBreak = " "
|
||||||
|
end
|
||||||
|
if string.find(errorDuplicateMetricList, " " .. s .. " ") then
|
||||||
|
mouseOver = mouseOver .. lineBreak .. "Duplicate metric configured in /etc/config/network"
|
||||||
|
end
|
||||||
|
if mouseOver == "" then
|
||||||
|
return ""
|
||||||
|
else
|
||||||
|
return "<span title=\"" .. mouseOver .. "\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return m5
|
|
@ -1,70 +1,70 @@
|
||||||
-- ------ extra functions ------ --
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
function iface_check()
|
function interfaceCheck()
|
||||||
metcheck = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".metric"))
|
metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".metric"))
|
||||||
if metcheck == "" then -- no metric
|
if metricValue == "" then -- no metric
|
||||||
err_nomet = 1
|
errorNoMetric = 1
|
||||||
else -- if metric exists create list of interface metrics to compare against for duplicates
|
else -- if metric exists create list of interface metrics to compare against for duplicates
|
||||||
uci.cursor():foreach("mwan3", "interface",
|
uci.cursor():foreach("mwan3", "interface",
|
||||||
function (section)
|
function (section)
|
||||||
local metlkp = ut.trim(sys.exec("uci get -p /var/state network." .. section[".name"] .. ".metric"))
|
local metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. section[".name"] .. ".metric"))
|
||||||
metric_list = metric_list .. section[".name"] .. " " .. metlkp .. "\n"
|
metricList = metricList .. section[".name"] .. " " .. metricValue .. "\n"
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
-- compare metric against list
|
-- compare metric against list
|
||||||
local metric_dupnums, metric_dupes = sys.exec("echo '" .. metric_list .. "' | awk '{ print $2 }' | uniq -d"), ""
|
local metricDuplicateNumbers, metricDuplicates = sys.exec("echo '" .. metricList .. "' | awk '{print $2}' | uniq -d"), ""
|
||||||
for line in metric_dupnums:gmatch("[^\r\n]+") do
|
for line in metricDuplicateNumbers:gmatch("[^\r\n]+") do
|
||||||
metric_dupes = sys.exec("echo '" .. metric_list .. "' | grep '" .. line .. "' | awk '{ print $1 }'")
|
metricDuplicates = sys.exec("echo '" .. metricList .. "' | grep '" .. line .. "' | awk '{print $1}'")
|
||||||
err_dupmet_list = err_dupmet_list .. metric_dupes
|
errorDuplicateMetricList = errorDuplicateMetricList .. metricDuplicates
|
||||||
end
|
end
|
||||||
if sys.exec("echo '" .. err_dupmet_list .. "' | grep -w " .. arg[1]) ~= "" then
|
if sys.exec("echo '" .. errorDuplicateMetricList .. "' | grep -w " .. arg[1]) ~= "" then
|
||||||
err_dupmet = 1
|
errorDuplicateMetric = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- check if this interface has a higher reliability requirement than track IPs configured
|
-- check if this interface has a higher reliability requirement than track IPs configured
|
||||||
local tipnum = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. arg[1] .. ".track_ip) | wc -w")))
|
local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. arg[1] .. ".track_ip) | wc -w")))
|
||||||
if tipnum > 0 then
|
if trackingNumber > 0 then
|
||||||
local relnum = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".reliability")))
|
local reliabilityNumber = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".reliability")))
|
||||||
if relnum and relnum > tipnum then
|
if reliabilityNumber and reliabilityNumber > trackingNumber then
|
||||||
err_reliability = 1
|
errorReliability = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
|
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
|
||||||
if ut.trim(sys.exec("uci get -p /var/state network." .. arg[1])) == "interface" then
|
if ut.trim(sys.exec("uci get -p /var/state network." .. arg[1])) == "interface" then
|
||||||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".ifname"))
|
local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".ifname"))
|
||||||
if ifdev == "uci: Entry not found" or ifdev == "" then
|
if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then
|
||||||
err_netcfg = 1
|
errorNetConfig = 1
|
||||||
err_route = 1
|
errorRoute = 1
|
||||||
else
|
else
|
||||||
local rtcheck = ut.trim(sys.exec("route -n | awk '{ if ($8 == \"" .. ifdev .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1 }'"))
|
local routeCheck = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1}'"))
|
||||||
if rtcheck == "" then
|
if routeCheck == "" then
|
||||||
err_route = 1
|
errorRoute = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
err_netcfg = 1
|
errorNetConfig = 1
|
||||||
err_route = 1
|
errorRoute = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function iface_warn() -- display warning messages at the top of the page
|
function interfaceWarnings() -- display warning messages at the top of the page
|
||||||
local warns, linebrk = "", ""
|
local warns, lineBreak = "", ""
|
||||||
if err_reliability == 1 then
|
if errorReliability == 1 then
|
||||||
warns = "<font color=\"ff0000\"><strong>WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!</strong></font>"
|
warns = "<font color=\"ff0000\"><strong>WARNING: this interface has a higher reliability requirement than there are tracking IP addresses!</strong></font>"
|
||||||
linebrk = "<br /><br />"
|
lineBreak = "<br /><br />"
|
||||||
end
|
end
|
||||||
if err_route == 1 then
|
if errorRoute == 1 then
|
||||||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface has no default route in the main routing table!</strong></font>"
|
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface has no default route in the main routing table!</strong></font>"
|
||||||
linebrk = "<br /><br />"
|
lineBreak = "<br /><br />"
|
||||||
end
|
end
|
||||||
if err_netcfg == 1 then
|
if errorNetConfig == 1 then
|
||||||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface is configured incorrectly or not at all in /etc/config/network!</strong></font>"
|
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface is configured incorrectly or not at all in /etc/config/network!</strong></font>"
|
||||||
linebrk = "<br /><br />"
|
lineBreak = "<br /><br />"
|
||||||
end
|
end
|
||||||
if err_nomet == 1 then
|
if errorNoMetric == 1 then
|
||||||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this interface has no metric configured in /etc/config/network!</strong></font>"
|
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this interface has no metric configured in /etc/config/network!</strong></font>"
|
||||||
elseif err_dupmet == 1 then
|
elseif errorDuplicateMetric == 1 then
|
||||||
warns = warns .. linebrk .. "<font color=\"ff0000\"><strong>WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!</strong></font>"
|
warns = warns .. lineBreak .. "<font color=\"ff0000\"><strong>WARNING: this and other interfaces have duplicate metrics configured in /etc/config/network!</strong></font>"
|
||||||
end
|
end
|
||||||
return warns
|
return warns
|
||||||
end
|
end
|
||||||
|
@ -76,21 +76,20 @@ sys = require "luci.sys"
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
arg[1] = arg[1] or ""
|
arg[1] = arg[1] or ""
|
||||||
|
|
||||||
metcheck = ""
|
metricValue = ""
|
||||||
metric_list = ""
|
metricList = ""
|
||||||
err_dupmet_list = ""
|
errorDuplicateMetricList = ""
|
||||||
err_rel_list = ""
|
errorNoMetric = 0
|
||||||
err_nomet = 0
|
errorDuplicateMetric = 0
|
||||||
err_dupmet = 0
|
errorRoute = 0
|
||||||
err_route = 0
|
errorNetConfig = 0
|
||||||
err_netcfg = 0
|
errorReliability = 0
|
||||||
err_reliability = 0
|
interfaceCheck()
|
||||||
iface_check()
|
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Interface Configuration - " .. arg[1]),
|
m5 = Map("mwan3", translate("MWAN Interface Configuration - " .. arg[1]),
|
||||||
translate(iface_warn()))
|
translate(interfaceWarnings()))
|
||||||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "interface")
|
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "interface")
|
||||||
|
|
||||||
|
|
||||||
mwan_interface = m5:section(NamedSection, arg[1], "interface", "")
|
mwan_interface = m5:section(NamedSection, arg[1], "interface", "")
|
||||||
|
@ -180,8 +179,8 @@ metric = mwan_interface:option(DummyValue, "metric", translate("Metric"),
|
||||||
translate("This displays the metric assigned to this interface in /etc/config/network"))
|
translate("This displays the metric assigned to this interface in /etc/config/network"))
|
||||||
metric.rawhtml = true
|
metric.rawhtml = true
|
||||||
function metric.cfgvalue(self, s)
|
function metric.cfgvalue(self, s)
|
||||||
if err_nomet == 0 then
|
if errorNoMetric == 0 then
|
||||||
return metcheck
|
return metricValue
|
||||||
else
|
else
|
||||||
return "—"
|
return "—"
|
||||||
end
|
end
|
|
@ -3,12 +3,12 @@
|
||||||
ds = require "luci.dispatcher"
|
ds = require "luci.dispatcher"
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Member Configuration"))
|
m5 = Map("mwan3", translate("MWAN Member Configuration"))
|
||||||
m5:append(Template("mwan3/mwan3_config_css"))
|
m5:append(Template("mwan/config_css"))
|
||||||
|
|
||||||
|
|
||||||
mwan_member = m5:section(TypedSection, "member", translate("Members"),
|
mwan_member = m5:section(TypedSection, "member", translate("Members"),
|
||||||
translate("Members are profiles attaching a metric and weight to an MWAN3 interface<br />" ..
|
translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" ..
|
||||||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
||||||
"Members may not share the same name as configured interfaces, policies or rules"))
|
"Members may not share the same name as configured interfaces, policies or rules"))
|
||||||
mwan_member.addremove = true
|
mwan_member.addremove = true
|
||||||
|
@ -16,11 +16,11 @@ mwan_member = m5:section(TypedSection, "member", translate("Members"),
|
||||||
mwan_member.sectionhead = "Member"
|
mwan_member.sectionhead = "Member"
|
||||||
mwan_member.sortable = true
|
mwan_member.sortable = true
|
||||||
mwan_member.template = "cbi/tblsection"
|
mwan_member.template = "cbi/tblsection"
|
||||||
mwan_member.extedit = ds.build_url("admin", "network", "mwan3", "configuration", "member", "%s")
|
mwan_member.extedit = ds.build_url("admin", "network", "mwan", "configuration", "member", "%s")
|
||||||
function mwan_member.create(self, section)
|
function mwan_member.create(self, section)
|
||||||
TypedSection.create(self, section)
|
TypedSection.create(self, section)
|
||||||
m5.uci:save("mwan3")
|
m5.uci:save("mwan3")
|
||||||
luci.http.redirect(ds.build_url("admin", "network", "mwan3", "configuration", "member", section))
|
luci.http.redirect(ds.build_url("admin", "network", "mwan", "configuration", "member", section))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ dsp = require "luci.dispatcher"
|
||||||
arg[1] = arg[1] or ""
|
arg[1] = arg[1] or ""
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Member Configuration - ") .. arg[1])
|
m5 = Map("mwan3", translate("MWAN Member Configuration - ") .. arg[1])
|
||||||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "member")
|
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "member")
|
||||||
|
|
||||||
|
|
||||||
mwan_member = m5:section(NamedSection, arg[1], "member", "")
|
mwan_member = m5:section(NamedSection, arg[1], "member", "")
|
|
@ -1,18 +1,18 @@
|
||||||
-- ------ extra functions ------ --
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
function policy_check() -- check to see if any policy names exceed the maximum of 15 characters
|
function policyCheck() -- check to see if any policy names exceed the maximum of 15 characters
|
||||||
uci.cursor():foreach("mwan3", "policy",
|
uci.cursor():foreach("mwan3", "policy",
|
||||||
function (section)
|
function (section)
|
||||||
if string.len(section[".name"]) > 15 then
|
if string.len(section[".name"]) > 15 then
|
||||||
toolong = 1
|
nameTooLong = 1
|
||||||
err_name_list = err_name_list .. section[".name"] .. " "
|
err_name_list = err_name_list .. section[".name"] .. " "
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function policy_warn() -- display status and warning messages at the top of the page
|
function policyWarn() -- display status and warning messages at the top of the page
|
||||||
if toolong == 1 then
|
if nameTooLong == 1 then
|
||||||
return "<font color=\"ff0000\"><strong>WARNING: Some policies have names exceeding the maximum of 15 characters!</strong></font>"
|
return "<font color=\"ff0000\"><strong>WARNING: Some policies have names exceeding the maximum of 15 characters!</strong></font>"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
|
@ -24,18 +24,18 @@ end
|
||||||
ds = require "luci.dispatcher"
|
ds = require "luci.dispatcher"
|
||||||
sys = require "luci.sys"
|
sys = require "luci.sys"
|
||||||
|
|
||||||
toolong = 0
|
nameTooLong = 0
|
||||||
err_name_list = " "
|
err_name_list = " "
|
||||||
policy_check()
|
policyCheck()
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Policy Configuration"),
|
m5 = Map("mwan3", translate("MWAN Policy Configuration"),
|
||||||
translate(policy_warn()))
|
translate(policyWarn()))
|
||||||
m5:append(Template("mwan3/mwan3_config_css"))
|
m5:append(Template("mwan/config_css"))
|
||||||
|
|
||||||
|
|
||||||
mwan_policy = m5:section(TypedSection, "policy", translate("Policies"),
|
mwan_policy = m5:section(TypedSection, "policy", translate("Policies"),
|
||||||
translate("Policies are profiles grouping one or more members controlling how MWAN3 distributes traffic<br />" ..
|
translate("Policies are profiles grouping one or more members controlling how MWAN distributes traffic<br />" ..
|
||||||
"Member interfaces with lower metrics are used first. Interfaces with the same metric load-balance<br />" ..
|
"Member interfaces with lower metrics are used first. Interfaces with the same metric load-balance<br />" ..
|
||||||
"Load-balanced member interfaces distribute more traffic out those with higher weights<br />" ..
|
"Load-balanced member interfaces distribute more traffic out those with higher weights<br />" ..
|
||||||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces. Names must be 15 characters or less<br />" ..
|
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces. Names must be 15 characters or less<br />" ..
|
||||||
|
@ -45,23 +45,23 @@ mwan_policy = m5:section(TypedSection, "policy", translate("Policies"),
|
||||||
mwan_policy.sectionhead = "Policy"
|
mwan_policy.sectionhead = "Policy"
|
||||||
mwan_policy.sortable = true
|
mwan_policy.sortable = true
|
||||||
mwan_policy.template = "cbi/tblsection"
|
mwan_policy.template = "cbi/tblsection"
|
||||||
mwan_policy.extedit = ds.build_url("admin", "network", "mwan3", "configuration", "policy", "%s")
|
mwan_policy.extedit = ds.build_url("admin", "network", "mwan", "configuration", "policy", "%s")
|
||||||
function mwan_policy.create(self, section)
|
function mwan_policy.create(self, section)
|
||||||
TypedSection.create(self, section)
|
TypedSection.create(self, section)
|
||||||
m5.uci:save("mwan3")
|
m5.uci:save("mwan3")
|
||||||
luci.http.redirect(ds.build_url("admin", "network", "mwan3", "configuration", "policy", section))
|
luci.http.redirect(ds.build_url("admin", "network", "mwan", "configuration", "policy", section))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
use_member = mwan_policy:option(DummyValue, "use_member", translate("Members assigned"))
|
use_member = mwan_policy:option(DummyValue, "use_member", translate("Members assigned"))
|
||||||
use_member.rawhtml = true
|
use_member.rawhtml = true
|
||||||
function use_member.cfgvalue(self, s)
|
function use_member.cfgvalue(self, s)
|
||||||
local tab, str = self.map:get(s, "use_member"), ""
|
local memberConfig, memberList = self.map:get(s, "use_member"), ""
|
||||||
if tab then
|
if memberConfig then
|
||||||
for k,v in pairs(tab) do
|
for k,v in pairs(memberConfig) do
|
||||||
str = str .. v .. "<br />"
|
memberList = memberList .. v .. "<br />"
|
||||||
end
|
end
|
||||||
return str
|
return memberList
|
||||||
else
|
else
|
||||||
return "—"
|
return "—"
|
||||||
end
|
end
|
||||||
|
@ -71,10 +71,10 @@ use_member = mwan_policy:option(DummyValue, "use_member", translate("Members ass
|
||||||
last_resort = mwan_policy:option(DummyValue, "last_resort", translate("Last resort"))
|
last_resort = mwan_policy:option(DummyValue, "last_resort", translate("Last resort"))
|
||||||
last_resort.rawhtml = true
|
last_resort.rawhtml = true
|
||||||
function last_resort.cfgvalue(self, s)
|
function last_resort.cfgvalue(self, s)
|
||||||
local str = self.map:get(s, "last_resort")
|
local action = self.map:get(s, "last_resort")
|
||||||
if str == "blackhole" then
|
if action == "blackhole" then
|
||||||
return "blackhole (drop)"
|
return "blackhole (drop)"
|
||||||
elseif str == "default" then
|
elseif action == "default" then
|
||||||
return "default (use main routing table)"
|
return "default (use main routing table)"
|
||||||
else
|
else
|
||||||
return "unreachable (reject)"
|
return "unreachable (reject)"
|
|
@ -1,21 +1,21 @@
|
||||||
-- ------ extra functions ------ --
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
function policy_check() -- check to see if this policy's name exceed the maximum of 15 characters
|
function policyCheck() -- check to see if this policy's name exceed the maximum of 15 characters
|
||||||
polchar = string.len(arg[1])
|
policyNameLength = string.len(arg[1])
|
||||||
if polchar > 15 then
|
if policyNameLength > 15 then
|
||||||
toolong = 1
|
nameTooLong = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function policy_warn() -- display status and warning messages at the top of the page
|
function policyWarn() -- display status and warning messages at the top of the page
|
||||||
if toolong == 1 then
|
if nameTooLong == 1 then
|
||||||
return "<font color=\"ff0000\"><strong>WARNING: this policy's name is " .. polchar .. " characters exceeding the maximum of 15!</strong></font>"
|
return "<font color=\"ff0000\"><strong>WARNING: this policy's name is " .. policyNameLength .. " characters exceeding the maximum of 15!</strong></font>"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cbi_add_member(field)
|
function cbiAddMember(field)
|
||||||
uci.cursor():foreach("mwan3", "member",
|
uci.cursor():foreach("mwan3", "member",
|
||||||
function (section)
|
function (section)
|
||||||
field:value(section[".name"])
|
field:value(section[".name"])
|
||||||
|
@ -28,13 +28,13 @@ end
|
||||||
dsp = require "luci.dispatcher"
|
dsp = require "luci.dispatcher"
|
||||||
arg[1] = arg[1] or ""
|
arg[1] = arg[1] or ""
|
||||||
|
|
||||||
toolong = 0
|
nameTooLong = 0
|
||||||
policy_check()
|
policyCheck()
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Policy Configuration - " .. arg[1]),
|
m5 = Map("mwan3", translate("MWAN Policy Configuration - " .. arg[1]),
|
||||||
translate(policy_warn()))
|
translate(policyWarn()))
|
||||||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "policy")
|
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "policy")
|
||||||
|
|
||||||
|
|
||||||
mwan_policy = m5:section(NamedSection, arg[1], "policy", "")
|
mwan_policy = m5:section(NamedSection, arg[1], "policy", "")
|
||||||
|
@ -43,7 +43,7 @@ mwan_policy = m5:section(NamedSection, arg[1], "policy", "")
|
||||||
|
|
||||||
|
|
||||||
use_member = mwan_policy:option(DynamicList, "use_member", translate("Member used"))
|
use_member = mwan_policy:option(DynamicList, "use_member", translate("Member used"))
|
||||||
cbi_add_member(use_member)
|
cbiAddMember(use_member)
|
||||||
|
|
||||||
last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resort"),
|
last_resort = mwan_policy:option(ListValue, "last_resort", translate("Last resort"),
|
||||||
translate("When all policy members are offline use this behavior for matched traffic"))
|
translate("When all policy members are offline use this behavior for matched traffic"))
|
|
@ -1,22 +1,22 @@
|
||||||
-- ------ extra functions ------ --
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
function rule_check() -- determine if rules needs a proper protocol configured
|
function ruleCheck() -- determine if rules needs a proper protocol configured
|
||||||
uci.cursor():foreach("mwan3", "rule",
|
uci.cursor():foreach("mwan3", "rule",
|
||||||
function (section)
|
function (section)
|
||||||
local sport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".src_port"))
|
local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".src_port"))
|
||||||
local dport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".dest_port"))
|
local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".dest_port"))
|
||||||
if sport ~= "" or dport ~= "" then -- ports configured
|
if sourcePort ~= "" or destPort ~= "" then -- ports configured
|
||||||
local proto = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".proto"))
|
local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".proto"))
|
||||||
if proto == "" or proto == "all" then -- no or improper protocol
|
if protocol == "" or protocol == "all" then -- no or improper protocol
|
||||||
err_proto_list = err_proto_list .. section[".name"] .. " "
|
error_protocol_list = error_protocol_list .. section[".name"] .. " "
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function rule_warn() -- display warning messages at the top of the page
|
function ruleWarn() -- display warning messages at the top of the page
|
||||||
if err_proto_list ~= " " then
|
if error_protocol_list ~= " " then
|
||||||
return "<font color=\"ff0000\"><strong>WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>"
|
return "<font color=\"ff0000\"><strong>WARNING: some rules have a port configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
|
@ -29,18 +29,17 @@ dsp = require "luci.dispatcher"
|
||||||
sys = require "luci.sys"
|
sys = require "luci.sys"
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
|
|
||||||
err_proto = 0
|
error_protocol_list = " "
|
||||||
err_proto_list = " "
|
ruleCheck()
|
||||||
rule_check()
|
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Traffic Rule Configuration"),
|
m5 = Map("mwan3", translate("MWAN Rule Configuration"),
|
||||||
translate(rule_warn()))
|
translate(ruleWarn()))
|
||||||
m5:append(Template("mwan3/mwan3_config_css"))
|
m5:append(Template("mwan/config_css"))
|
||||||
|
|
||||||
|
|
||||||
mwan_rule = m5:section(TypedSection, "rule", translate("Traffic Rules"),
|
mwan_rule = m5:section(TypedSection, "rule", translate("Traffic Rules"),
|
||||||
translate("Rules specify which traffic will use a particular MWAN3 policy based on IP address, port or protocol<br />" ..
|
translate("Rules specify which traffic will use a particular MWAN policy based on IP address, port or protocol<br />" ..
|
||||||
"Rules are matched from top to bottom. Rules below a matching rule are ignored. Traffic not matching any rule is routed using the main routing table<br />" ..
|
"Rules are matched from top to bottom. Rules below a matching rule are ignored. Traffic not matching any rule is routed using the main routing table<br />" ..
|
||||||
"Traffic destined for known (other than default) networks is handled by the main routing table. Traffic matching a rule, but all WAN interfaces for that policy are down will be blackholed<br />" ..
|
"Traffic destined for known (other than default) networks is handled by the main routing table. Traffic matching a rule, but all WAN interfaces for that policy are down will be blackholed<br />" ..
|
||||||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
||||||
|
@ -51,11 +50,11 @@ mwan_rule = m5:section(TypedSection, "rule", translate("Traffic Rules"),
|
||||||
mwan_rule.sectionhead = "Rule"
|
mwan_rule.sectionhead = "Rule"
|
||||||
mwan_rule.sortable = true
|
mwan_rule.sortable = true
|
||||||
mwan_rule.template = "cbi/tblsection"
|
mwan_rule.template = "cbi/tblsection"
|
||||||
mwan_rule.extedit = dsp.build_url("admin", "network", "mwan3", "configuration", "rule", "%s")
|
mwan_rule.extedit = dsp.build_url("admin", "network", "mwan", "configuration", "rule", "%s")
|
||||||
function mwan_rule.create(self, section)
|
function mwan_rule.create(self, section)
|
||||||
TypedSection.create(self, section)
|
TypedSection.create(self, section)
|
||||||
m5.uci:save("mwan3")
|
m5.uci:save("mwan3")
|
||||||
luci.http.redirect(dsp.build_url("admin", "network", "mwan3", "configuration", "rule", section))
|
luci.http.redirect(dsp.build_url("admin", "network", "mwan", "configuration", "rule", section))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +97,7 @@ use_policy = mwan_rule:option(DummyValue, "use_policy", translate("Policy assign
|
||||||
errors = mwan_rule:option(DummyValue, "errors", translate("Errors"))
|
errors = mwan_rule:option(DummyValue, "errors", translate("Errors"))
|
||||||
errors.rawhtml = true
|
errors.rawhtml = true
|
||||||
function errors.cfgvalue(self, s)
|
function errors.cfgvalue(self, s)
|
||||||
if not string.find(err_proto_list, " " .. s .. " ") then
|
if not string.find(error_protocol_list, " " .. s .. " ") then
|
||||||
return ""
|
return ""
|
||||||
else
|
else
|
||||||
return "<span title=\"No protocol specified\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>"
|
return "<span title=\"No protocol specified\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>"
|
|
@ -1,25 +1,25 @@
|
||||||
-- ------ extra functions ------ --
|
-- ------ extra functions ------ --
|
||||||
|
|
||||||
function rule_check() -- determine if rule needs a protocol specified
|
function ruleCheck() -- determine if rule needs a protocol specified
|
||||||
local sport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".src_port"))
|
local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".src_port"))
|
||||||
local dport = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".dest_port"))
|
local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".dest_port"))
|
||||||
if sport ~= "" or dport ~= "" then -- ports configured
|
if sourcePort ~= "" or destPort ~= "" then -- ports configured
|
||||||
local proto = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".proto"))
|
local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".proto"))
|
||||||
if proto == "" or proto == "all" then -- no or improper protocol
|
if protocol == "" or protocol == "all" then -- no or improper protocol
|
||||||
err_proto = 1
|
error_protocol = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function rule_warn() -- display warning message at the top of the page
|
function ruleWarn() -- display warning message at the top of the page
|
||||||
if err_proto == 1 then
|
if error_protocol == 1 then
|
||||||
return "<font color=\"ff0000\"><strong>WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>"
|
return "<font color=\"ff0000\"><strong>WARNING: this rule is incorrectly configured with no or improper protocol specified! Please configure a specific protocol!</strong></font>"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cbi_add_policy(field)
|
function cbiAddPolicy(field)
|
||||||
uci.cursor():foreach("mwan3", "policy",
|
uci.cursor():foreach("mwan3", "policy",
|
||||||
function (section)
|
function (section)
|
||||||
field:value(section[".name"])
|
field:value(section[".name"])
|
||||||
|
@ -27,9 +27,9 @@ function cbi_add_policy(field)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
function cbi_add_protocol(field)
|
function cbiAddProtocol(field)
|
||||||
local protos = ut.trim(sys.exec("cat /etc/protocols | grep ' # ' | awk '{print $1}' | grep -vw -e 'ip' -e 'tcp' -e 'udp' -e 'icmp' -e 'esp' | grep -v 'ipv6' | sort | tr '\n' ' '"))
|
local protocols = ut.trim(sys.exec("cat /etc/protocols | grep ' # ' | awk '{print $1}' | grep -vw -e 'ip' -e 'tcp' -e 'udp' -e 'icmp' -e 'esp' | grep -v 'ipv6' | sort | tr '\n' ' '"))
|
||||||
for p in string.gmatch(protos, "%S+") do
|
for p in string.gmatch(protocols, "%S+") do
|
||||||
field:value(p)
|
field:value(p)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -41,13 +41,13 @@ sys = require "luci.sys"
|
||||||
ut = require "luci.util"
|
ut = require "luci.util"
|
||||||
arg[1] = arg[1] or ""
|
arg[1] = arg[1] or ""
|
||||||
|
|
||||||
err_proto = 0
|
error_protocol = 0
|
||||||
rule_check()
|
ruleCheck()
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Rule Configuration - ") .. arg[1],
|
m5 = Map("mwan3", translate("MWAN Rule Configuration - ") .. arg[1],
|
||||||
translate(rule_warn()))
|
translate(ruleWarn()))
|
||||||
m5.redirect = dsp.build_url("admin", "network", "mwan3", "configuration", "rule")
|
m5.redirect = dsp.build_url("admin", "network", "mwan", "configuration", "rule")
|
||||||
|
|
||||||
|
|
||||||
mwan_rule = m5:section(NamedSection, arg[1], "rule", "")
|
mwan_rule = m5:section(NamedSection, arg[1], "rule", "")
|
||||||
|
@ -79,10 +79,10 @@ proto = mwan_rule:option(Value, "proto", translate("Protocol"),
|
||||||
proto:value("udp")
|
proto:value("udp")
|
||||||
proto:value("icmp")
|
proto:value("icmp")
|
||||||
proto:value("esp")
|
proto:value("esp")
|
||||||
cbi_add_protocol(proto)
|
cbiAddProtocol(proto)
|
||||||
|
|
||||||
use_policy = mwan_rule:option(Value, "use_policy", translate("Policy assigned"))
|
use_policy = mwan_rule:option(Value, "use_policy", translate("Policy assigned"))
|
||||||
cbi_add_policy(use_policy)
|
cbiAddPolicy(use_policy)
|
||||||
use_policy:value("unreachable", translate("unreachable (reject)"))
|
use_policy:value("unreachable", translate("unreachable (reject)"))
|
||||||
use_policy:value("blackhole", translate("blackhole (drop)"))
|
use_policy:value("blackhole", translate("blackhole (drop)"))
|
||||||
use_policy:value("default", translate("default (use main routing table)"))
|
use_policy:value("default", translate("default (use main routing table)"))
|
|
@ -1,266 +0,0 @@
|
||||||
-- ------ extra functions ------ --
|
|
||||||
|
|
||||||
function iface_check() -- find issues with too many interfaces, reliability and metric
|
|
||||||
uci.cursor():foreach("mwan3", "interface",
|
|
||||||
function (section)
|
|
||||||
local ifname = section[".name"]
|
|
||||||
ifnum = ifnum+1 -- count number of mwan3 interfaces configured
|
|
||||||
-- create list of metrics for none and duplicate checking
|
|
||||||
local metlkp = ut.trim(sys.exec("uci get -p /var/state network." .. ifname .. ".metric"))
|
|
||||||
if metlkp == "" then
|
|
||||||
err_found = 1
|
|
||||||
err_nomet_list = err_nomet_list .. ifname .. " "
|
|
||||||
else
|
|
||||||
metric_list = metric_list .. ifname .. " " .. metlkp .. "\n"
|
|
||||||
end
|
|
||||||
-- check if any interfaces have a higher reliability requirement than tracking IPs configured
|
|
||||||
local tipnum = tonumber(ut.trim(sys.exec("echo $(uci get -p /var/state mwan3." .. ifname .. ".track_ip) | wc -w")))
|
|
||||||
if tipnum > 0 then
|
|
||||||
local relnum = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. ifname .. ".reliability")))
|
|
||||||
if relnum and relnum > tipnum then
|
|
||||||
err_found = 1
|
|
||||||
err_rel_list = err_rel_list .. ifname .. " "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- check if any interfaces are not properly configured in /etc/config/network or have no default route in main routing table
|
|
||||||
if ut.trim(sys.exec("uci get -p /var/state network." .. ifname)) == "interface" then
|
|
||||||
local ifdev = ut.trim(sys.exec("uci get -p /var/state network." .. ifname .. ".ifname"))
|
|
||||||
if ifdev == "uci: Entry not found" or ifdev == "" then
|
|
||||||
err_found = 1
|
|
||||||
err_netcfg_list = err_netcfg_list .. ifname .. " "
|
|
||||||
err_route_list = err_route_list .. ifname .. " "
|
|
||||||
else
|
|
||||||
local rtcheck = ut.trim(sys.exec("route -n | awk '{ if ($8 == \"" .. ifdev .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $1 }'"))
|
|
||||||
if rtcheck == "" then
|
|
||||||
err_found = 1
|
|
||||||
err_route_list = err_route_list .. ifname .. " "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
err_found = 1
|
|
||||||
err_netcfg_list = err_netcfg_list .. ifname .. " "
|
|
||||||
err_route_list = err_route_list .. ifname .. " "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
)
|
|
||||||
-- check if any interfaces have duplicate metrics
|
|
||||||
local metric_dupnums = sys.exec("echo '" .. metric_list .. "' | awk '{ print $2 }' | uniq -d")
|
|
||||||
if metric_dupnums ~= "" then
|
|
||||||
err_found = 1
|
|
||||||
local metric_dupes = ""
|
|
||||||
for line in metric_dupnums:gmatch("[^\r\n]+") do
|
|
||||||
metric_dupes = sys.exec("echo '" .. metric_list .. "' | grep '" .. line .. "' | awk '{ print $1 }'")
|
|
||||||
err_dupmet_list = err_dupmet_list .. metric_dupes
|
|
||||||
end
|
|
||||||
err_dupmet_list = sys.exec("echo '" .. err_dupmet_list .. "' | tr '\n' ' '")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function iface_warn() -- display status and warning messages at the top of the page
|
|
||||||
local warns = ""
|
|
||||||
if ifnum <= 250 then
|
|
||||||
warns = "<strong>There are currently " .. ifnum .. " of 250 supported interfaces configured</strong>"
|
|
||||||
else
|
|
||||||
warns = "<font color=\"ff0000\"><strong>WARNING: " .. ifnum .. " interfaces are configured exceeding the maximum of 250!</strong></font>"
|
|
||||||
end
|
|
||||||
if err_rel_list ~= " " then
|
|
||||||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have a higher reliability requirement than there are tracking IP addresses!</strong></font>"
|
|
||||||
end
|
|
||||||
if err_route_list ~= " " then
|
|
||||||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no default route in the main routing table!</strong></font>"
|
|
||||||
end
|
|
||||||
if err_netcfg_list ~= " " then
|
|
||||||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces are configured incorrectly or not at all in /etc/config/network!</strong></font>"
|
|
||||||
end
|
|
||||||
if err_nomet_list ~= " " then
|
|
||||||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have no metric configured in /etc/config/network!</strong></font>"
|
|
||||||
end
|
|
||||||
if err_dupmet_list ~= " " then
|
|
||||||
warns = warns .. "<br /><br /><font color=\"ff0000\"><strong>WARNING: some interfaces have duplicate metrics configured in /etc/config/network!</strong></font>"
|
|
||||||
end
|
|
||||||
return warns
|
|
||||||
end
|
|
||||||
|
|
||||||
-- ------ interface configuration ------ --
|
|
||||||
|
|
||||||
dsp = require "luci.dispatcher"
|
|
||||||
sys = require "luci.sys"
|
|
||||||
ut = require "luci.util"
|
|
||||||
|
|
||||||
ifnum = 0
|
|
||||||
metric_list = ""
|
|
||||||
err_found = 0
|
|
||||||
err_dupmet_list = " "
|
|
||||||
err_netcfg_list = " "
|
|
||||||
err_nomet_list = " "
|
|
||||||
err_rel_list = " "
|
|
||||||
err_route_list = " "
|
|
||||||
iface_check()
|
|
||||||
|
|
||||||
|
|
||||||
m5 = Map("mwan3", translate("MWAN3 Multi-WAN Interface Configuration"),
|
|
||||||
translate(iface_warn()))
|
|
||||||
m5:append(Template("mwan3/mwan3_config_css"))
|
|
||||||
|
|
||||||
|
|
||||||
mwan_interface = m5:section(TypedSection, "interface", translate("Interfaces"),
|
|
||||||
translate("MWAN3 supports up to 250 physical and/or logical interfaces<br />" ..
|
|
||||||
"MWAN3 requires that all interfaces have a unique metric configured in /etc/config/network<br />" ..
|
|
||||||
"Names must match the interface name found in /etc/config/network (see advanced tab)<br />" ..
|
|
||||||
"Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
|
|
||||||
"Interfaces may not share the same name as configured members, policies or rules"))
|
|
||||||
mwan_interface.addremove = true
|
|
||||||
mwan_interface.dynamic = false
|
|
||||||
mwan_interface.sectionhead = "Interface"
|
|
||||||
mwan_interface.sortable = true
|
|
||||||
mwan_interface.template = "cbi/tblsection"
|
|
||||||
mwan_interface.extedit = dsp.build_url("admin", "network", "mwan3", "configuration", "interface", "%s")
|
|
||||||
function mwan_interface.create(self, section)
|
|
||||||
TypedSection.create(self, section)
|
|
||||||
m5.uci:save("mwan3")
|
|
||||||
luci.http.redirect(dsp.build_url("admin", "network", "mwan3", "configuration", "interface", section))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
enabled = mwan_interface:option(DummyValue, "enabled", translate("Enabled"))
|
|
||||||
enabled.rawhtml = true
|
|
||||||
function enabled.cfgvalue(self, s)
|
|
||||||
if self.map:get(s, "enabled") == "1" then
|
|
||||||
return "Yes"
|
|
||||||
else
|
|
||||||
return "No"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
track_ip = mwan_interface:option(DummyValue, "track_ip", translate("Tracking IP"))
|
|
||||||
track_ip.rawhtml = true
|
|
||||||
function track_ip.cfgvalue(self, s)
|
|
||||||
local str = ""
|
|
||||||
tracked = self.map:get(s, "track_ip")
|
|
||||||
if tracked then
|
|
||||||
for k,v in pairs(tracked) do
|
|
||||||
str = str .. v .. "<br />"
|
|
||||||
end
|
|
||||||
return str
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracking reliability"))
|
|
||||||
reliability.rawhtml = true
|
|
||||||
function reliability.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
return self.map:get(s, "reliability") or "—"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
count = mwan_interface:option(DummyValue, "count", translate("Ping count"))
|
|
||||||
count.rawhtml = true
|
|
||||||
function count.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
return self.map:get(s, "count") or "—"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
timeout = mwan_interface:option(DummyValue, "timeout", translate("Ping timeout"))
|
|
||||||
timeout.rawhtml = true
|
|
||||||
function timeout.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
local tcheck = self.map:get(s, "timeout")
|
|
||||||
if tcheck then
|
|
||||||
return tcheck .. "s"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
interval = mwan_interface:option(DummyValue, "interval", translate("Ping interval"))
|
|
||||||
interval.rawhtml = true
|
|
||||||
function interval.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
local icheck = self.map:get(s, "interval")
|
|
||||||
if icheck then
|
|
||||||
return icheck .. "s"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
down = mwan_interface:option(DummyValue, "down", translate("Interface down"))
|
|
||||||
down.rawhtml = true
|
|
||||||
function down.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
return self.map:get(s, "down") or "—"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
up = mwan_interface:option(DummyValue, "up", translate("Interface up"))
|
|
||||||
up.rawhtml = true
|
|
||||||
function up.cfgvalue(self, s)
|
|
||||||
if tracked then
|
|
||||||
return self.map:get(s, "up") or "—"
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
metric = mwan_interface:option(DummyValue, "metric", translate("Metric"))
|
|
||||||
metric.rawhtml = true
|
|
||||||
function metric.cfgvalue(self, s)
|
|
||||||
local metcheck = sys.exec("uci get -p /var/state network." .. s .. ".metric")
|
|
||||||
if metcheck ~= "" then
|
|
||||||
return metcheck
|
|
||||||
else
|
|
||||||
return "—"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
errors = mwan_interface:option(DummyValue, "errors", translate("Errors"))
|
|
||||||
errors.rawhtml = true
|
|
||||||
function errors.cfgvalue(self, s)
|
|
||||||
if err_found == 1 then
|
|
||||||
local mouseover, linebrk = "", ""
|
|
||||||
if string.find(err_rel_list, " " .. s .. " ") then
|
|
||||||
mouseover = "Higher reliability requirement than there are tracking IP addresses"
|
|
||||||
linebrk = " "
|
|
||||||
end
|
|
||||||
if string.find(err_route_list, " " .. s .. " ") then
|
|
||||||
mouseover = mouseover .. linebrk .. "No default route in the main routing table"
|
|
||||||
linebrk = " "
|
|
||||||
end
|
|
||||||
if string.find(err_netcfg_list, " " .. s .. " ") then
|
|
||||||
mouseover = mouseover .. linebrk .. "Configured incorrectly or not at all in /etc/config/network"
|
|
||||||
linebrk = " "
|
|
||||||
end
|
|
||||||
if string.find(err_nomet_list, " " .. s .. " ") then
|
|
||||||
mouseover = mouseover .. linebrk .. "No metric configured in /etc/config/network"
|
|
||||||
linebrk = " "
|
|
||||||
end
|
|
||||||
if string.find(err_dupmet_list, " " .. s .. " ") then
|
|
||||||
mouseover = mouseover .. linebrk .. "Duplicate metric configured in /etc/config/network"
|
|
||||||
end
|
|
||||||
if mouseover == "" then
|
|
||||||
return ""
|
|
||||||
else
|
|
||||||
return "<span title=\"" .. mouseover .. "\"><img src=\"/luci-static/resources/cbi/reset.gif\" alt=\"error\"></img></span>"
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return ""
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return m5
|
|
|
@ -0,0 +1 @@
|
||||||
|
<%+mwan/openwrt_overview_status%>
|
|
@ -1 +0,0 @@
|
||||||
<%+mwan3/mwan3_status%>
|
|
|
@ -1,20 +1,20 @@
|
||||||
<%+header%>
|
<%+header%>
|
||||||
|
|
||||||
<ul class="cbi-tabmenu">
|
<ul class="cbi-tabmenu">
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li>
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<%
|
<%
|
||||||
local uci = require "luci.model.uci"
|
local uci = require "luci.model.uci"
|
||||||
|
|
||||||
str = ""
|
interfaceNames = ""
|
||||||
uci.cursor():foreach("mwan3", "interface",
|
uci.cursor():foreach("mwan3", "interface",
|
||||||
function (section)
|
function (section)
|
||||||
str = str .. section[".name"] .. " "
|
interfaceNames = interfaceNames .. section[".name"] .. " "
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
%>
|
%>
|
||||||
|
@ -23,16 +23,16 @@
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
var stxhr = new XHR();
|
var stxhr = new XHR();
|
||||||
|
|
||||||
function update_status(tool, alt)
|
function update_status(tool, task)
|
||||||
{
|
{
|
||||||
var iface = document.getElementById('mwan3iface').value;
|
var iface = document.getElementById('mwaniface').value;
|
||||||
var output = document.getElementById('diag_output');
|
var output = document.getElementById('diag_output');
|
||||||
|
|
||||||
if (tool == "service")
|
if (tool == "service")
|
||||||
{
|
{
|
||||||
output.innerHTML =
|
output.innerHTML =
|
||||||
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
|
'<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="padding: 20px; vertical-align: middle;" /> ' +
|
||||||
"Waiting for MWAN3 to " + alt + "..."
|
"Waiting for MWAN to " + task + "..."
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -46,30 +46,27 @@
|
||||||
output.parentNode.style.display = 'block';
|
output.parentNode.style.display = 'block';
|
||||||
output.style.display = 'inline';
|
output.style.display = 'inline';
|
||||||
|
|
||||||
stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "mwan3", "advanced")%>/diag_display' + '/' + iface + '/' + tool + '/' + alt, null,
|
stxhr.get('<%=luci.dispatcher.build_url("admin", "network", "mwan", "advanced")%>/diagnostics_display' + '/' + iface + '/' + tool + '/' + task, null,
|
||||||
function(x, st)
|
function(x, mArray)
|
||||||
{
|
{
|
||||||
if (st.diagres)
|
if (mArray.diagnostics)
|
||||||
{
|
{
|
||||||
output.innerHTML = String.format('<pre id="diag_output_css">%h</pre>', st.diagres[0].diagresult);
|
output.innerHTML = String.format('<pre id="diag_output_css">%h</pre>', mArray.diagnostics[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var temp = '';
|
output.innerHTML = '<pre id="diag_output_css"><strong>No diagnostic results returned</strong></pre>';
|
||||||
var ncint = 'No diagnostic results returned';
|
|
||||||
temp = String.format('<pre id="diag_output_css"><strong>%s</strong></pre>', ncint);
|
|
||||||
output.innerHTML = temp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<div id="mwan3_diagnostics" class="cbi-map">
|
<div id="mwan_diagnostics" class="cbi-map">
|
||||||
<fieldset id="diag_select" class="cbi-section">
|
<fieldset id="diag_select" class="cbi-section">
|
||||||
<legend><%:MWAN3 Interface Diagnostics%></legend>
|
<legend><%:MWAN Interface Diagnostics%></legend>
|
||||||
<select id="mwan3iface">
|
<select id="mwaniface">
|
||||||
<% for z in str:gmatch("[^ ]+") do -%><option value="<%=z%>"><%=z%></option><%- end %>
|
<% for z in interfaceNames:gmatch("[^ ]+") do -%><option value="<%=z%>"><%=z%></option><%- end %>
|
||||||
</select>
|
</select>
|
||||||
<div id="buttoncss">
|
<div id="buttoncss">
|
||||||
<input type="button" value="<%:Ping default gateway%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'gateway')" />
|
<input type="button" value="<%:Ping default gateway%>" class="cbi-button cbi-button-apply" onclick="update_status('ping', 'gateway')" />
|
||||||
|
@ -81,11 +78,11 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset id="diag_select" class="cbi-section">
|
<fieldset id="diag_select" class="cbi-section">
|
||||||
<legend><%:MWAN3 Service Control%></legend>
|
<legend><%:MWAN Service Control%></legend>
|
||||||
<div id="buttoncss">
|
<div id="buttoncss">
|
||||||
<input type="button" value="<%:Restart MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'restart')" />
|
<input type="button" value="<%:Restart MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'restart')" />
|
||||||
<input type="button" value="<%:Stop MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'stop')" />
|
<input type="button" value="<%:Stop MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'stop')" />
|
||||||
<input type="button" value="<%:Start MWAN3%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'start')" />
|
<input type="button" value="<%:Start MWAN%>" class="cbi-button cbi-button-apply" onclick="update_status('service', 'start')" />
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="cbi-section" style="display:none">
|
<fieldset class="cbi-section" style="display:none">
|
||||||
|
@ -95,13 +92,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
#mwan3_diagnostics {
|
#mwan_diagnostics {
|
||||||
background-color: #FFFFFF;
|
background-color: #FFFFFF;
|
||||||
border: 1px dotted #555555;
|
border: 1px dotted #555555;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
@ -109,7 +106,7 @@
|
||||||
#diag_select {
|
#diag_select {
|
||||||
padding: 12px 20px 20px 20px;
|
padding: 12px 20px 20px 20px;
|
||||||
}
|
}
|
||||||
#mwan3iface {
|
#mwaniface {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 8px 20px 0px 0px;
|
margin: 8px 20px 0px 0px;
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
<ul class="cbi-tabmenu">
|
<ul class="cbi-tabmenu">
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li>
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin: 0px 0px 0px 30px;
|
margin: 0px 0px 0px 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
|
@ -1,13 +1,13 @@
|
||||||
<ul class="cbi-tabmenu">
|
<ul class="cbi-tabmenu">
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li>
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin: 0px 0px 0px 30px;
|
margin: 0px 0px 0px 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
|
@ -1,13 +1,13 @@
|
||||||
<ul class="cbi-tabmenu">
|
<ul class="cbi-tabmenu">
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li>
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li>
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin: 0px 0px 0px 30px;
|
margin: 0px 0px 0px 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
|
@ -0,0 +1,71 @@
|
||||||
|
<%+header%>
|
||||||
|
|
||||||
|
<ul class="cbi-tabmenu">
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/hotplugscript")%>"><%:Hotplug Script%></a></li>
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/mwanconfig")%>"><%:MWAN Config%></a></li>
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/networkconfig")%>"><%:Network Config%></a></li>
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/diagnostics")%>"><%:Diagnostics%></a></li>
|
||||||
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/advanced/troubleshooting")%>"><%:Troubleshooting%></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "network", "mwan", "advanced", "troubleshooting_display")%>', null,
|
||||||
|
function(x, mArray)
|
||||||
|
{
|
||||||
|
var tshoot = document.getElementById('troubleshoot_text');
|
||||||
|
if (mArray.versions)
|
||||||
|
{
|
||||||
|
var versions = '<span class="description">Software versions : </span><br /><br />';
|
||||||
|
var mwanConfig = '<br /><br /><span class="description">Output of "cat /etc/config/mwan3" : </span><br /><br />';
|
||||||
|
var netConfig = '<br /><br /><span class="description">Output of "cat /etc/config/network" : </span><br /><br />';
|
||||||
|
var ifconfig = '<br /><br /><span class="description">Output of "ifconfig" : </span><br /><br />';
|
||||||
|
var ipRoute = '<br /><br /><span class="description">Output of "route -n" : </span><br /><br />';
|
||||||
|
var ipRuleShow = '<br /><br /><span class="description">Output of "ip rule show" : </span><br /><br />';
|
||||||
|
var routeListTable = '<br /><br /><span class="description">Output of "ip route list table 1-250" : </span><br /><br />';
|
||||||
|
var firewallOut = '<br /><br /><span class="description">Firewall default output policy (must be ACCEPT) : </span><br /><br />';
|
||||||
|
var iptables = '<br /><br /><span class="description">Output of "iptables -L -t mangle -v -n" : </span><br /><br />';
|
||||||
|
tshoot.innerHTML = String.format(
|
||||||
|
'<pre>%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s</pre>',
|
||||||
|
versions, mArray.versions[0], mwanConfig, mArray.mwanconfig[0], netConfig, mArray.netconfig[0],
|
||||||
|
ifconfig, mArray.ifconfig[0], ipRoute, mArray.routeshow[0], ipRuleShow, mArray.iprule[0],
|
||||||
|
routeListTable, mArray.routelist[0], firewallOut, mArray.firewallout[0], iptables, mArray.iptables[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tshoot.innerHTML = '<strong>Error collecting troubleshooting information</strong>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]></script>
|
||||||
|
|
||||||
|
<div id="troubleshoot">
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<legend><%:Troubleshooting Data%></legend>
|
||||||
|
<div id="troubleshoot_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
|
max-width: none;
|
||||||
|
margin-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
#troubleshoot {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px dotted #555555;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
#troubleshoot_text {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.description {
|
||||||
|
background-color: rgb(78, 186, 241);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<%+footer%>
|
|
@ -1,28 +1,28 @@
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: none;
|
max-width: none;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
padding-right: 30px;
|
padding-right: 30px;
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
table td { /*cells showing the configuration values*/
|
table td { /* cells showing the configuration values */
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
table th { /*column for configuration section name*/
|
table th { /* column for configuration section name */
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
table tbody th { /*column for configuration section name*/
|
table tbody th { /* column for configuration section name */
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.cbi-section-node table div { /*rows*/
|
.cbi-section-node table div { /* rows */
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
table.cbi-section-table td.cbi-section-table-cell { /*sort buttons column*/
|
table.cbi-section-table td.cbi-section-table-cell { /* sort buttons column */
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.cbi-section h3 {
|
.cbi-section h3 {
|
|
@ -1,71 +1,62 @@
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "iface_status")%>', null,
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan", "overview", "interface_status")%>', null,
|
||||||
function(x, st)
|
function(x, mArray)
|
||||||
{
|
{
|
||||||
var tx = document.getElementById('mwan3_status_text');
|
var status = document.getElementById('mwan_status_text');
|
||||||
if (st.wans)
|
if (mArray.wans)
|
||||||
{
|
{
|
||||||
var temp = '';
|
var temp = '';
|
||||||
|
for( var i = 0; i < mArray.wans.length; i++ )
|
||||||
for( var i = 0; i < st.wans.length; i++ )
|
|
||||||
{
|
{
|
||||||
var stat = '';
|
var stat = '';
|
||||||
var cssc = '';
|
var cssc = '';
|
||||||
|
switch (mArray.wans[i].status)
|
||||||
switch (st.wans[i].status)
|
|
||||||
{
|
{
|
||||||
case 'on':
|
case 'online':
|
||||||
stat = 'Online (tracking active)';
|
stat = 'Online (tracking active)';
|
||||||
cssc = 'wanon';
|
cssc = 'wanon';
|
||||||
break;
|
break;
|
||||||
|
case 'notMonitored':
|
||||||
case 'nm':
|
|
||||||
stat = 'Online (tracking off)';
|
stat = 'Online (tracking off)';
|
||||||
cssc = 'wanon';
|
cssc = 'wanon';
|
||||||
break;
|
break;
|
||||||
|
case 'offline':
|
||||||
case 'off':
|
|
||||||
stat = 'Offline';
|
stat = 'Offline';
|
||||||
cssc = 'wanoff';
|
cssc = 'wanoff';
|
||||||
break;
|
break;
|
||||||
|
case 'notEnabled':
|
||||||
case 'ne':
|
|
||||||
stat = 'Disabled';
|
stat = 'Disabled';
|
||||||
cssc = 'wanoff';
|
cssc = 'wanoff';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp += String.format(
|
temp += String.format(
|
||||||
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
|
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
|
||||||
cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat
|
cssc, mArray.wans[i].name, mArray.wans[i].link, mArray.wans[i].ifname, stat
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
tx.innerHTML = temp;
|
status.innerHTML = temp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var temp = '';
|
status.innerHTML = '<strong>No MWAN interfaces found</strong>';
|
||||||
var ncint = 'No MWAN3 interfaces found';
|
|
||||||
temp += String.format('<strong>%s</strong>', ncint );
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<fieldset id="interface_field" class="cbi-section">
|
<fieldset id="interface_field" class="cbi-section">
|
||||||
<legend><%:MWAN3 Multi-WAN Interface Live Status%></legend>
|
<legend><%:MWAN Interface Live Status%></legend>
|
||||||
<div id="mwan3_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
<div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
max-width: 1044px;
|
max-width: 1044px;
|
||||||
}
|
}
|
||||||
#interface_field {
|
#interface_field {
|
||||||
padding: 12px 20px 20px 20px;
|
padding: 12px 20px 20px 20px;
|
||||||
}
|
}
|
||||||
#mwan3_status_text {
|
#mwan_status_text {
|
||||||
display: table;
|
display: table;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: auto;
|
margin: auto;
|
|
@ -0,0 +1,51 @@
|
||||||
|
<%+header%>
|
||||||
|
|
||||||
|
<ul class="cbi-tabmenu">
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview")%>"><%:Interface Status%></a></li>
|
||||||
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview/overview_detailed")%>"><%:Detailed Status%></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan", "overview", "detailed_status")%>', null,
|
||||||
|
function(x, mArray)
|
||||||
|
{
|
||||||
|
var status = document.getElementById('mwan_detail_text');
|
||||||
|
if (mArray.mwandetail)
|
||||||
|
{
|
||||||
|
status.innerHTML = String.format('<pre>%s</pre>', mArray.mwandetail[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status.innerHTML = '<strong>No detailed status information available</strong>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]></script>
|
||||||
|
|
||||||
|
<div id="mwan_detail_status">
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<legend><%:MWAN Detailed Status%></legend>
|
||||||
|
<div id="mwan_detail_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
|
max-width: none;
|
||||||
|
margin-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
#mwan_detail_status {
|
||||||
|
border: 1px dotted #555555;
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
#mwan_detail_text {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<%+footer%>
|
|
@ -0,0 +1,122 @@
|
||||||
|
<%+header%>
|
||||||
|
|
||||||
|
<ul class="cbi-tabmenu">
|
||||||
|
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview")%>"><%:Interface Status%></a></li>
|
||||||
|
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan/overview/overview_detailed")%>"><%:Detailed Status%></a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan", "overview", "interface_status")%>', null,
|
||||||
|
function(x, mArray)
|
||||||
|
{
|
||||||
|
var statusDiv = document.getElementById('mwan_status_text');
|
||||||
|
if (mArray.wans)
|
||||||
|
{
|
||||||
|
var interfaceStatus = '';
|
||||||
|
for( var i = 0; i < mArray.wans.length; i++ )
|
||||||
|
{
|
||||||
|
var status = '';
|
||||||
|
var css = '';
|
||||||
|
switch (mArray.wans[i].status)
|
||||||
|
{
|
||||||
|
case 'online':
|
||||||
|
status = 'Online (tracking active)';
|
||||||
|
css = 'wanon';
|
||||||
|
break;
|
||||||
|
case 'notMonitored':
|
||||||
|
status = 'Online (tracking off)';
|
||||||
|
css = 'wanon';
|
||||||
|
break;
|
||||||
|
case 'offline':
|
||||||
|
status = 'Offline';
|
||||||
|
css = 'wanoff';
|
||||||
|
break;
|
||||||
|
case 'notEnabled':
|
||||||
|
status = 'Disabled';
|
||||||
|
css = 'wanoff';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
interfaceStatus += String.format(
|
||||||
|
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
|
||||||
|
css, mArray.wans[i].name, mArray.wans[i].link, mArray.wans[i].ifname, status
|
||||||
|
);
|
||||||
|
}
|
||||||
|
statusDiv.innerHTML = interfaceStatus;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
statusDiv.innerHTML = '<strong>No MWAN interfaces found</strong>';
|
||||||
|
}
|
||||||
|
|
||||||
|
var logs = document.getElementById('mwan_statuslog_text');
|
||||||
|
if (mArray.mwanlog)
|
||||||
|
{
|
||||||
|
var mwanLog = 'Last 50 MWAN systemlog entries. Newest entries sorted at the top :';
|
||||||
|
logs.innerHTML = String.format('<pre>%s<br /><br />%s</pre>', mwanLog, mArray.mwanlog[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logs.innerHTML = '<strong>No MWAN systemlog history found</strong>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//]]></script>
|
||||||
|
|
||||||
|
<div id="mwan_interface_status">
|
||||||
|
<fieldset id="interface_field" class="cbi-section">
|
||||||
|
<legend><%:MWAN Interface Live Status%></legend>
|
||||||
|
<div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
||||||
|
</fieldset>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<legend><%:MWAN Interface Systemlog%></legend>
|
||||||
|
<div id="mwan_statuslog_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
|
||||||
|
max-width: none;
|
||||||
|
margin-left: 30px;
|
||||||
|
padding-right: 30px;
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
|
#mwan_interface_status {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
border: 1px dotted #555555;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
#interface_field {
|
||||||
|
padding: 12px 20px 20px 20px;
|
||||||
|
}
|
||||||
|
#mwan_status_text {
|
||||||
|
display: table;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: auto;
|
||||||
|
max-width: 1044px;
|
||||||
|
min-width: 246px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.wanon {
|
||||||
|
background-color: rgb(144, 240, 144);
|
||||||
|
}
|
||||||
|
.wanoff {
|
||||||
|
background-color: rgb(240, 144, 144);
|
||||||
|
}
|
||||||
|
.wanon, .wanoff {
|
||||||
|
border-radius: 60px;
|
||||||
|
box-shadow: 0px 2px 5px -3px;
|
||||||
|
float: left;
|
||||||
|
margin: 8px 3px 0px 3px;
|
||||||
|
min-height: 30px;
|
||||||
|
min-width: 235px;
|
||||||
|
padding: 5px 10px 8px 10px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#mwan_statuslog_text {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<%+footer%>
|
|
@ -1,75 +0,0 @@
|
||||||
<%+header%>
|
|
||||||
|
|
||||||
<ul class="cbi-tabmenu">
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/hotplug")%>"><%:Hotplug Script%></a></li>
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/mwan3")%>"><%:MWAN3 Config%></a></li>
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/network")%>"><%:Network Config%></a></li>
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/diag")%>"><%:Diagnostics%></a></li>
|
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/advanced/tshoot")%>"><%:Troubleshooting%></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "advanced", "tshoot_display")%>', null,
|
|
||||||
function(x, st)
|
|
||||||
{
|
|
||||||
var tx = document.getElementById('mwan3_tshoot_text');
|
|
||||||
if (st.mw3ver)
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var mwanvers = 'Software versions : <br /><br />';
|
|
||||||
var mwan3cnfg = '<br /><br />Output of "cat /etc/config/mwan3" : <br /><br />';
|
|
||||||
var netcnfg = '<br /><br />Output of "cat /etc/config/network" : <br /><br />';
|
|
||||||
var ifcnfg = '<br /><br />Output of "ifconfig" : <br /><br />';
|
|
||||||
var iproute = '<br /><br />Output of "route -n" : <br /><br />';
|
|
||||||
var iprulesh = '<br /><br />Output of "ip rule show" : <br /><br />';
|
|
||||||
var routelisttbl = '<br /><br />Output of "ip route list table 1-250" : <br /><br />';
|
|
||||||
var firewalldef = '<br /><br />Firewall default output policy (must be ACCEPT) : <br /><br />';
|
|
||||||
var iptable = '<br /><br />Output of "iptables -L -t mangle -v -n" : <br /><br />';
|
|
||||||
|
|
||||||
temp = String.format(
|
|
||||||
'<pre><span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s<span class="tsht">%s</span>%s</pre>',
|
|
||||||
mwanvers, st.mw3ver[0].mwan3v, mwan3cnfg, st.mwan3config[0].mwn3cfg, netcnfg, st.netconfig[0].netcfg, ifcnfg, st.ifconfig[0].ifcfg, iproute, st.rtshow[0].iprtshow, iprulesh, st.iprule[0].rule, routelisttbl, st.routelist[0].iprtlist, firewalldef, st.fidef[0].firedef, iptable, st.iptables[0].iptbls
|
|
||||||
);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var terror = 'Error collecting troubleshooting information';
|
|
||||||
temp = String.format('<strong>%s</strong>', terror);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]></script>
|
|
||||||
|
|
||||||
<div id="tshoot_div">
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<legend><%:Troubleshooting Data%></legend>
|
|
||||||
<div id="mwan3_tshoot_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
|
||||||
max-width: none;
|
|
||||||
margin-left: 30px;
|
|
||||||
padding-right: 30px;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
#tshoot_div {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border: 1px dotted #555555;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
#mwan3_tshoot_text {
|
|
||||||
padding: 20px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
.tsht {
|
|
||||||
background-color: rgb(78, 186, 241);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<%+footer%>
|
|
|
@ -1,56 +0,0 @@
|
||||||
<%+header%>
|
|
||||||
|
|
||||||
<ul class="cbi-tabmenu">
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview")%>"><%:Interface Status%></a></li>
|
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview/over_detail")%>"><%:Detailed Status%></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "detail_status")%>', null,
|
|
||||||
function(x, st)
|
|
||||||
{
|
|
||||||
var tx = document.getElementById('mwan3_detail_text');
|
|
||||||
if (st.mwan3dst)
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
temp = String.format('<pre>%s</pre>', st.mwan3dst[0].detailstat);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var nslg = 'No detailed status information available';
|
|
||||||
temp = String.format('<strong>%s</strong>', nslg);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]></script>
|
|
||||||
|
|
||||||
<div id="mwan3_detail_status">
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<legend><%:MWAN3 Multi-WAN Detailed Status%></legend>
|
|
||||||
<div id="mwan3_detail_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
|
||||||
max-width: none;
|
|
||||||
margin-left: 30px;
|
|
||||||
padding-right: 30px;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
#mwan3_detail_status {
|
|
||||||
border: 1px dotted #555555;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
#mwan3_detail_text {
|
|
||||||
padding: 20px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<%+footer%>
|
|
|
@ -1,136 +0,0 @@
|
||||||
<%+header%>
|
|
||||||
|
|
||||||
<ul class="cbi-tabmenu">
|
|
||||||
<li class="cbi-tab"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview")%>"><%:Interface Status%></a></li>
|
|
||||||
<li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/network/mwan3/overview/over_detail")%>"><%:Detailed Status%></a></li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "mwan3", "overview", "iface_status")%>', null,
|
|
||||||
function(x, st)
|
|
||||||
{
|
|
||||||
var tx = document.getElementById('mwan3_status_text');
|
|
||||||
if (st.wans)
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
|
|
||||||
for( var i = 0; i < st.wans.length; i++ )
|
|
||||||
{
|
|
||||||
var stat = '';
|
|
||||||
var cssc = '';
|
|
||||||
|
|
||||||
switch (st.wans[i].status)
|
|
||||||
{
|
|
||||||
case 'on':
|
|
||||||
stat = 'Online (tracking active)';
|
|
||||||
cssc = 'wanon';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'nm':
|
|
||||||
stat = 'Online (tracking off)';
|
|
||||||
cssc = 'wanon';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'off':
|
|
||||||
stat = 'Offline';
|
|
||||||
cssc = 'wanoff';
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'ne':
|
|
||||||
stat = 'Disabled';
|
|
||||||
cssc = 'wanoff';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
temp += String.format(
|
|
||||||
'<span class="%s"><strong>%s (<a href="%q">%s</a>)</strong><br />%s</span>',
|
|
||||||
cssc, st.wans[i].name, st.wans[i].link, st.wans[i].ifname, stat
|
|
||||||
);
|
|
||||||
}
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var ncint = 'No MWAN3 interfaces found';
|
|
||||||
temp = String.format('<strong>%s</strong>', ncint);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tx = document.getElementById('mwan3_statuslog_text');
|
|
||||||
if (st.mwan3log)
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var mwan3lg = 'Last 50 MWAN3 systemlog entries. Newest entries sorted at the top :';
|
|
||||||
temp = String.format('<pre>%s<br /><br />%s</pre>', mwan3lg, st.mwan3log[0].mwanlog);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var temp = '';
|
|
||||||
var nslg = 'No MWAN3 systemlog history found';
|
|
||||||
temp = String.format('<strong>%s</strong>', nslg);
|
|
||||||
tx.innerHTML = temp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]></script>
|
|
||||||
|
|
||||||
<div id="mwan3_interface_status">
|
|
||||||
<fieldset id="interface_field" class="cbi-section">
|
|
||||||
<legend><%:MWAN3 Multi-WAN Interface Live Status%></legend>
|
|
||||||
<div id="mwan3_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<legend><%:MWAN3 Multi-WAN Interface Systemlog%></legend>
|
|
||||||
<div id="mwan3_statuslog_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /> Collecting data...</div>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
.container { /*container for entire page. fixes bootstrap theme's ridiculously small page width*/
|
|
||||||
max-width: none;
|
|
||||||
margin-left: 30px;
|
|
||||||
padding-right: 30px;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
#mwan3_interface_status {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
border: 1px dotted #555555;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
#interface_field {
|
|
||||||
padding: 12px 20px 20px 20px;
|
|
||||||
}
|
|
||||||
#mwan3_status_text {
|
|
||||||
display: table;
|
|
||||||
font-size: 14px;
|
|
||||||
margin: auto;
|
|
||||||
max-width: 1044px;
|
|
||||||
min-width: 246px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.wanon {
|
|
||||||
background-color: rgb(144, 240, 144);
|
|
||||||
}
|
|
||||||
.wanoff {
|
|
||||||
background-color: rgb(240, 144, 144);
|
|
||||||
}
|
|
||||||
.wanon, .wanoff {
|
|
||||||
border-radius: 60px;
|
|
||||||
box-shadow: 0px 2px 5px -3px;
|
|
||||||
float: left;
|
|
||||||
margin: 8px 3px 0px 3px;
|
|
||||||
min-height: 30px;
|
|
||||||
min-width: 235px;
|
|
||||||
padding: 5px 10px 8px 10px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#mwan3_statuslog_text {
|
|
||||||
padding: 20px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<%+footer%>
|
|
Loading…
Reference in a new issue