From 7139a5db51ba29c4cb5ffb720c5ed0d3d7c5d2d7 Mon Sep 17 00:00:00 2001 From: "Ycarus (Yannick Chabanois)" Date: Wed, 13 Dec 2023 10:57:05 +0100 Subject: [PATCH] Fix on omr-test-speed for fasttest --- openmptcprouter/files/bin/omr-test-speed | 10 ++++++++-- openmptcprouter/files/bin/omr-test-speedv6 | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/openmptcprouter/files/bin/omr-test-speed b/openmptcprouter/files/bin/omr-test-speed index 36480fcb6..a1de53264 100755 --- a/openmptcprouter/files/bin/omr-test-speed +++ b/openmptcprouter/files/bin/omr-test-speed @@ -13,9 +13,10 @@ if [ "$1" = "fasttest" ]; then fi for i in $@; do :; done INTERFACE="$i" +[ "$INTERFACE" = "forcevps" ] || [ "$INTERFACE" = "fasttest" ] && INTERFACE="" [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { - echo "You must use a real interface. You wan find them using 'ip a' for example" + echo "You must use a real interface. You wan find them using 'ip a' for example (not $INTERFACE)" exit 0 } @@ -41,7 +42,12 @@ done [ "$FASTTEST" = true ] || echo "Best server is $HOST, running test:" trap : HUP INT TERM if [ -z "$INTERFACE" ]; then - curl -4 -o /dev/null $HOST || echo + if [ "$FASTTEST" = true ]; then + avg_speed=$(curl -4 --max-time 10 -o /dev/null -qfsS -w '%{speed_download}' $HOST 2>/dev/null) + echo "$avg_speed" + else + curl -4 -o /dev/null $HOST || echo + fi else [ -n "$(tc qdisc show dev $INTERFACE | grep ingress)" ] && /etc/init.d/sqm stop $INTERFACE domain=$(echo $HOST | awk -F/ '{print $3}') diff --git a/openmptcprouter/files/bin/omr-test-speedv6 b/openmptcprouter/files/bin/omr-test-speedv6 index 62653aea7..07fa36c54 100755 --- a/openmptcprouter/files/bin/omr-test-speedv6 +++ b/openmptcprouter/files/bin/omr-test-speedv6 @@ -1,5 +1,4 @@ #!/bin/sh -#!/bin/sh # (c) Yannick Chabanois (ycarus@zugaina.org) for OpenMPTCProuter # # @@ -14,6 +13,7 @@ if [ "$1" = "fasttest" ]; then fi for i in $@; do :; done INTERFACE="$i" +[ "$INTERFACE" = "forcevps" ] || [ "$INTERFACE" = "fasttest" ] && INTERFACE="" [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { echo "You must use a real interface. You wan find them using 'ip a' for example"