1#! /bin/sh
2#
3# Script for testing multi-bss open+WPA1+WPA2.
4#
5# $FreeBSD: src/tools/tools/net80211/scripts/setup.mixed,v 1.1 2008/04/20 20:43:42 sam Exp $
6#
7PATH=.:$PATH
8. config
9
10BRIDGE=bridge0
11WPA_WLAN=wlan0
12CONF=$TMPDIR/bsd-$WPA_WLAN.conf
13WPA_SSID=$SSID-wpa
14OPEN_WLAN=wlan1
15
16makeconf()
17{
18	conf=$1
19	rm -f $conf
20	cat >$conf <<EOF
21interface=$2
22ctrl_interface=$HOSTAPD_CTRL_INTERFACE
23logger_syslog=-1
24logger_syslog_level=0
25logger_stdout=-1
26logger_stdout_level=0
27debug=4
28wpa=3
29wpa_key_mgmt=WPA-PSK
30wpa_passphrase=$WPA_PASSPHRASE
31wpa_pairwise=CCMP
32EOF
33}
34
35trap "ifconfig $BRIDGE destroy; ifconfig $WPA_WLAN destroy; \
36     ifconfig $OPEN_WLAN destroy; rm -f $CONF" 2
37
38ifconfig $WPA_WLAN create wlandev $WIRELESS wlanmode hostap bssid
39#wlandebug -i $WPA_WLAN assoc+crypto
40wlandebug -i $WPA_WLAN state+assoc+11n
41ifconfig $WPA_WLAN ssid $WPA_SSID
42ifconfig $WPA_WLAN channel $CHANNEL
43ifconfig $WPA_WLAN mtu 1500		# NB: if_bridge requires matching mtu's
44
45ifconfig $OPEN_WLAN create wlandev $WIRELESS wlanmode hostap bssid
46#wlandebug -i $OPEN_WLAN assoc+crypto
47wlandebug -i $OPEN_WLAN state+assoc+11n
48ifconfig $OPEN_WLAN ssid $SSID
49ifconfig $OPEN_WLAN channel $CHANNEL
50ifconfig $OPEN_WLAN mtu 1500		# NB: if_bridge requires matching mtu's
51
52ifconfig $BRIDGE create
53ifconfig $BRIDGE addm $WIRED addm $WPA_WLAN addm $OPEN_WLAN up
54ifconfig $WPA_WLAN up
55ifconfig $OPEN_WLAN up
56ifconfig $WIRED up
57
58ifconfig
59
60makeconf $CONF $WPA_WLAN
61#athdebug -i $WIRELESS keycache
62start_hostapd -K $CONF
63