summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2008-04-20 20:43:42 +0000
committersam <sam@FreeBSD.org>2008-04-20 20:43:42 +0000
commitcf08febf945a6fe3be3060604cad02b9293b6de7 (patch)
tree5c1dfb42eb41d8f1e5e64613138622be952f8cb5 /tools
parentfb524bd0267c7aef55be1ee0b6a07a425d7ad454 (diff)
downloadFreeBSD-src-cf08febf945a6fe3be3060604cad02b9293b6de7.zip
FreeBSD-src-cf08febf945a6fe3be3060604cad02b9293b6de7.tar.gz
test scripts for vaps and other 802.11 features
Supported by: Hobnob and Marvell
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/net80211/scripts/config54
-rw-r--r--tools/tools/net80211/scripts/setup.dfs25
-rw-r--r--tools/tools/net80211/scripts/setup.fixed17
-rw-r--r--tools/tools/net80211/scripts/setup.local16
-rw-r--r--tools/tools/net80211/scripts/setup.mixed62
-rw-r--r--tools/tools/net80211/scripts/setup.simple16
-rw-r--r--tools/tools/net80211/scripts/setup.simple224
-rw-r--r--tools/tools/net80211/scripts/setup.sta15
-rw-r--r--tools/tools/net80211/scripts/setup.tsn55
-rw-r--r--tools/tools/net80211/scripts/setup.updown26
-rw-r--r--tools/tools/net80211/scripts/setup.updown.wpa61
-rw-r--r--tools/tools/net80211/scripts/setup.wds21
-rw-r--r--tools/tools/net80211/scripts/setup.wdsmain40
-rw-r--r--tools/tools/net80211/scripts/setup.wdsrelay35
-rw-r--r--tools/tools/net80211/scripts/setup.wep21
-rw-r--r--tools/tools/net80211/scripts/setup.wpa53
-rw-r--r--tools/tools/net80211/scripts/setup.wpa1.aes53
-rw-r--r--tools/tools/net80211/scripts/setup.wpa1.tkip53
-rw-r--r--tools/tools/net80211/scripts/setup.wpa254
-rw-r--r--tools/tools/net80211/scripts/setup.wpa2.tkip54
20 files changed, 755 insertions, 0 deletions
diff --git a/tools/tools/net80211/scripts/config b/tools/tools/net80211/scripts/config
new file mode 100644
index 0000000..cff9134
--- /dev/null
+++ b/tools/tools/net80211/scripts/config
@@ -0,0 +1,54 @@
+#
+# Common configuration settings for vap test scripts.
+#
+# $FreeBSD$
+#
+
+#
+# Auto-detect WIRED and WIRELESS.
+# NB: takes first device of each type; to fix
+# either specify them before . config.
+#
+for i in `ifconfig -l`; do
+ case $i in
+ bge*|em*|re*|nfe*|fxp*|vr*|msk*|tx*|dc*)
+ test -z "$WIRED" && WIRED=$i
+ ;;
+ ath*|ral*|zyd*|ural*|rum*|bwi*)
+ test -z "$WIRELESS" && WIRELESS=$i
+ ;;
+ esac
+done
+test -z "$WIRED" && { echo "No wired device detected!"; exit; }
+test -z "$WIRELESS" && { echo "No wireless device detected!"; exit; }
+
+# fixed channel
+#CHANNEL=${1:-36:a}
+#CHANNEL=${1:-36:ht/20}
+CHANNEL=${1:-36}
+#CHANNEL=${1:-6:g}
+#CHANNEL=${1:-6:b}
+
+# default WPA passphrase
+test -z "$WPA_PASSPHRASE" && WPA_PASSPHRASE='I am not a geek'
+
+# default ssid for ap vaps
+test -z "$SSID" && SSID=freebsd-ap
+
+# directory to create files like hostapd.conf
+test -z "$TMPDIR" && TMPDIR=.
+
+test -z "$HOSTAPD_CTRL_INTERFACE" && HOSTAPD_CTRL_INTERFACE=/var/run/hostapd
+
+# applications (may want ../ for wlan test apps)
+test -z "$HOSTAPD" && HOSTAPD=/usr/sbin/hostapd
+test -z "$WLANWATCH" && WLANWATCH=/usr/local/bin/wlanwatch
+test -z "$WLANWDS" && WLANWDS=/usr/local/bin/wlanwds
+
+start_hostapd()
+{
+ for m in wlan_xauth wlan_ccmp wlan_tkip wlan_wep; do
+ kldstat -q -m $m || kldload $m
+ done
+ $HOSTAPD $*
+}
diff --git a/tools/tools/net80211/scripts/setup.dfs b/tools/tools/net80211/scripts/setup.dfs
new file mode 100644
index 0000000..a771977
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.dfs
@@ -0,0 +1,25 @@
+#! /bin/sh
+#
+# Scrip for testing DFS; setup an AP vap on a DFS channel
+# then simulate a radar event and verify operation.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+COUNTRY=dk
+CHANNEL=64:a
+
+sysctl net.wlan.nol_timeout=60
+#mwldebug state+node+reset+xmit+recv+beacon+hal+hal2
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN country $COUNTRY
+ifconfig $WLAN ssid $SSID-$COUNTRY channel $CHANNEL mtu 1500
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ifconfig $WIRED up
+wlandebug -i $WLAN state+scan+assoc+11n
+ifconfig $WLAN up
+
+sleep 5; sysctl dev.mwl.0.radar=1
diff --git a/tools/tools/net80211/scripts/setup.fixed b/tools/tools/net80211/scripts/setup.fixed
new file mode 100644
index 0000000..d000800
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.fixed
@@ -0,0 +1,17 @@
+#! /bin/sh
+#
+# Script for testing fixed xmit rate handling.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+ifconfig $WLAN ucastrate 24:a ucastrate 7
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ifconfig $WIRED up
+wlandebug -i $WLAN state+scan+assoc
+ifconfig $WLAN up
diff --git a/tools/tools/net80211/scripts/setup.local b/tools/tools/net80211/scripts/setup.local
new file mode 100644
index 0000000..f56e9d5
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.local
@@ -0,0 +1,16 @@
+#! /bin/sh
+#
+# Script for testing traffic to the local host (as opposed to bridged).
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+ifconfig $WIRED down delete
+route flush
+wlandebug -i $WLAN state+scan+assoc+11n
+#mwldebug tso
+ifconfig $WLAN 192.168.0.21/24
diff --git a/tools/tools/net80211/scripts/setup.mixed b/tools/tools/net80211/scripts/setup.mixed
new file mode 100644
index 0000000..423c534
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.mixed
@@ -0,0 +1,62 @@
+#! /bin/sh
+#
+# Script for testing multi-bss open+WPA1+WPA2.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WPA_WLAN=wlan0
+CONF=$TMPDIR/bsd-$WPA_WLAN.conf
+WPA_SSID=$SSID-wpa
+OPEN_WLAN=wlan1
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$conf <<EOF
+interface=$2
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=3
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=CCMP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WPA_WLAN destroy; \
+ ifconfig $OPEN_WLAN destroy; rm -f $CONF" 2
+
+ifconfig $WPA_WLAN create wlandev $WIRELESS wlanmode hostap bssid
+#wlandebug -i $WPA_WLAN assoc+crypto
+wlandebug -i $WPA_WLAN state+assoc+11n
+ifconfig $WPA_WLAN ssid $WPA_SSID
+ifconfig $WPA_WLAN channel $CHANNEL
+ifconfig $WPA_WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $OPEN_WLAN create wlandev $WIRELESS wlanmode hostap bssid
+#wlandebug -i $OPEN_WLAN assoc+crypto
+wlandebug -i $OPEN_WLAN state+assoc+11n
+ifconfig $OPEN_WLAN ssid $SSID
+ifconfig $OPEN_WLAN channel $CHANNEL
+ifconfig $OPEN_WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WPA_WLAN addm $OPEN_WLAN up
+ifconfig $WPA_WLAN up
+ifconfig $OPEN_WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF $WPA_WLAN
+#athdebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.simple b/tools/tools/net80211/scripts/setup.simple
new file mode 100644
index 0000000..57c661a
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.simple
@@ -0,0 +1,16 @@
+#! /bin/sh
+#
+# Script for testing simple (single bss) ap operation.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ifconfig $WIRED up
+wlandebug -i $WLAN state+scan+assoc+11n
+ifconfig $WLAN up
diff --git a/tools/tools/net80211/scripts/setup.simple2 b/tools/tools/net80211/scripts/setup.simple2
new file mode 100644
index 0000000..7b030a9
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.simple2
@@ -0,0 +1,24 @@
+#! /bin/sh
+#
+# Script for testing multi-bss ap operation.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+athdebug state
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN ssid $SSID-1 channel $CHANNEL mtu 1500
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ifconfig $WIRED up
+wlandebug -i $WLAN state+scan+assoc
+ifconfig $WLAN up
+
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS bssid`
+#ifconfig $WLAN ssid $SSID-2 channel $CHANNEL mtu 1500
+ifconfig $WLAN ssid $SSID-2 mtu 1500 -ht
+ifconfig $BRIDGE addm $WLAN
+wlandebug -i $WLAN state+scan+assoc
+ifconfig $WLAN up
diff --git a/tools/tools/net80211/scripts/setup.sta b/tools/tools/net80211/scripts/setup.sta
new file mode 100644
index 0000000..570aaa5
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.sta
@@ -0,0 +1,15 @@
+#! /bin/sh
+#
+# Script for testing simple station mode operation.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+SSID=${1:-MarvellAP8x}
+
+WLAN=`ifconfig wlan create wlandev $WIRELESS`
+ifconfig $WLAN -ampdutx
+ifconfig $WLAN ssid $SSID up
+ifconfig $WIRED down delete
diff --git a/tools/tools/net80211/scripts/setup.tsn b/tools/tools/net80211/scripts/setup.tsn
new file mode 100644
index 0000000..c5b9063
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.tsn
@@ -0,0 +1,55 @@
+#! /bin/sh
+#
+# Script for testing TSN support.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+SSID=$SSID-tsn
+WLAN=wlan0
+CONF=$TMPDIR/tsn-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=1
+wpa_pairwise=TKIP
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+tsn=1
+wep_key0=0123456789
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 0
+
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN state+assoc+11n+crypto
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+ifconfig $WLAN tsn
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#mwldebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.updown b/tools/tools/net80211/scripts/setup.updown
new file mode 100644
index 0000000..72a2970
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.updown
@@ -0,0 +1,26 @@
+#! /bin/sh
+#
+# Script for test vap create+destroy. Also used to verify
+# resources are reclaimed properly on destroy.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+$WLANWATCH&
+
+#mwldebug state+node+reset+xmit+recv+beacon+hal+hal2
+while true
+do
+ WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+ BRIDGE=`ifconfig bridge create`
+ ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ ifconfig $WIRED up
+ wlandebug -i $WLAN state+scan+assoc
+ ifconfig $WLAN up
+ read x
+ ifconfig $WLAN destroy
+ ifconfig $BRIDGE destroy
+done
diff --git a/tools/tools/net80211/scripts/setup.updown.wpa b/tools/tools/net80211/scripts/setup.updown.wpa
new file mode 100644
index 0000000..36580b5
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.updown.wpa
@@ -0,0 +1,61 @@
+#! /bin/sh
+#
+# Script for test vap create+destroy when using WPA.
+# Also used to verify resources are reclaimed properly
+# on vap destroy.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+SSID=$SSID-wpa
+WLAN=wlan0
+CONF=$TMPDIR/bsd-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=0
+wpa=1
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=CCMP
+EOF
+}
+
+n=0
+while true; do
+ echo "---- $n"; n=`expr $n + 1`
+ ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+ wlandebug -i $WLAN assoc
+ ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+
+ ifconfig $BRIDGE create
+ ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ ifconfig $WLAN up
+# ifconfig $WIRED up
+
+ makeconf $CONF
+ start_hostapd $CONF&
+ pid=$!
+ ifconfig
+
+ sleep 2
+ kill $pid
+ ifconfig $WLAN destroy;
+ ifconfig $BRIDGE destroy;
+ rm -f $CONF
+ vmstat -m | grep 80211
+ netstat -m
+ sleep 1
+done
diff --git a/tools/tools/net80211/scripts/setup.wds b/tools/tools/net80211/scripts/setup.wds
new file mode 100644
index 0000000..6df8059
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wds
@@ -0,0 +1,21 @@
+#! /bin/sh
+#
+# Script for setting up a legacy WDS vap.
+# Assumes an ap vap is already setup.
+# Can be run multiple times to create multiple WDS vaps.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+#BSSID='00:50:43:20:64:83'
+#BSSID='00:50:43:20:64:8d'
+BSSID='00:50:43:20:6f:a9'
+
+WLAN=`ifconfig wlan create wlanmode wds wlandev $WIRELESS wlanbssid $BSSID wdslegacy`
+ifconfig $BRIDGE addm $WLAN
+wlandebug -i $WLAN output+inact+node+11n
+#ifconfig $WLAN wepkey 1:0x0123456789 deftxkey 1 wep
+ifconfig $WLAN up
diff --git a/tools/tools/net80211/scripts/setup.wdsmain b/tools/tools/net80211/scripts/setup.wdsmain
new file mode 100644
index 0000000..d535054
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wdsmain
@@ -0,0 +1,40 @@
+#! /bin/sh
+#
+# Setup an ap that accepts wds traffic from associated stations.
+# This can be used as the "back end" for setup.extender and/or
+# setup.repeater. Note that the wds vap's are created by the
+# wlanwds program that listens for wds discovery events (to create
+# wds vaps) and for sta leave events (to destroy wds vaps it
+# created). The WDSUP script is invoked for each wds vap that
+# gets created--to add the vap to a bridge.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+SSID='freebsd+wdsmain'
+WDSUP=$TMPDIR/wdsup$$
+
+#mwldebug state+node+reset+xmit+recv+beacon+hal+hal2
+WLAN_AP=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN_AP ssid "$SSID" channel $CHANNEL mtu 1500
+ifconfig $WLAN_AP dwds -apbridge
+wlandebug -i $WLAN_AP state+scan+assoc+auth+wds+11n
+
+BRIDGE=`ifconfig bridge create`
+
+# NB: start wlanwds first to avoid races.
+rm -f $WDSUP
+cat >$WDSUP <<EOF
+#! /bin/sh
+DEV=\$1
+ifconfig $BRIDGE addm \$DEV
+ifconfig \$DEV up
+EOF
+chmod +x $WDSUP
+$WLANWDS -v -p $WIRELESS -s $WDSUP &
+
+ifconfig $BRIDGE addm $WLAN_AP addm $WIRED up
+ifconfig $WIRED up
+ifconfig $WLAN_AP up
diff --git a/tools/tools/net80211/scripts/setup.wdsrelay b/tools/tools/net80211/scripts/setup.wdsrelay
new file mode 100644
index 0000000..d44870e
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wdsrelay
@@ -0,0 +1,35 @@
+#! /bin/sh
+#
+# Setup a wireless extender/relay: extend a wireless network using
+# dwds. We create an ap vap and a station vap; then enable
+# dwds on the sta. The sta vap associates to another ap and passes
+# traffic from stations associated to the (local) ap. The sta
+# will follow it's peer ap, dragging the ap vap with it.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+AP_SSID='freebsd+wdsrelay'
+WDS_SSID='freebsd+wdsmain'
+#WDS_SSID='WDS1'
+
+#mwldebug state+node+reset+xmit+recv+beacon+hal+hal2
+WLAN_AP=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN_AP ssid "$AP_SSID" mtu 1500 -apbridge
+wlandebug -i $WLAN_AP state+assoc+wds+11n
+
+WLAN_STA=`ifconfig wlan create wlanmode sta wlandev $WIRELESS -beacons`
+ifconfig $WLAN_STA ssid "$WDS_SSID" dwds -bgscan
+wlandebug -i $WLAN_STA state+assoc+auth+wds+scan+11n
+# no TSO in the bridge, no AMPDU until fw works right
+ifconfig $WLAN_STA -tso -ampdu
+
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN_AP addm $WLAN_STA up
+# NB: bring sta up first so it can locate it's AP
+ifconfig $WLAN_STA up
+ifconfig $WLAN_AP up
+
+#ifconfig $WIRED down delete
diff --git a/tools/tools/net80211/scripts/setup.wep b/tools/tools/net80211/scripts/setup.wep
new file mode 100644
index 0000000..8045431
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wep
@@ -0,0 +1,21 @@
+#! /bin/sh
+#
+# Script for testing ap mode w/ WEP.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+#mwldebug -i $WIRELESS +node
+WLAN=`ifconfig wlan create wlanmode hostap wlandev $WIRELESS`
+ifconfig $WLAN ssid $SSID channel $CHANNEL mtu 1500
+#ifconfig $WLAN authmode shared
+wlandebug -i $WLAN state+scan+assoc+crypto
+#mwldebug -i $WIRELESS +keycache
+#ifconfig $WLAN wepkey 1:0x0123456789 deftxkey 1 wepmode mixed
+ifconfig $WLAN wepkey 1:0x0123456789 deftxkey 1 wep
+BRIDGE=`ifconfig bridge create`
+ifconfig $BRIDGE addm $WLAN addm $WIRED up
+ifconfig $WIRED up
+ifconfig $WLAN up
diff --git a/tools/tools/net80211/scripts/setup.wpa b/tools/tools/net80211/scripts/setup.wpa
new file mode 100644
index 0000000..8cbc772
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wpa
@@ -0,0 +1,53 @@
+#! /bin/sh
+#
+# Script for testing single-bss WPA1+WPA2.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WLAN=wlan0
+CONF=$TMPDIR/bsd-$WLAN.conf
+SSID=$SSID-wpa
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=3
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=CCMP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 2
+
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN state+assoc+11n
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#athdebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.wpa1.aes b/tools/tools/net80211/scripts/setup.wpa1.aes
new file mode 100644
index 0000000..f25c683
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wpa1.aes
@@ -0,0 +1,53 @@
+#! /bin/sh
+#
+# Script for testing WPA1 w/ AES.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WLAN=wlan0
+SSID=$SSID-wpa
+CONF=$TMPDIR/bsd-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=1
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=CCMP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 2
+
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN assoc
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#mwldebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.wpa1.tkip b/tools/tools/net80211/scripts/setup.wpa1.tkip
new file mode 100644
index 0000000..35f78e2
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wpa1.tkip
@@ -0,0 +1,53 @@
+#! /bin/sh
+#
+# Script for testing WPA1 w/ TKIP.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WLAN=wlan0
+SSID=$SSID-wpa
+CONF=$TMPDIR/bsd-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=1
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=TKIP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 2
+
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN assoc
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#mwldebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.wpa2 b/tools/tools/net80211/scripts/setup.wpa2
new file mode 100644
index 0000000..ba92a9b
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wpa2
@@ -0,0 +1,54 @@
+#! /bin/sh
+#
+# Script for testing WPA2 w/ AES.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WLAN=wlan0
+SSID=$SSID-wpa
+CONF=$TMPDIR/bsd-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=2
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=CCMP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 2
+
+#mwldebug -i $WIRELESS hal
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN assoc
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#mwldebug -i $WIRELESS keycache
+start_hostapd -K $CONF
diff --git a/tools/tools/net80211/scripts/setup.wpa2.tkip b/tools/tools/net80211/scripts/setup.wpa2.tkip
new file mode 100644
index 0000000..8e542ca
--- /dev/null
+++ b/tools/tools/net80211/scripts/setup.wpa2.tkip
@@ -0,0 +1,54 @@
+#! /bin/sh
+#
+# Script for testing WPA2 w/ TKIP.
+#
+# $FreeBSD$
+#
+PATH=.:$PATH
+. config
+
+BRIDGE=bridge0
+WLAN=wlan0
+SSID=$SSID-wpa
+CONF=$TMPDIR/bsd-$WLAN.conf
+
+makeconf()
+{
+ conf=$1
+ rm -f $conf
+ cat >$1 <<EOF
+interface=$WLAN
+ctrl_interface=$HOSTAPD_CTRL_INTERFACE
+logger_syslog=-1
+logger_syslog_level=0
+logger_stdout=-1
+logger_stdout_level=0
+debug=4
+wpa=2
+wpa_key_mgmt=WPA-PSK
+wpa_passphrase=$WPA_PASSPHRASE
+wpa_pairwise=TKIP
+EOF
+}
+
+trap "ifconfig $BRIDGE destroy; ifconfig $WLAN destroy; \
+ rm -f $CONF" 2
+
+#mwldebug -i $WIRELESS hal
+ifconfig $WLAN create wlandev $WIRELESS wlanmode hostap
+#wlandebug -i $WLAN assoc+crypto
+wlandebug -i $WLAN assoc
+ifconfig $WLAN ssid $SSID
+ifconfig $WLAN channel $CHANNEL
+ifconfig $WLAN mtu 1500 # NB: if_bridge requires matching mtu's
+
+ifconfig $BRIDGE create
+ifconfig $BRIDGE addm $WIRED addm $WLAN up
+ifconfig $WLAN up
+ifconfig $WIRED up
+
+ifconfig
+
+makeconf $CONF
+#mwldebug -i $WIRELESS keycache
+start_hostapd -K $CONF
OpenPOWER on IntegriCloud