Browse Source

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>
lilik-openwrt-22.03
Aaron Goodman 4 years ago
parent
commit
1990a90702
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      net/mwan3/files/usr/sbin/mwan3track

+ 14
- 6
net/mwan3/files/usr/sbin/mwan3track View File

@ -6,7 +6,6 @@
INTERFACE="" INTERFACE=""
DEVICE="" DEVICE=""
PING="/bin/ping"
IFDOWN_EVENT=0 IFDOWN_EVENT=0
IFUP_EVENT=0 IFUP_EVENT=0
@ -47,10 +46,19 @@ if_up() {
validate_track_method() { validate_track_method() {
case "$1" in case "$1" in
ping) 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 return 1
}
fi
;; ;;
arping) arping)
command -v arping 1>/dev/null 2>&1 || { command -v arping 1>/dev/null 2>&1 || {
@ -218,12 +226,12 @@ main() {
case "$track_method" in case "$track_method" in
ping) ping)
if [ $check_quality -eq 0 ]; then 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=$! TRACK_PID=$!
wait $TRACK_PID wait $TRACK_PID
result=$? result=$?
else 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=$! TRACK_PID=$!
wait $TRACK_PID wait $TRACK_PID
ping_status=$? ping_status=$?


Loading…
Cancel
Save