2013-03-02 04:39:54 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-08-26 09:38:13 -04:00
|
|
|
if pidof wpa_supplicant hostapd > /dev/null; then
|
|
|
|
RUNNING=yes
|
|
|
|
else
|
|
|
|
RUNNING=no
|
|
|
|
fi
|
|
|
|
|
2013-03-02 04:39:54 -05:00
|
|
|
sudo killall -q hostapd
|
|
|
|
sudo killall -q wpa_supplicant
|
2013-08-26 04:28:32 -04:00
|
|
|
for i in `pidof valgrind.bin`; do
|
|
|
|
if ps $i | grep -q -E "wpa_supplicant|hostapd"; then
|
|
|
|
sudo kill $i
|
|
|
|
fi
|
|
|
|
done
|
2013-03-09 10:39:11 -05:00
|
|
|
sudo killall -q wlantest
|
2013-04-26 05:36:56 -04:00
|
|
|
sudo killall -q tcpdump
|
2013-03-09 10:39:11 -05:00
|
|
|
if grep -q hwsim0 /proc/net/dev; then
|
|
|
|
sudo ifconfig hwsim0 down
|
|
|
|
fi
|
2013-08-26 09:38:13 -04:00
|
|
|
|
|
|
|
if [ "$RUNNING" = "yes" ]; then
|
|
|
|
# give some time for hostapd and wpa_supplicant to complete deinit
|
|
|
|
sleep 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
if pidof wpa_supplicant hostapd > /dev/null; then
|
|
|
|
echo "wpa_supplicant/hostapd did not exit - try to force them to die"
|
|
|
|
sudo killall -9 -q hostapd
|
|
|
|
sudo killall -9 -q wpa_supplicant
|
|
|
|
sleep 5
|
|
|
|
fi
|
|
|
|
|
|
|
|
for i in `pidof valgrind.bin`; do
|
|
|
|
if ps $i | grep -q -E "wpa_supplicant|hostapd"; then
|
|
|
|
echo "wpa_supplicant/hostapd(valgrind) did not exit - try to force it to die"
|
|
|
|
sudo kill -9 $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-03-02 04:39:54 -05:00
|
|
|
if grep -q mac80211_hwsim /proc/modules ; then
|
|
|
|
sudo rmmod mac80211_hwsim
|
2013-08-26 09:38:13 -04:00
|
|
|
# wait at the end to avoid issues starting something new immediately after
|
|
|
|
# this script returns
|
|
|
|
sleep 1
|
2013-03-02 04:39:54 -05:00
|
|
|
fi
|