From fa86ba21a6679bb6f0542193e18389ebd4453665 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Mon, 16 Jul 2018 12:16:54 +0200 Subject: [PATCH] Test upload and download with iperf --- luci-app-iperf/luasrc/controller/iperf.lua | 14 +++- luci-app-iperf/luasrc/view/iperf/test.htm | 77 ++++++++++++++++------ 2 files changed, 69 insertions(+), 22 deletions(-) diff --git a/luci-app-iperf/luasrc/controller/iperf.lua b/luci-app-iperf/luasrc/controller/iperf.lua index 7174e5a25..147ce4a66 100644 --- a/luci-app-iperf/luasrc/controller/iperf.lua +++ b/luci-app-iperf/luasrc/controller/iperf.lua @@ -10,7 +10,7 @@ function index() entry({"admin", "services", "iperf", "run_test"}, post("run_test")).leaf = true end -function run_test(server,proto,mode) +function run_test(server,proto,mode,updown) luci.http.prepare_content("text/plain") local iperf local addr = uci:get("iperf",server,"host") @@ -21,10 +21,18 @@ function run_test(server,proto,mode) end local port = t[ math.random( #t ) ] if proto == "ipv4" then - iperf = io.popen("iperf3 -c %s -P 10 -4 -p %s -J" % {ut.shellquote(addr),port}) + if updown == "upload" then + iperf = io.popen("iperf3 -c %s -P 10 -4 -p %s -O 3 -J" % {ut.shellquote(addr),port}) + else + iperf = io.popen("iperf3 -c %s -P 10 -4 -p %s -O 3 -R -J" % {ut.shellquote(addr),port}) + end --iperf = io.popen("iperf3 -c bouygues.iperf.fr -P 10 -4 -J") else - iperf = io.popen("iperf3 -c %s -P 10 -6 -p %s -J" % {ut.shellquote(addr),port}) + if updown == "upload" then + iperf = io.popen("iperf3 -c %s -P 10 -6 -p %s -O 3 -J" % {ut.shellquote(addr),port}) + else + iperf = io.popen("iperf3 -c %s -P 10 -6 -p %s -O 3 -R -J" % {ut.shellquote(addr),port}) + end end if iperf then while true do diff --git a/luci-app-iperf/luasrc/view/iperf/test.htm b/luci-app-iperf/luasrc/view/iperf/test.htm index f2fa1069e..f256c5a44 100644 --- a/luci-app-iperf/luasrc/view/iperf/test.htm +++ b/luci-app-iperf/luasrc/view/iperf/test.htm @@ -8,45 +8,84 @@