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