From c8887008c2fd0c87e530e2b6e248f70ff5bc662f Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sun, 20 Apr 2008 20:43:42 +0000 Subject: [PATCH] test scripts for vaps and other 802.11 features Supported by: Hobnob and Marvell --- tools/tools/net80211/scripts/config | 54 ++++++++++++++++ tools/tools/net80211/scripts/setup.dfs | 25 ++++++++ tools/tools/net80211/scripts/setup.fixed | 17 +++++ tools/tools/net80211/scripts/setup.local | 16 +++++ tools/tools/net80211/scripts/setup.mixed | 62 +++++++++++++++++++ tools/tools/net80211/scripts/setup.simple | 16 +++++ tools/tools/net80211/scripts/setup.simple2 | 24 +++++++ tools/tools/net80211/scripts/setup.sta | 15 +++++ tools/tools/net80211/scripts/setup.tsn | 55 ++++++++++++++++ tools/tools/net80211/scripts/setup.updown | 26 ++++++++ tools/tools/net80211/scripts/setup.updown.wpa | 61 ++++++++++++++++++ tools/tools/net80211/scripts/setup.wds | 21 +++++++ tools/tools/net80211/scripts/setup.wdsmain | 40 ++++++++++++ tools/tools/net80211/scripts/setup.wdsrelay | 35 +++++++++++ tools/tools/net80211/scripts/setup.wep | 21 +++++++ tools/tools/net80211/scripts/setup.wpa | 53 ++++++++++++++++ tools/tools/net80211/scripts/setup.wpa1.aes | 53 ++++++++++++++++ tools/tools/net80211/scripts/setup.wpa1.tkip | 53 ++++++++++++++++ tools/tools/net80211/scripts/setup.wpa2 | 54 ++++++++++++++++ tools/tools/net80211/scripts/setup.wpa2.tkip | 54 ++++++++++++++++ 20 files changed, 755 insertions(+) create mode 100644 tools/tools/net80211/scripts/config create mode 100644 tools/tools/net80211/scripts/setup.dfs create mode 100644 tools/tools/net80211/scripts/setup.fixed create mode 100644 tools/tools/net80211/scripts/setup.local create mode 100644 tools/tools/net80211/scripts/setup.mixed create mode 100644 tools/tools/net80211/scripts/setup.simple create mode 100644 tools/tools/net80211/scripts/setup.simple2 create mode 100644 tools/tools/net80211/scripts/setup.sta create mode 100644 tools/tools/net80211/scripts/setup.tsn create mode 100644 tools/tools/net80211/scripts/setup.updown create mode 100644 tools/tools/net80211/scripts/setup.updown.wpa create mode 100644 tools/tools/net80211/scripts/setup.wds create mode 100644 tools/tools/net80211/scripts/setup.wdsmain create mode 100644 tools/tools/net80211/scripts/setup.wdsrelay create mode 100644 tools/tools/net80211/scripts/setup.wep create mode 100644 tools/tools/net80211/scripts/setup.wpa create mode 100644 tools/tools/net80211/scripts/setup.wpa1.aes create mode 100644 tools/tools/net80211/scripts/setup.wpa1.tkip create mode 100644 tools/tools/net80211/scripts/setup.wpa2 create mode 100644 tools/tools/net80211/scripts/setup.wpa2.tkip diff --git a/tools/tools/net80211/scripts/config b/tools/tools/net80211/scripts/config new file mode 100644 index 000000000000..cff91347567a --- /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 000000000000..a771977c8144 --- /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 000000000000..d0008002dc90 --- /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 000000000000..f56e9d585339 --- /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 000000000000..423c5342e7dd --- /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 <$1 <$1 <$WDSUP <$1 <$1 <$1 <$1 <$1 <