1#! /bin/sh 2# 3# Script for test vap create+destroy when using WPA. 4# Also used to verify resources are reclaimed properly 5# on vap destroy. 6# 7# $FreeBSD: src/tools/tools/net80211/scripts/setup.updown.wpa,v 1.1 2008/04/20 20:43:42 sam Exp $ 8# 9PATH=.:$PATH 10. config 11 12BRIDGE=bridge0 13SSID=$SSID-wpa 14WLAN=wlan0 15CONF=$TMPDIR/bsd-$WLAN.conf 16 17makeconf() 18{ 19 conf=$1 20 rm -f $conf 21 cat >$1 <<EOF 22interface=$WLAN 23ctrl_interface=$HOSTAPD_CTRL_INTERFACE 24logger_syslog=-1 25logger_syslog_level=0 26logger_stdout=-1 27logger_stdout_level=0 28debug=0 29wpa=1 30wpa_key_mgmt=WPA-PSK 31wpa_passphrase=$WPA_PASSPHRASE 32wpa_pairwise=CCMP 33EOF 34} 35 36n=0 37while true; do 38 echo "---- $n"; n=`expr $n + 1` 39 ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap 40 wlandebug -i $WLAN assoc 41 ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500 42 43 ifconfig $BRIDGE create 44 ifconfig $BRIDGE addm $WIRED addm $WLAN up 45 ifconfig $WLAN up 46# ifconfig $WIRED up 47 48 makeconf $CONF 49 start_hostapd $CONF& 50 pid=$! 51 ifconfig 52 53 sleep 2 54 kill $pid 55 ifconfig $WLAN destroy; 56 ifconfig $BRIDGE destroy; 57 rm -f $CONF 58 vmstat -m | grep 80211 59 netstat -m 60 sleep 1 61done 62