diff --git a/tools/simwifi/sim_wifi.sh b/tools/simwifi/sim_wifi.sh index 5b7c785ece..4088bbb160 100755 --- a/tools/simwifi/sim_wifi.sh +++ b/tools/simwifi/sim_wifi.sh @@ -520,11 +520,19 @@ init() clean() { + [ -z "$1" ] && { + echo "Missing the default wan interface." + exit -1 + } + recovery_to_init cur_mode=$(get_var mode $DEFCONF_FILE) [ "$cur_mode" = "hwsim" ] && modprobe -r mac80211_hwsim + echo "defwan:$1" > $DEFCONF_FILE + [ -n "$1" -a -n "$(ifconfig | grep $1)" ] && stop_bridge $1 + rm -fr $RUN_DIR rm -f $UDHCPC_SCRIPT } @@ -532,7 +540,7 @@ clean() usage() { echo "$(basename $SOURCE) (rename |" - echo -e "\t init |clean |" + echo -e "\t init |clean |" echo -e "\t start_wpa |stop_wpa |" echo -e "\t start_hostapd |stop_hostapd |" echo -e "\t start_udhcpc |stop_udhcpc |" @@ -552,7 +560,7 @@ get_script_path $0 case $1 in init) init $2 $3;; - clean) clean;; + clean) clean $2;; start_bridge) start_bridge $2;; stop_bridge) stop_bridge $2;; start_hwsim) start_hwsim $2 $3;;