From 17a46ee549a8a805368ab7739621a76d8bb9ed1d Mon Sep 17 00:00:00 2001 From: wangchen Date: Wed, 27 Mar 2024 16:47:03 +0800 Subject: [PATCH] sim_wifi.sh:add stop_bridge script to the command(./tools/simwifi/sim_wifi.sh clean interface) stop_bridge script will excute simhostroute.sh interface off command example:sudo ./tools/simwifi/sim_wifi.sh clean eno1 Signed-off-by: wangchen --- tools/simwifi/sim_wifi.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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;;