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 -n $LOGDIR/hwsim0.pcapng -c -d > $LOGDIR/hwsim0 &
61 sudo $(printf -- "$VALGRIND_WPAS" $i) $WPAS -g /tmp/wpas-wlan$i -G$GROUP -Dnl80211 -iwlan$i -c $DIR/p2p$i.conf \
62 $(printf -- "$CONCURRENT_ARGS" $i) -ddKt$TRACE > $LOGDIR/log$i &
64 sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -ddKt > $LOGDIR/hostapd &
67 sudo chown -f $USER $LOGDIR/hwsim0.pcapng
68 if [ "x$VALGRIND" = "xy" ]; then
69 sudo chown -f $USER $LOGDIR/*valgrind*
72 if [ -x $HLR_AUC_GW ]; then
73 $HLR_AUC_GW -m $DIR/auth_serv/hlr_auc_gw.milenage_db > $LOGDIR/hlr_auc_gw &
76 $HAPD -ddKt $DIR/auth_serv/as.conf > $LOGDIR/auth_serv &
78 # wait for programs to be fully initialized
80 for j in `seq 1 10`; do
81 if $WPACLI -g /tmp/wpas-wlan$i ping | grep -q PONG; then
84 if [ $j = "10" ]; then
85 echo "Could not connect to /tmp/wpas-wlan$i"
92 for j in `seq 1 10`; do
93 if $WPACLI -g /var/run/hostapd-global ping | grep -q PONG; then
96 if [ $j = "10" ]; then
97 echo "Could not connect to /var/run/hostapd-global"