summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-mwan3
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-mwan3')
-rw-r--r--applications/luci-app-mwan3/luasrc/controller/mwan3.lua18
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua47
2 files changed, 59 insertions, 6 deletions
diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
index d5fc4a3ede..18c2135e43 100644
--- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
+++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua
@@ -97,9 +97,9 @@ function diagnosticsData(interface, task)
return interfaceNumber
end
- function diag_command(cmd, addr)
+ function diag_command(cmd, device, addr)
if addr and addr:match("^[a-zA-Z0-9%-%.:_]+$") then
- local util = io.popen(cmd % ut.shellquote(addr))
+ local util = io.popen(cmd %{ut.shellquote(device), ut.shellquote(addr)})
if util then
while true do
local ln = util:read("*l")
@@ -114,8 +114,14 @@ function diagnosticsData(interface, task)
end
function get_gateway(inteface)
- local dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
- local gateway
+ local gateway = nil
+ local dump = nil
+
+ dump = require("luci.util").ubus("network.interface.%s_4" % interface, "status", {})
+ if not dump then
+ dump = require("luci.util").ubus("network.interface.%s" % interface, "status", {})
+ end
+
if dump and dump.route then
local _, route
for _, route in ipairs(dump.route) do
@@ -139,7 +145,7 @@ function diagnosticsData(interface, task)
if task == "ping_gateway" then
local gateway = get_gateway(interface)
if gateway ~= nil then
- diag_command("ping -c 5 -W 1 %s 2>&1", gateway)
+ 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))
@@ -148,7 +154,7 @@ function diagnosticsData(interface, task)
local trackips = uci:get("mwan3", interface, "track_ip")
if #trackips > 0 then
for i in pairs(trackips) do
- diag_command("ping -c 5 -W 1 %s 2>&1", trackips[i])
+ 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))
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 a439502671..a6570e341c 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interfaceconfig.lua
@@ -54,6 +54,7 @@ count:value("5")
size = mwan_interface:option(Value, "size", translate("Ping size"))
size.default = "56"
+size:depends("track_method", "ping")
size:value("8")
size:value("24")
size:value("56")
@@ -67,6 +68,52 @@ size.datatype = "range(1, 65507)"
size.rmempty = false
size.optional = false
+check_quality = mwan_interface:option(Flag, "check_quality", translate("Check link quality"))
+check_quality:depends("track_method", "ping")
+check_quality.default = false
+
+failure_latency = mwan_interface:option(Value, "failure_latency", translate("Max packet latency [ms]"))
+failure_latency:depends("check_quality", 1)
+failure_latency.default = "1000"
+failure_latency:value("25")
+failure_latency:value("50")
+failure_latency:value("75")
+failure_latency:value("100")
+failure_latency:value("150")
+failure_latency:value("200")
+failure_latency:value("250")
+failure_latency:value("300")
+
+failure_loss = mwan_interface:option(Value, "failure_loss", translate("Max packet loss [%]"))
+failure_loss:depends("check_quality", 1)
+failure_loss.default = "20"
+failure_loss:value("2")
+failure_loss:value("5")
+failure_loss:value("10")
+failure_loss:value("20")
+failure_loss:value("25")
+
+recovery_latency = mwan_interface:option(Value, "recovery_latency", translate("Min packet latency [ms]"))
+recovery_latency:depends("check_quality", 1)
+recovery_latency.default = "500"
+recovery_latency:value("25")
+recovery_latency:value("50")
+recovery_latency:value("75")
+recovery_latency:value("100")
+recovery_latency:value("150")
+recovery_latency:value("200")
+recovery_latency:value("250")
+recovery_latency:value("300")
+
+recovery_loss = mwan_interface:option(Value, "recovery_loss", translate("Min packet loss [%]"))
+recovery_loss:depends("check_quality", 1)
+recovery_loss.default = "5"
+recovery_loss:value("2")
+recovery_loss:value("5")
+recovery_loss:value("10")
+recovery_loss:value("20")
+recovery_loss:value("25")
+
timeout = mwan_interface:option(ListValue, "timeout", translate("Ping timeout"))
timeout.default = "2"
timeout:value("1", translatef("%d second", 1))