From 474e6bbdd7091fa9757194026af3a11629939ffc Mon Sep 17 00:00:00 2001 From: David Yang Date: Thu, 2 Nov 2017 09:44:33 +0800 Subject: [PATCH] mwan3: add check for ping Signed-off-by: David Yang --- net/mwan3/files/usr/sbin/mwan3track | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/net/mwan3/files/usr/sbin/mwan3track b/net/mwan3/files/usr/sbin/mwan3track index 872628e2ff..4b744b9fc6 100755 --- a/net/mwan3/files/usr/sbin/mwan3track +++ b/net/mwan3/files/usr/sbin/mwan3track @@ -21,7 +21,10 @@ if_down() { validate_track_method() { case "$1" in ping) - # Assume that ping is installed + which ping 1>/dev/null 2>&1 || { + $LOG warn "Missing ping. Please install iputils-ping package or enable ping util and recompile busybox." + return 1 + } ;; arping) which arping 1>/dev/null 2>&1 || { @@ -64,8 +67,13 @@ main() { config_load mwan3 config_get track_method $1 track_method ping validate_track_method $track_method $SRC_IP || { - $LOG warn "Using ping to track interface $INTERFACE avaliability" track_method=ping + if validate_track_method $track_method; then + $LOG warn "Using ping to track interface $INTERFACE avaliability" + else + $LOG err "No track method avaliable" + exit 1 + fi } config_get reliability $1 reliability 1 config_get count $1 count 1 -- 2.30.2