diff options
author | Aaron Goodman <aaronjg@stanford.edu> | 2020-10-11 18:43:56 -0400 |
---|---|---|
committer | Aaron Goodman <aaronjg@stanford.edu> | 2020-10-16 09:55:40 -0400 |
commit | 1990a90702515aead6412749fb6aafb21136112d (patch) | |
tree | 9fb7a26fea2ef49f930aff5d08871d6872d1ca59 /net/mwan3/files | |
parent | d49ca29eca7c1ccc930ceceda1c8086c3cfaa198 (diff) |
mwan3: add back support for iputils ping
With the new wrapper code, we can override the broken binding behavior of
iputils ping v20101006.
Signed-off-by: Aaron Goodman <aaronjg@stanford.edu>
Diffstat (limited to 'net/mwan3/files')
-rwxr-xr-x | net/mwan3/files/usr/sbin/mwan3track | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 288fcd35e..8334209fe 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -6,7 +6,6 @@ INTERFACE="" DEVICE="" -PING="/bin/ping" IFDOWN_EVENT=0 IFUP_EVENT=0 @@ -47,10 +46,19 @@ if_up() { validate_track_method() { case "$1" in ping) - [ -x "$PING" ] || { - LOG warn "Missing ping. Please enable ping util and recompile busybox." + if [ -x "/usr/bin/ping" ] && [ "$(/usr/bin/ping -V | grep -o '[0-9]*$')" -gt 20150519 ]; then + # -4 option added in iputils c3e68ac6 + PING="/usr/bin/ping -${FAMILY#ipv}" + elif [ "$FAMILY" = "ipv6" ] && [ -x "/usr/bin/ping6" ]; then + PING="/usr/bin/ping6" + elif [ "$FAMILY" = "ipv4" ] && [ -x "/usr/bin/ping" ]; then + PING="/usr/bin/ping" + elif [ -x "/bin/ping" ]; then + PING="/bin/ping -${FAMILY#ipv}" + else + LOG warn "Missing ping. Please enable BUSYBOX_DEFAULT_PING and recompile busybox or install iputils-ping package." return 1 - } + fi ;; arping) command -v arping 1>/dev/null 2>&1 || { @@ -218,12 +226,12 @@ main() { case "$track_method" in ping) if [ $check_quality -eq 0 ]; then - WRAP $PING -${FAMILY#ipv} -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null & + WRAP $PING -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null & TRACK_PID=$! wait $TRACK_PID result=$? else - WRAP $PING -${family#ipv} -c $count -W $timeout -s $size -t $max_ttl -q $track_ip 2>/dev/null > $TRACK_OUTPUT & + WRAP $PING -c $count -W $timeout -s $size -t $max_ttl -q $track_ip 2>/dev/null > $TRACK_OUTPUT & TRACK_PID=$! wait $TRACK_PID ping_status=$? |