2013-03-27 08:40:10 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
|
|
WPAS=$DIR/../../wpa_supplicant/wpa_supplicant
|
2013-08-26 09:47:15 -04:00
|
|
|
WPACLI=$DIR/../../wpa_supplicant/wpa_cli
|
2013-03-27 08:40:10 -04:00
|
|
|
HAPD=$DIR/../../hostapd/hostapd
|
|
|
|
WLANTEST=$DIR/../../wlantest/wlantest
|
|
|
|
|
2013-08-24 13:33:21 -04:00
|
|
|
if [ "x$1" = "xvalgrind" ]; then
|
|
|
|
VALGRIND=y
|
|
|
|
else
|
|
|
|
unset VALGRIND
|
|
|
|
fi
|
|
|
|
|
2013-09-28 03:36:56 -04:00
|
|
|
if [ "x$1" = "xtrace" ]; then
|
|
|
|
TRACE="T"
|
|
|
|
else
|
|
|
|
TRACE=""
|
|
|
|
fi
|
|
|
|
|
2013-03-27 08:40:10 -04:00
|
|
|
$DIR/stop-wifi.sh
|
2013-03-31 09:19:12 -04:00
|
|
|
sudo modprobe mac80211_hwsim radios=5
|
2013-03-27 08:40:10 -04:00
|
|
|
mkdir -p $DIR/logs
|
|
|
|
DATE=`date +%s`
|
|
|
|
sudo ifconfig hwsim0 up
|
|
|
|
sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 &
|
2013-08-25 14:43:21 -04:00
|
|
|
sudo tcpdump -ni hwsim0 -s 2500 -w $DIR/logs/$DATE-hwsim0.dump > $DIR/logs/$DATE-tcpdump 2>&1 &
|
2013-08-24 13:33:21 -04:00
|
|
|
if [ "x$VALGRIND" = "xy" ]; then
|
|
|
|
for i in 0 1 2; do
|
2013-08-24 14:46:44 -04:00
|
|
|
chmod a+rx $WPAS
|
2013-08-24 13:33:21 -04:00
|
|
|
sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-wlan$i $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt > $DIR/logs/$DATE-log$i &
|
|
|
|
done
|
2013-08-24 14:46:44 -04:00
|
|
|
chmod a+rx $HAPD
|
2013-08-24 13:33:21 -04:00
|
|
|
sudo valgrind --log-file=$DIR/logs/$DATE-valgrind-hostapd $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
|
|
|
|
else
|
|
|
|
for i in 0 1 2; do
|
2013-09-28 03:36:56 -04:00
|
|
|
sudo $WPAS -g /tmp/wpas-wlan$i -Gadmin -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf -ddKt$TRACE > $DIR/logs/$DATE-log$i &
|
2013-08-24 13:33:21 -04:00
|
|
|
done
|
|
|
|
sudo $HAPD -ddKt -g /var/run/hostapd-global -G admin -ddKt > $DIR/logs/$DATE-hostapd &
|
|
|
|
fi
|
2013-03-27 08:40:10 -04:00
|
|
|
sleep 1
|
2013-04-26 05:36:56 -04:00
|
|
|
sudo chown $USER $DIR/logs/$DATE-hwsim0.dump
|
2013-08-24 13:33:21 -04:00
|
|
|
if [ "x$VALGRIND" = "xy" ]; then
|
|
|
|
sudo chown $USER $DIR/logs/$DATE-*valgrind*
|
|
|
|
fi
|
2013-08-26 09:47:15 -04:00
|
|
|
|
|
|
|
# wait for programs to be fully initialized
|
|
|
|
for i in 0 1 2; do
|
|
|
|
for j in `seq 1 10`; do
|
|
|
|
if $WPACLI -g /tmp/wpas-wlan$i ping | grep -q PONG; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if [ $j = "10" ]; then
|
|
|
|
echo "Could not connect to /tmp/wpas-wlan$i"
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
for j in `seq 1 10`; do
|
|
|
|
if $WPACLI -g /var/run/hostapd-global ping | grep -q PONG; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if [ $j = "10" ]; then
|
|
|
|
echo "Could not connect to /var/run/hostapd-global"
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|