Browse Source

mwan3-luci updated to 1.4-4

Hard-coded location of ip (/usr/bin/ip) in controller file
Added space after "for" in .htm files to clean it up

signed-off-by: Aedan "ARFETT" Renner <chipdankly@gmail.com>
lilik-openwrt-22.03
Aedan ARFETT Renner 9 years ago
parent
commit
9c121aa2d1
4 changed files with 12 additions and 10 deletions
  1. +1
    -1
      net/mwan3-luci/Makefile
  2. +9
    -7
      net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua
  3. +1
    -1
      net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm
  4. +1
    -1
      net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm

+ 1
- 1
net/mwan3-luci/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-mwan3 PKG_NAME:=luci-app-mwan3
PKG_VERSION:=1.4 PKG_VERSION:=1.4
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com> PKG_MAINTAINER:=Aedan Renner <chipdankly@gmail.com>
PKG_LICENSE:=GPLv2 PKG_LICENSE:=GPLv2


+ 9
- 7
net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua View File

@ -3,6 +3,8 @@ module("luci.controller.mwan3", package.seeall)
sys = require "luci.sys" sys = require "luci.sys"
ut = require "luci.util" ut = require "luci.util"
ip = "/usr/bin/ip -4 "
function index() function index()
if not nixio.fs.access("/etc/config/mwan3") then if not nixio.fs.access("/etc/config/mwan3") then
return return
@ -61,7 +63,7 @@ end
function getInterfaceStatus(ruleNumber, interfaceName) function getInterfaceStatus(ruleNumber, interfaceName)
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then
if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then
if ut.trim(sys.exec(ip .. "route list table " .. ruleNumber)) ~= "" then
if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then
return "online" return "online"
else else
@ -183,8 +185,8 @@ function diagnosticsData(interface, tool, task)
end end
elseif tool == "rulechk" then elseif tool == "rulechk" then
getInterfaceNumber() getInterfaceNumber()
local rule1 = sys.exec("ip rule | grep $(echo $((" .. interfaceNumber .. " + 1000)))")
local rule2 = sys.exec("ip rule | grep $(echo $((" .. interfaceNumber .. " + 2000)))")
local rule1 = sys.exec(ip .. "rule | grep $(echo $((" .. interfaceNumber .. " + 1000)))")
local rule2 = sys.exec(ip .. "rule | grep $(echo $((" .. interfaceNumber .. " + 2000)))")
if rule1 ~= "" and rule2 ~= "" then if rule1 ~= "" and rule2 ~= "" then
results = "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
@ -194,7 +196,7 @@ function diagnosticsData(interface, tool, task)
end end
elseif tool == "routechk" then elseif tool == "routechk" then
getInterfaceNumber() getInterfaceNumber()
local routeTable = sys.exec("ip route list table " .. interfaceNumber)
local routeTable = sys.exec(ip .. "route list table " .. interfaceNumber)
if routeTable ~= "" then if routeTable ~= "" then
results = "Interface routing table " .. interfaceNumber .. " was found:\n\n" .. routeTable results = "Interface routing table " .. interfaceNumber .. " was found:\n\n" .. routeTable
else else
@ -283,17 +285,17 @@ function troubleshootingData()
mArray.routeshow = { routeShow } mArray.routeshow = { routeShow }
-- ip rule show -- ip rule show
local ipRuleShow = ut.trim(sys.exec("ip rule show"))
local ipRuleShow = ut.trim(sys.exec(ip .. "rule show"))
if ipRuleShow == "" then if ipRuleShow == "" then
ipRuleShow = "No data found" ipRuleShow = "No data found"
end end
mArray.iprule = { ipRuleShow } mArray.iprule = { ipRuleShow }
-- ip route list table 1-250 -- ip route list table 1-250
local routeList, routeString = 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 routeList ~= "" then if routeList ~= "" then
for line in routeList:gmatch("[^\r\n]+") do for line in routeList:gmatch("[^\r\n]+") do
routeString = routeString .. line .. "\n" .. sys.exec("ip route list table " .. line)
routeString = routeString .. line .. "\n" .. sys.exec(ip .. "route list table " .. line)
end end
routeString = ut.trim(routeString) routeString = ut.trim(routeString)
else else


+ 1
- 1
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/openwrt_overview_status.htm View File

@ -6,7 +6,7 @@
if (mArray.wans) if (mArray.wans)
{ {
var temp = ''; var temp = '';
for( var i = 0; i < mArray.wans.length; i++ )
for ( var i = 0; i < mArray.wans.length; i++ )
{ {
var stat = ''; var stat = '';
var cssc = ''; var cssc = '';


+ 1
- 1
net/mwan3-luci/files/usr/lib/lua/luci/view/mwan/overview_interface.htm View File

@ -14,7 +14,7 @@
if (mArray.wans) if (mArray.wans)
{ {
var interfaceStatus = ''; var interfaceStatus = '';
for( var i = 0; i < mArray.wans.length; i++ )
for ( var i = 0; i < mArray.wans.length; i++ )
{ {
var status = ''; var status = '';
var css = ''; var css = '';


Loading…
Cancel
Save