1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Use iperf3 in diag

This commit is contained in:
Ycarus 2018-03-06 20:49:15 +01:00
parent 338c8865ec
commit 8dfbd211ae
3 changed files with 18 additions and 1 deletions

View file

@ -153,6 +153,9 @@ function index()
page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil)
page.leaf = true
page = entry({"admin", "network", "diag_iperf3"}, post("diag_iperf3"), nil)
page.leaf = true
page = entry({"admin", "network", "diag_speedtest"}, post("diag_speedtest"), nil)
page.leaf = true
-- end
@ -431,6 +434,10 @@ function diag_traceroute6(addr)
diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1", addr)
end
function diag_iperf3(addr)
diag_command("iperf3 -c %q 2>&1", addr)
end
function diag_speedtest(addr)
if addr then
diag_command("speedtestc --server %q 2>&1", addr)

View file

@ -10,10 +10,12 @@ local fs = require "nixio.fs"
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
local has_speedtest = fs.access("/usr/sbin/speedtestc")
local has_iperf3 = fs.access("/usr/bin/iperf3")
local dns_host = luci.config.diag and luci.config.diag.dns or "dev.openwrt.org"
local ping_host = luci.config.diag and luci.config.diag.ping or "dev.openwrt.org"
local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.org"
local iperf3_host = luci.config.diag and luci.config.diag.iperf3 or "ping-ams1.online.net"
%>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
@ -102,13 +104,20 @@ local route_host = luci.config.diag and luci.config.diag.route or "dev.openwrt.o
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
</div>
<% if has_speedtest then %>
<% if has_speedtest and false then %>
<div style="width:10%; float:left;">
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
</div>
<% end %>
<% if has_iperf3 then %>
<div style="width:10%; float:left;">
<input style="margin: 5px 0" type="text" value="<%=iperf3_host%>" name="iperf3" /><br />
<input type="button" value="<%:Iperf3%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.iperf3)" />
</div>
<% end %>
<br style="clear:both" /><br />
</fieldset>

View file

@ -125,6 +125,7 @@ while true; do
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
# retrieve iface ip and gateway
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
#OMR_TRACKER_DEVICE_IP=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -e '@["ipv4-address"][0].address' | tr -d "\n")
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
fi