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