aboutsummaryrefslogtreecommitdiff
path: root/tools/tools/net80211/scripts/config
blob: 97f9cfc9869b3c87ba74bc15c34136e62f654ce0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#
# Common configuration settings for vap test scripts.
#
# $FreeBSD: src/tools/tools/net80211/scripts/config,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
#

media_type()
{
	ifconfig $1 2>/dev/null | while read line; do
		case "$line" in
		*media:?Ethernet*)
			echo 802.3
			;;
		*media:?IEEE?802.11*)
			echo 802.11
			;;
		esac
	done
}

#
# 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 `media_type $i`  in
	802.3)
		test -z "$WIRED" && WIRED=$i
		;;
	802.11)
		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

# default meshid for mesh vaps
test -z "$MESHID"	&& MESHID=freebsd-mesh

# 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 $*
}