]> git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/stop.sh
tests: FT pull PMK-R1
[thirdparty/hostap.git] / tests / hwsim / stop.sh
1 #!/bin/sh
2
3 if pidof wpa_supplicant hostapd valgrind.bin hlr_auc_gw > /dev/null; then
4 RUNNING=yes
5 else
6 RUNNING=no
7 fi
8
9 sudo killall -q hostapd
10 sudo killall -q wpa_supplicant
11 for i in `pidof valgrind.bin`; do
12 if ps $i | grep -q -E "wpa_supplicant|hostapd"; then
13 sudo kill $i
14 fi
15 done
16 sudo killall -q wlantest
17 if grep -q hwsim0 /proc/net/dev; then
18 sudo ifconfig hwsim0 down
19 fi
20
21 sudo killall -q hlr_auc_gw
22
23 if [ "$RUNNING" = "yes" ]; then
24 # give some time for hostapd and wpa_supplicant to complete deinit
25 sleep 0.5
26 for i in `seq 1 5`; do
27 if pidof wpa_supplicant hostapd valgrind.bin hlr_auc_gw > /dev/null; then
28 echo "Waiting for processes to exit (1)"
29 sleep 1
30 else
31 break
32 fi
33 done
34 fi
35
36 if pidof wpa_supplicant hostapd hlr_auc_gw > /dev/null; then
37 echo "wpa_supplicant/hostapd/hlr_auc_gw did not exit - try to force them to die"
38 sudo killall -9 -q hostapd
39 sudo killall -9 -q wpa_supplicant
40 sudo killall -9 -q hlr_auc_gw
41 for i in `seq 1 5`; do
42 if pidof wpa_supplicant hostapd hlr_auc_gw > /dev/null; then
43 echo "Waiting for processes to exit (2)"
44 sleep 1
45 else
46 break
47 fi
48 done
49 fi
50
51 for i in `pidof valgrind.bin`; do
52 if ps $i | grep -q -E "wpa_supplicant|hostapd"; then
53 echo "wpa_supplicant/hostapd(valgrind) did not exit - try to force it to die"
54 sudo kill -9 $i
55 fi
56 done
57
58 count=0
59 for i in /tmp/wpas-wlan0 /tmp/wpas-wlan1 /tmp/wpas-wlan2 /tmp/wpas-wlan5 /var/run/hostapd-global /tmp/hlr_auc_gw.sock /tmp/wpa_ctrl_* /tmp/eap_sim_db_*; do
60 count=$(($count + 1))
61 if [ $count -lt 7 -a -e $i ]; then
62 echo "Waiting for ctrl_iface $i to disappear"
63 sleep 1
64 fi
65 if [ -e $i ]; then
66 echo "Control interface file $i exists - remove it"
67 sudo rm $i
68 fi
69 done
70
71 if grep -q mac80211_hwsim /proc/modules 2>/dev/null ; then
72 sudo rmmod mac80211_hwsim
73 sudo rmmod mac80211
74 sudo rmmod cfg80211
75 # wait at the end to avoid issues starting something new immediately after
76 # this script returns
77 sleep 1
78 fi