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:
parent
338c8865ec
commit
8dfbd211ae
3 changed files with 18 additions and 1 deletions
|
@ -153,6 +153,9 @@ function index()
|
||||||
page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil)
|
page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil)
|
||||||
page.leaf = true
|
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 = entry({"admin", "network", "diag_speedtest"}, post("diag_speedtest"), nil)
|
||||||
page.leaf = true
|
page.leaf = true
|
||||||
-- end
|
-- end
|
||||||
|
@ -431,6 +434,10 @@ function diag_traceroute6(addr)
|
||||||
diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1", addr)
|
diag_command("traceroute6 -q 1 -w 2 -n %q 2>&1", addr)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function diag_iperf3(addr)
|
||||||
|
diag_command("iperf3 -c %q 2>&1", addr)
|
||||||
|
end
|
||||||
|
|
||||||
function diag_speedtest(addr)
|
function diag_speedtest(addr)
|
||||||
if addr then
|
if addr then
|
||||||
diag_command("speedtestc --server %q 2>&1", addr)
|
diag_command("speedtestc --server %q 2>&1", addr)
|
||||||
|
|
|
@ -10,10 +10,12 @@ local fs = require "nixio.fs"
|
||||||
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
|
local has_ping6 = fs.access("/bin/ping6") or fs.access("/usr/bin/ping6")
|
||||||
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
|
local has_traceroute6 = fs.access("/usr/bin/traceroute6")
|
||||||
local has_speedtest = fs.access("/usr/sbin/speedtestc")
|
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 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 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 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>
|
<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)" />
|
<input type="button" value="<%:Nslookup%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.nslookup)" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if has_speedtest then %>
|
<% if has_speedtest and false then %>
|
||||||
<div style="width:10%; float:left;">
|
<div style="width:10%; float:left;">
|
||||||
<input style="margin: 5px 0" type="text" value="" name="speedtest" placeholder="alternate server" /><br />
|
<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)" />
|
<input type="button" value="<%:Speedtest%>" class="cbi-button cbi-button-apply" onclick="update_status(this.form.speedtest)" />
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% 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 />
|
<br style="clear:both" /><br />
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -125,6 +125,7 @@ while true; do
|
||||||
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
||||||
# retrieve iface ip and gateway
|
# 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=$(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
|
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")
|
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue