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