3 DIR="$( cd "$( dirname "$0" )" && pwd )"
4 WPAS=$DIR/../../wpa_supplicant/wpa_supplicant
5 WPACLI=$DIR/../../wpa_supplicant/wpa_cli
6 HAPD=$DIR/../../hostapd/hostapd
7 WLANTEST=$DIR/../../wlantest/wlantest
8 HLR_AUC_GW=$DIR/../../hostapd/hlr_auc_gw
10 if [ -z "$LOGDIR" ] ; then
11 LOGDIR="$DIR/logs/$(date +%s)"
15 if groups | tr ' ' "\n" | grep -q ^admin$; then
21 if [ "$1" = "concurrent" ]; then
23 CONCURRENT_ARGS="-N -Dnl80211 -ista%d -c $DIR/sta-dummy.conf"
30 if [ "$1" = "valgrind" ]; then
32 VALGRIND_WPAS="valgrind --log-file=$LOGDIR/valgrind-wlan%d"
33 VALGRIND_HAPD="valgrind --log-file=$LOGDIR/valgrind-hostapd"
43 if [ "$1" = "trace" ]; then
51 test -f /proc/modules && sudo modprobe mac80211_hwsim radios=5
52 if [ "$CONCURRENT" = "y" ]; then
53 sudo iw wlan0 interface add sta0 type station
54 sudo iw wlan1 interface add sta1 type station
55 sudo iw wlan2 interface add sta2 type station
58 sudo ifconfig hwsim0 up
59 sudo $WLANTEST -i hwsim0 -c -d > $LOGDIR/hwsim0 &
60 sudo tcpdump -ni hwsim0 -s 2500 -w $LOGDIR/hwsim0.dump > $LOGDIR/tcpdump 2>&1 &
62 sudo $(printf -- "$VALGRIND_WPAS" $i) $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf \
63 $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE > $LOGDIR/log$i &
65 sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/hostapd &
68 sudo chown -f $USER $LOGDIR/hwsim0.dump
69 if [ "x$VALGRIND" = "xy" ]; then
70 sudo chown -f $USER $LOGDIR/*valgrind*
73 if [ -x $HLR_AUC_GW ]; then
74 $HLR_AUC_GW -m $DIR/auth_serv/hlr_auc_gw.milenage_db > $LOGDIR/hlr_auc_gw &
77 $HAPD -ddKt $DIR/auth_serv/as.conf > $LOGDIR/auth_serv &
79 # wait for programs to be fully initialized
81 for j in `seq 1 10`; do
82 if $WPACLI -g /tmp/wpas-wlan$i ping | grep -q PONG; then
85 if [ $j = "10" ]; then
86 echo "Could not connect to /tmp/wpas-wlan$i"
93 for j in `seq 1 10`; do
94 if $WPACLI -g /var/run/hostapd-global ping | grep -q PONG; then
97 if [ $j = "10" ]; then
98 echo "Could not connect to /var/run/hostapd-global"