diff --git a/net/mwan3-luci/Makefile b/net/mwan3-luci/Makefile index 6656806b5..d74b15263 100644 --- a/net/mwan3-luci/Makefile +++ b/net/mwan3-luci/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-mwan3 PKG_VERSION:=1.4 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=Aedan Renner PKG_LICENSE:=GPLv2 diff --git a/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak b/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak index b8f660583..6e2875e3d 100755 --- a/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak +++ b/net/mwan3-luci/files/etc/hotplug.d/iface/16-mwancustombak @@ -13,7 +13,7 @@ send_alert() gather_event_info() { # create event information message - local EVENT_INFO="Interface [ "$INTERFACE" ($DEVICE) ] on router [ "$(uci get -p /var/state system.@system[0].hostname)" ] has triggered a hotplug [ "$ACTION" ] event on "$(date +"%a %b %d %Y %T %Z")"" + local EVENT_INFO="Interface [ "$INTERFACE" ($DEVICE) ] on router [ "$(uci -p /var/state get system.@system[0].hostname)" ] has triggered a hotplug [ "$ACTION" ] event on "$(date +"%a %b %d %Y %T %Z")"" # get current interface, policy and rule status local CURRENT_STATUS="$(/usr/sbin/mwan3 status)" diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua index d40ad0116..7fe4442c9 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/controller/mwan3.lua @@ -60,9 +60,9 @@ function index() end function getInterfaceStatus(ruleNumber, interfaceName) - if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".enabled")) == "1" then + if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".enabled")) == "1" then if ut.trim(sys.exec("ip route list table " .. ruleNumber)) ~= "" then - if ut.trim(sys.exec("uci get -p /var/state mwan3." .. interfaceName .. ".track_ip")) ~= "" then + if ut.trim(sys.exec("uci -p /var/state get mwan3." .. interfaceName .. ".track_ip")) ~= "" then return "online" else return "notMonitored" @@ -98,7 +98,7 @@ function interfaceStatus() wansid = {} for wanName, interfaceState in string.gfind(statusString, "([^%[]+)%[([^%]]+)%]") do - local wanInterfaceName = ut.trim(sys.exec("uci get -p /var/state network." .. wanName .. ".ifname")) + local wanInterfaceName = ut.trim(sys.exec("uci -p /var/state get network." .. wanName .. ".ifname")) if wanInterfaceName == "" then wanInterfaceName = "X" end @@ -159,7 +159,7 @@ function diagnosticsData(interface, tool, task) results = "MWAN3 started" end else - local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. interface .. ".ifname")) + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interface .. ".ifname")) if interfaceDevice ~= "" then if tool == "ping" then local gateway = ut.trim(sys.exec("route -n | awk '{if ($8 == \"" .. interfaceDevice .. "\" && $1 == \"0.0.0.0\" && $3 == \"0.0.0.0\") print $2}'")) @@ -168,7 +168,7 @@ function diagnosticsData(interface, tool, task) local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. gateway results = pingCommand .. "\n\n" .. sys.exec(pingCommand) else - local tracked = ut.trim(sys.exec("uci get -p /var/state mwan3." .. interface .. ".track_ip")) + local tracked = ut.trim(sys.exec("uci -p /var/state get mwan3." .. interface .. ".track_ip")) if tracked ~= "" then for z in tracked:gmatch("[^ ]+") do local pingCommand = "ping -c 3 -W 2 -I " .. interfaceDevice .. " " .. z @@ -223,16 +223,18 @@ function diagnosticsData(interface, tool, task) end function troubleshootingData() + local ver = require "luci.version" + local mArray = {} -- software versions - local wrtRelease = ut.trim(luci.version.distversion) + local wrtRelease = ut.trim(ver.distversion) if wrtRelease ~= "" then wrtRelease = "OpenWrt - " .. wrtRelease else wrtRelease = "OpenWrt - unknown" end - local luciRelease = ut.trim(luci.version.luciversion) + local luciRelease = ut.trim(ver.luciversion) if luciRelease ~= "" then luciRelease = "\nLuCI - " .. luciRelease else @@ -300,7 +302,7 @@ function troubleshootingData() mArray.routelist = { routeString } -- default firewall output policy - local firewallOut = ut.trim(sys.exec("uci get -p /var/state firewall.@defaults[0].output")) + local firewallOut = ut.trim(sys.exec("uci -p /var/state get firewall.@defaults[0].output")) if firewallOut == "" then firewallOut = "No data found" end diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua index 5b31390b6..a8e68a01b 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interface.lua @@ -6,7 +6,7 @@ function interfaceCheck() -- find issues with too many interfaces, reliability a 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")) + local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".metric")) if metricValue == "" then errorFound = 1 errorNoMetricList = errorNoMetricList .. interfaceName .. " " @@ -14,17 +14,17 @@ function interfaceCheck() -- find issues with too many interfaces, reliability a 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"))) + local trackingNumber = tonumber(ut.trim(sys.exec("echo $(uci -p /var/state get 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"))) + local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get 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 ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName)) == "interface" then + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. interfaceName .. ".ifname")) if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then errorFound = 1 errorNetConfigList = errorNetConfigList .. interfaceName .. " " @@ -220,7 +220,7 @@ up = mwan_interface:option(DummyValue, "up", translate("Interface up")) 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") + local metricValue = sys.exec("uci -p /var/state get network." .. s .. ".metric") if metricValue ~= "" then return metricValue else diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua index 16a7ec394..387ff01a8 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/interfaceconfig.lua @@ -1,13 +1,13 @@ -- ------ extra functions ------ -- function interfaceCheck() - metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".metric")) + metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".metric")) if metricValue == "" then -- no metric errorNoMetric = 1 else -- if metric exists create list of interface metrics to compare against for duplicates uci.cursor():foreach("mwan3", "interface", function (section) - local metricValue = ut.trim(sys.exec("uci get -p /var/state network." .. section[".name"] .. ".metric")) + local metricValue = ut.trim(sys.exec("uci -p /var/state get network." .. section[".name"] .. ".metric")) metricList = metricList .. section[".name"] .. " " .. metricValue .. "\n" end ) @@ -22,16 +22,16 @@ function interfaceCheck() end end -- check if this interface has a higher reliability requirement than track IPs configured - local trackingNumber = 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 -p /var/state get mwan3." .. arg[1] .. ".track_ip) | wc -w"))) if trackingNumber > 0 then - local reliabilityNumber = tonumber(ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".reliability"))) + local reliabilityNumber = tonumber(ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".reliability"))) if reliabilityNumber and reliabilityNumber > trackingNumber then errorReliability = 1 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." .. arg[1])) == "interface" then - local interfaceDevice = ut.trim(sys.exec("uci get -p /var/state network." .. arg[1] .. ".ifname")) + if ut.trim(sys.exec("uci -p /var/state get network." .. arg[1])) == "interface" then + local interfaceDevice = ut.trim(sys.exec("uci -p /var/state get network." .. arg[1] .. ".ifname")) if interfaceDevice == "uci: Entry not found" or interfaceDevice == "" then errorNetConfig = 1 errorRoute = 1 diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua index cbd8bdd03..a22e01054 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/rule.lua @@ -3,10 +3,10 @@ function ruleCheck() -- determine if rules needs a proper protocol configured uci.cursor():foreach("mwan3", "rule", function (section) - local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".src_port")) - local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".dest_port")) + local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".src_port")) + local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".dest_port")) if sourcePort ~= "" or destPort ~= "" then -- ports configured - local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. section[".name"] .. ".proto")) + local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. section[".name"] .. ".proto")) if protocol == "" or protocol == "all" then -- no or improper protocol error_protocol_list = error_protocol_list .. section[".name"] .. " " end diff --git a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua index d880a72e2..f7fb341e1 100644 --- a/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua +++ b/net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/ruleconfig.lua @@ -1,10 +1,10 @@ -- ------ extra functions ------ -- function ruleCheck() -- determine if rule needs a protocol specified - local sourcePort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".src_port")) - local destPort = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".dest_port")) + local sourcePort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".src_port")) + local destPort = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".dest_port")) if sourcePort ~= "" or destPort ~= "" then -- ports configured - local protocol = ut.trim(sys.exec("uci get -p /var/state mwan3." .. arg[1] .. ".proto")) + local protocol = ut.trim(sys.exec("uci -p /var/state get mwan3." .. arg[1] .. ".proto")) if protocol == "" or protocol == "all" then -- no or improper protocol error_protocol = 1 end