Skip to content

Commit

Permalink
mwan3: add check_quality for httping
Browse files Browse the repository at this point in the history
Example output of TRACK_OUTPUT (httping -c 1 -t 1 'http://www.google.co.uk'):

PING www.google.co.uk:80 (/):
connected to 142.250.200.35:80 (654 bytes), seq=0 time=136.58 ms
--- http://www.google.co.uk/ ping statistics ---
1 connects, 1 ok, 0.00% failed, time 1137 ms
round-trip min/avg/max = 136.6/136.6/136.6 ms

Signed-off-by: William Solichin <[email protected]>
  • Loading branch information
wrsolichin committed Sep 30, 2024
1 parent dcea616 commit 63899f7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion net/mwan3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=mwan3
PKG_VERSION:=2.11.15
PKG_VERSION:=2.11.16
PKG_RELEASE:=3
PKG_MAINTAINER:=Florian Eckert <[email protected]>, \
Aaron Goodman <[email protected]>
Expand Down
30 changes: 24 additions & 6 deletions net/mwan3/files/usr/sbin/mwan3track
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,32 @@ main() {
result=$?
;;
httping)
if [ "$httping_ssl" -eq 1 ]; then
WRAP httping -c $count -t $timeout -q "https://$track_ip" &> /dev/null &
if [ $check_quality -eq 0 ]; then
if [ "$httping_ssl" -eq 1 ]; then
WRAP httping -c $count -t $timeout -q "https://$track_ip" &> /dev/null &
else
WRAP httping -c $count -t $timeout -q "http://$track_ip" &> /dev/null &
fi
TRACK_PID=$!
wait $TRACK_PID
result=$?
else
WRAP httping -c $count -t $timeout -q "http://$track_ip" &> /dev/null &
if [ "$httping_ssl" -eq 1 ]; then
WRAP httping -c $count -t $timeout "https://$track_ip" 2> /dev/null > $TRACK_OUTPUT &
else
WRAP httping -c $count -t $timeout "http://$track_ip" 2> /dev/null > $TRACK_OUTPUT &
fi
TRACK_PID=$!
wait $TRACK_PID
ping_status=$?
loss="$(sed $TRACK_OUTPUT -ne 's/.* \([0-9]\+\).*% failed.*/\1/p')"
if [ "$ping_status" -ne 0 ] || [ "$loss" -eq 100 ]; then
latency=999999
loss=100
else
latency="$(sed $TRACK_OUTPUT -ne 's%\(rtt\|round-trip\).* = [^/]*/\([0-9]\+\).*%\2%p')"
fi
fi
TRACK_PID=$!
wait $TRACK_PID
result=$?
;;
nping-*)
WRAP nping -c $count $track_ip --${FAMILY#nping-} > $TRACK_OUTPUT &
Expand Down

0 comments on commit 63899f7

Please sign in to comment.