From 8d0cccdb431e61b26a8482cb5a6ac81540b7d229 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 22 Jun 2018 08:51:27 +0200 Subject: luci-app-mwan3: add command to diag_command output view Add executed command to diagnostic output. Signed-off-by: Florian Eckert --- applications/luci-app-mwan3/luasrc/controller/mwan3.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'applications/luci-app-mwan3') diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index 2d46953e55..541d695ecf 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -101,6 +101,10 @@ function diagnosticsData(interface, task) if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then local util = io.popen(cmd %{ut.shellquote(device), ut.shellquote(addr)}) if util then + luci.http.write("Command:\n") + luci.http.write(cmd %{ut.shellquote(device), + ut.shellquote(addr)} .. "\n\n") + luci.http.write("Result:\n") while true do local ln = util:read("*l") if not ln then break end -- cgit v1.2.3 From 665e062061e72cb1621a927b1508e9cc56c199a2 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Fri, 13 Jul 2018 14:34:28 +0200 Subject: luci-app-mwan3: change interface enabled option to use flag cbi class Make mwan3 interface enable config option use cbi flag. Signed-off-by: Florian Eckert --- .../luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'applications/luci-app-mwan3') diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua index a6570e341c..d01945bf4a 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua @@ -13,10 +13,8 @@ mwan_interface = m5:section(NamedSection, arg[1], "interface", "") mwan_interface.addremove = false mwan_interface.dynamic = false -enabled = mwan_interface:option(ListValue, "enabled", translate("Enabled")) -enabled.default = "1" -enabled:value("1", translate("Yes")) -enabled:value("0", translate("No")) +enabled = mwan_interface:option(Flag, "enabled", translate("Enabled")) +enabled.default = false initial_state = mwan_interface:option(ListValue, "initial_state", translate("Initial state"), translate("Expect interface state on up event")) -- cgit v1.2.3 From 21de87a1d674461443c8c31a69a10cbcdc3a6d62 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 30 Aug 2018 09:04:48 +0200 Subject: luci-app-mwan3: diagnostic fix physical device lookup Use diffrent function to get the physical interface name. Signed-off-by: Florian Eckert --- applications/luci-app-mwan3/luasrc/controller/mwan3.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'applications/luci-app-mwan3') diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index 541d695ecf..5fa8d8a919 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -144,7 +144,8 @@ function diagnosticsData(interface, task) local uci = require "luci.model.uci".cursor(nil, "/var/state") local nw = require "luci.model.network".init() local network = nw:get_network(interface) - local device = network and network:ifname() + local device = network and network:get_interface() + device = device:name() luci.http.prepare_content("text/plain") if device then -- cgit v1.2.3 From 1b3f9b1f7e8dd1dcb6141cfb549274c936f975de Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 30 Aug 2018 14:41:06 +0200 Subject: luci-app-mwan3: translate missing text in diagnostic page Translate missing text. Signed-off-by: Florian Eckert --- applications/luci-app-mwan3/luasrc/controller/mwan3.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'applications/luci-app-mwan3') diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index 5fa8d8a919..d2d7422a6b 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -155,7 +155,7 @@ function diagnosticsData(interface, task) diag_command("ping -I %s -c 5 -W 1 %s 2>&1", device, gateway) else luci.http.prepare_content("text/plain") - luci.http.write(string.format("No gateway for interface %s found.", interface)) + luci.http.write(translatef("No gateway for interface %s found.", interface)) end elseif task == "ping_trackips" then local trackips = uci:get("mwan3", interface, "track_ip") @@ -164,7 +164,7 @@ function diagnosticsData(interface, task) diag_command("ping -I %s -c 5 -W 1 %s 2>&1", device, trackips[i]) end else - luci.http.write(string.format("No tracking Hosts for interface %s defined.", interface)) + luci.http.write(translatef("No tracking Hosts for interface %s defined.", interface)) end elseif task == "check_rules" then local number = getInterfaceNumber(interface) @@ -173,30 +173,30 @@ function diagnosticsData(interface, task) local iif_rule = sys.exec(string.format("ip rule | grep %d", iif)) local fwmark_rule = sys.exec(string.format("ip rule | grep %d", fwmark)) if iif_rule ~= "" and fwmark_rule ~= "" then - luci.http.write(string.format("All required IP rules for interface %s found", interface)) + luci.http.write(translatef("All required IP rules for interface %s found", interface)) luci.http.write("\n") luci.http.write(fwmark_rule) luci.http.write(iif_rule) elseif iif_rule == "" and fwmark_rule ~= "" then - luci.http.write(string.format("Only one IP rules for interface %s found", interface)) + luci.http.write(translatef("Only one IP rules for interface %s found", interface)) luci.http.write("\n") luci.http.write(fwmark_rule) elseif iif_rule ~= "" and fwmark_rule == "" then - luci.http.write(string.format("Only one IP rules for interface %s found", interface)) + luci.http.write(translatef("Only one IP rules for interface %s found", interface)) luci.http.write("\n") luci.http.write(iif_rule) else - luci.http.write(string.format("Missing both IP rules for interface %s", interface)) + luci.http.write(translatef("Missing both IP rules for interface %s", interface)) end elseif task == "check_routes" then local number = getInterfaceNumber(interface) local routeTable = sys.exec(string.format("ip route list table %s", number)) if routeTable ~= "" then - luci.http.write(string.format("Routing table %s for interface %s found", number, interface)) + luci.http.write(translatef("Routing table %s for interface %s found", number, interface)) luci.http.write("\n") luci.http.write(routeTable) else - luci.http.write(string.format("Routing table %s for interface %s not found", number, interface)) + luci.http.write(translatef("Routing table %s for interface %s not found", number, interface)) end elseif task == "hotplug_ifup" then os.execute(string.format("/usr/sbin/mwan3 ifup %s", ut.shellquote(interface))) -- cgit v1.2.3