]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/tools/net80211/scripts/config
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / tools / net80211 / scripts / config
1 #
2 # Common configuration settings for vap test scripts.
3 #
4 # $FreeBSD$
5 #
6
7 media_type()
8 {
9         ifconfig $1 2>/dev/null | while read line; do
10                 case "$line" in
11                 *media:?Ethernet*)
12                         echo 802.3
13                         ;;
14                 *media:?IEEE?802.11*)
15                         echo 802.11
16                         ;;
17                 esac
18         done
19 }
20
21 #
22 # Auto-detect WIRED and WIRELESS.
23 # NB: takes first device of each type; to fix
24 #     either specify them before . config.
25 #
26 for i in `ifconfig -l`; do
27         case `media_type $i`  in
28         802.3)
29                 test -z "$WIRED" && WIRED=$i
30                 ;;
31         802.11)
32                 test -z "$WIRELESS" && WIRELESS=$i
33                 ;;
34         esac
35 done
36 test -z "$WIRED" && { echo "No wired device detected!"; exit; }
37 test -z "$WIRELESS" && { echo "No wireless device detected!"; exit; }
38
39 # fixed channel
40 #CHANNEL=${1:-36:a}
41 #CHANNEL=${1:-36:ht/20}
42 CHANNEL=${1:-36}
43 #CHANNEL=${1:-6:g}
44 #CHANNEL=${1:-6:b}
45
46 # default WPA passphrase
47 test -z "$WPA_PASSPHRASE" && WPA_PASSPHRASE='I am not a geek'
48
49 # default ssid for ap vaps
50 test -z "$SSID"         && SSID=freebsd-ap
51
52 # default meshid for mesh vaps
53 test -z "$MESHID"       && MESHID=freebsd-mesh
54
55 # directory to create files like hostapd.conf
56 test -z "$TMPDIR"       && TMPDIR=.
57
58 test -z "$HOSTAPD_CTRL_INTERFACE" && HOSTAPD_CTRL_INTERFACE=/var/run/hostapd
59
60 # applications (may want ../ for wlan test apps)
61 test -z "$HOSTAPD"      && HOSTAPD=/usr/sbin/hostapd
62 test -z "$WLANWATCH"    && WLANWATCH=/usr/local/bin/wlanwatch
63 test -z "$WLANWDS"      && WLANWDS=/usr/local/bin/wlanwds
64
65 start_hostapd()
66 {
67         for m in wlan_xauth wlan_ccmp wlan_tkip wlan_wep; do
68                 kldstat -q -m $m || kldload $m
69         done
70         $HOSTAPD $*
71 }