nrelease - fix/improve livecd
[dragonfly.git] / tools / tools / net80211 / scripts / setup.wpa2.tkip
1 #! /bin/sh
2 #
3 # Script for testing WPA2 w/ TKIP.
4 #
5 # $FreeBSD: src/tools/tools/net80211/scripts/setup.wpa2.tkip,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 SSID=$SSID-wpa
13 CONF=$TMPDIR/bsd-$WLAN.conf
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=2
28 wpa_key_mgmt=WPA-PSK
29 wpa_passphrase=$WPA_PASSPHRASE
30 wpa_pairwise=TKIP
31 EOF
32 }
33
34 trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
35         rm -f $CONF" 2
36
37 #mwldebug -i $WIRELESS hal
38 ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
39 #wlandebug -i $WLAN assoc+crypto
40 wlandebug -i $WLAN assoc
41 ifconfig $WLAN ssid $SSID
42 ifconfig $WLAN channel $CHANNEL
43 ifconfig $WLAN mtu 1500         # NB: if_bridge requires matching mtu's
44
45 ifconfig $BRIDGE create
46 ifconfig $BRIDGE addm $WIRED addm $WLAN up
47 ifconfig $WLAN up
48 ifconfig $WIRED up
49
50 ifconfig
51
52 makeconf $CONF
53 #mwldebug -i $WIRELESS keycache
54 start_hostapd -K $CONF