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 <wangchen41@xiaomi.com>
This commit is contained in:
wangchen 2024-03-27 16:47:03 +08:00 committed by Xiang Xiao
parent 4bcb33926e
commit 17a46ee549

View File

@ -520,11 +520,19 @@ init()
clean() clean()
{ {
[ -z "$1" ] && {
echo "Missing the default wan interface."
exit -1
}
recovery_to_init recovery_to_init
cur_mode=$(get_var mode $DEFCONF_FILE) cur_mode=$(get_var mode $DEFCONF_FILE)
[ "$cur_mode" = "hwsim" ] && modprobe -r mac80211_hwsim [ "$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 -fr $RUN_DIR
rm -f $UDHCPC_SCRIPT rm -f $UDHCPC_SCRIPT
} }
@ -532,7 +540,7 @@ clean()
usage() usage()
{ {
echo "$(basename $SOURCE) (rename <old> <new> |" echo "$(basename $SOURCE) (rename <old> <new> |"
echo -e "\t init <wan> <mode> |clean |" echo -e "\t init <wan> <mode> |clean <wan> |"
echo -e "\t start_wpa <wlan0> |stop_wpa |" echo -e "\t start_wpa <wlan0> |stop_wpa |"
echo -e "\t start_hostapd <wlan0> |stop_hostapd |" echo -e "\t start_hostapd <wlan0> |stop_hostapd |"
echo -e "\t start_udhcpc <wlan0> |stop_udhcpc |" echo -e "\t start_udhcpc <wlan0> |stop_udhcpc |"
@ -552,7 +560,7 @@ get_script_path $0
case $1 in case $1 in
init) init $2 $3;; init) init $2 $3;;
clean) clean;; clean) clean $2;;
start_bridge) start_bridge $2;; start_bridge) start_bridge $2;;
stop_bridge) stop_bridge $2;; stop_bridge) stop_bridge $2;;
start_hwsim) start_hwsim $2 $3;; start_hwsim) start_hwsim $2 $3;;