View | Details | Raw Unified | Return to bug 21967
Collapse All | Expand All

(-)etc/pccard_ether (+10 lines)
Lines 19-24 Link Here
19
interface=$1
19
interface=$1
20
shift
20
shift
21
21
22
eval preifconfig=\$preifconfig_${interface}
23
if [ -n "${preifconfig}" ]; then
24
	preifconfig_ifconfig=""
25
	preifconfig_interface=${interface}
26
	$preifconfig
27
	if [ -n "${preifconfig_ifconfig}" ]; then
28
		pccard_ifconfig=${preifconfig_ifconfig}
29
	fi
30
fi
31
22
case ${pccard_ifconfig} in
32
case ${pccard_ifconfig} in
23
[Nn][Oo] | '')
33
[Nn][Oo] | '')
24
        ;;
34
        ;;
(-)etc/rc.network (-1 / +12 lines)
Lines 142-150 Link Here
142
			eval showstat_$ifn=1
147
			eval showstat_$ifn=1
143
		fi
148
		fi
144
149
150
		preifconfig_ifconfig=""
151
		eval preifconfig=\$preifconfig_${ifn}
152
		if [ -n "${preifconfig}" ]; then
153
			preifconfig_interface=${ifn}
154
			$preifconfig
155
		fi
156
145
		# Do the primary ifconfig if specified
157
		# Do the primary ifconfig if specified
146
		#
158
		#
147
		eval ifconfig_args=\$ifconfig_${ifn}
159
		if [ -n "${preifconfig_ifconfig}" ]; then
160
			ifconfig_args=${preifconfig_ifconfig}
161
		else
162
			eval ifconfig_args=\$ifconfig_${ifn}
163
		fi
148
164
149
		case ${ifconfig_args} in
165
		case ${ifconfig_args} in
150
		'')
166
		'')
(-)etc/Makefile (-1 / +1 lines)
Lines 31-37 Link Here
31
.endif
31
.endif
32
32
33
# -rwxr-xr-x root.wheel, for the new cron root.wheel
33
# -rwxr-xr-x root.wheel, for the new cron root.wheel
34
BIN2=	netstart pccard_ether rc.suspend rc.resume
34
BIN2=	config_802.11 netstart pccard_ether rc.suspend rc.resume
35
35
36
MTREE=	BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
36
MTREE=	BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
37
	BSD.var.dist BSD.x11.dist BSD.x11-4.dist
37
	BSD.var.dist BSD.x11.dist BSD.x11-4.dist
(-)etc/defaults/rc.conf (+38 lines)
Lines 100-105 Link Here
100
ppp_nat="YES"		# Use PPP's internal network address translation or NO.
102
ppp_nat="YES"		# Use PPP's internal network address translation or NO.
101
ppp_profile="papchap"	# Which profile to use from /etc/ppp/ppp.conf.
103
ppp_profile="papchap"	# Which profile to use from /etc/ppp/ppp.conf.
102
ppp_user="root"		# Which user to run ppp as
104
ppp_user="root"		# Which user to run ppp as
105
106
### IEEE 802.11 wireless networking configuration ###
107
ieee802_11_configs="infra adhoc"	# List of all configs
108
ieee802_11_config_default="auto"	# Default config or auto
109
#ieee802_11_config_an0="auto"		# Config for an0
110
#ieee802_11_config_wi0="auto"		# Config for wi0
111
ieee802_11_association_timeout="0"	# Time to wait to check for association
112
preifconfig_an0=". /etc/config_802.11"	# Config an0 on insert/boot
113
preifconfig_wi0=". /etc/config_802.11"	# Config wi0 on insert/boot
114
### The ad-hoc mode configuration ###
115
ieee802_11_adhoc_mode="ad-hoc"		# Set interface mode
116
ieee802_11_adhoc_ssid=""		# SSID of the network you want
117
ieee802_11_adhoc_station_name=""	# Identifier for this host
118
ieee802_11_adhoc_rate="auto"		# Rate (1, 2, 5.5, 11, or auto)
119
ieee802_11_adhoc_powermanagement="NO"	# Power management
120
ieee802_11_adhoc_channel="6"		# Channel (1-11 in US)
121
ieee802_11_adhoc_wep="NO"		# Set to YES to enable encryption
122
ieee802_11_adhoc_wep_mixed_ok="NO"	# Connect to mixed networks?
123
ieee802_11_adhoc_wep_tx_key="1"		# Set the key to transmit with
124
ieee802_11_adhoc_wep_key1=""		# Each key can be 0, 5, or 13
125
ieee802_11_adhoc_wep_key2=""		# bytes in length as either an
126
ieee802_11_adhoc_wep_key3=""		# ASCII string or a hex string.
127
ieee802_11_adhoc_wep_key4=""
128
#ieee802_11_adhoc_ifconfig="DHCP"	# interface configuration
129
### The infrastructure mode configuration ###
130
ieee802_11_infra_mode="infrastructure"	# Set interface mode
131
ieee802_11_infra_ssid=""		# SSID of the network you want
132
ieee802_11_infra_station_name=""	# Identifier for this host
133
ieee802_11_infra_rate="auto"		# Rate (1, 2, 5.5, 11, or auto)
134
ieee802_11_infra_powermanagement="NO"	# Power management
135
ieee802_11_infra_wep="NO"		# Set to YES to enable encryption
136
ieee802_11_infra_wep_mixed_ok="NO"	# Connect to mixed networks?
137
ieee802_11_infra_wep_tx_key="1"		# Set the key to transmit with
138
ieee802_11_infra_wep_key1=""		# Each key can be 0, 5, or 13
139
ieee802_11_infra_wep_key2=""		# bytes in length as either an
140
ieee802_11_infra_wep_key3=""		# ASCII string or a hex string.
141
ieee802_11_infra_wep_key4=""
142
#ieee802_11_infra_ifconfig="DHCP"	# interface configuration
103
143
104
### Network daemon (miscellaneous) & NFS options: ###
144
### Network daemon (miscellaneous) & NFS options: ###
105
syslogd_enable="YES"		# Run syslog daemon (or NO).
145
syslogd_enable="YES"		# Run syslog daemon (or NO).
(-)share/man/man5/rc.conf.5 (+163 lines)
Lines 135-140 Link Here
135
you are not connected to a network.  If you are using
135
you are not connected to a network.  If you are using
136
.Xr dhclient 8
136
.Xr dhclient 8
137
to set your hostname via DHCP, this variable should be set to an empty string.
137
to set your hostname via DHCP, this variable should be set to an empty string.
138
.It Ar default_hostname
139
If you are using
140
.Xr dhclient 8
141
to set your hostname via DHCP and will be operating without a network
142
sometimes, set this to something meaningful to be used in those cases.
143
You should set
144
.Ar hostname
145
to an empty string if this is set.
138
.It Ar nisdomainname
146
.It Ar nisdomainname
139
(str) The NIS domainname of your host, or
147
(str) The NIS domainname of your host, or
140
.Ar NO
148
.Ar NO
Lines 534-539 Link Here
534
.Bd -literal
542
.Bd -literal
535
ifconfig_ed0="DHCP"
543
ifconfig_ed0="DHCP"
536
.Ed
544
.Ed
545
.It Ar preifconfig_<interface>
546
(str) A command to run before attempting to ifconfig a network
547
interface.  This hook provides the ability to preconfigure interfaces
548
which can not simply have an IP address attached to them such as
549
wireless Ethernet interfaces.  The name of the interface is passed via
550
the
551
.Ev preifconfig_interface
552
environmental variable and an alternate set of
553
.Nm ifconfig
554
arguments may be returned by setting
555
.Ev preifconfig_ifconfig
556
before returning if the command is sourced.
537
.It Ar ppp_enable
557
.It Ar ppp_enable
538
(bool) If set to
558
(bool) If set to
539
.Ar YES ,
559
.Ar YES ,
Lines 563-568 Link Here
563
(str) The name of the user under which ppp should be started. By
583
(str) The name of the user under which ppp should be started. By
564
default, ppp is started as
584
default, ppp is started as
565
.Ar root .
585
.Ar root .
586
.It Ar ieee802_11_configs
587
(str) An ordered list of all IEEE 802.11 wireless Ethernet
588
configurations defined by the system.
589
.It Ar ieee802_11_config_default
590
(str) The default configuration to use for an IEEE 802.11 wireless
591
Ethernet device.  It may be one or more of the values in
592
.Ar ieee802_11_configs
593
or
594
.Ar AUTO
595
which is the equivalent of listing all the values from
596
.Ar ieee802_11_configs .
597
If there is more then one value, they are tryed in turn until the last
598
config is reached or one succeedes in configuring the adaptor to
599
associate with a local network.
600
.It Ar ieee802_11_config_<interface>
601
(str) The configuration to use for the given IEEE 802.11 wireless
602
interface.  Values act the same as in
603
.Ar ieee802_11_config_default .
604
.It Ar ieee802_11_association_timeout
605
(integer) The amount of time to sleep between setting the values of a
606
configuration and checking to see if the adaptor associated with a
607
network.
608
.It Ar ieee802_11_<config>_mode
609
(str) The interface mode.  Valid values are
610
.Ar ad-hoc
611
or
612
.Ar infrastructure .
613
.It Ar ieee802_11_<config>_ssid<num>
614
(str) The SSID of the network you wish to join.  Values are searched
615
from starting from <num>=1 until a value is not set.  Not all adaptors
616
support more then one SSID.
617
.It Ar ieee802_11_<config>_ssid
618
(str) This is the same as
619
.Ar ieee802_11_<config>_ssid1
620
except that it is assumed that
621
.Ar ieee802_11_<config>_ssid2
622
is not set.  This is the more portable interface.
623
.It Ar ieee802_11_<config>_station_name
624
(str) An identifier for this host.
625
.It Ar ieee802_11_<config>_rate
626
(str) The transmit speed for the interface to use.  Valid values are
627
.Ar 1 ,
628
.Ar 2,
629
.Ar 5.5 ,
630
.Ar 11 ,
631
and
632
.Ar AUTO .
633
.It Ar ieee802_11_<config>_powermanagement
634
(bool+) Set to
635
.Ar NO
636
to disable powermanagement.  Some interfaces support other modes:
637
.Ar CAM ,
638
.Ar PSP ,
639
and
640
.Ar CAM-PSP .
641
Modes not understood by a given interface are treated as
642
.Ar YES .
643
.It Ar ieee802_11_<config>_channel
644
(integer) The channel to transmit on.  Only really meaningful in ad-hoc
645
mode.
646
.It Ar ieee802_11_wep
647
(bool) Set to
648
.Ar YES
649
to enable Wired Equivalent Privacy (WEP).
650
.It Ar ieee802_11_<config>_wep_mixed_ok
651
(bool) Some cards need to be configured differently for networks with
652
allow both encrypted and unencrypted traffic.  Set to
653
.Ar YES
654
for those networks and
655
.Ar NO
656
for others.
657
.It Ar ieee802_11_<config>_wep_tx_key
658
(integer) Select the WEP key to encript transmissions with.
659
.It Ar ieee802_11_<config>_wep_key<num>
660
(str) Set WEP key <num>.  <num> must be a number from 1 to 4.  Keys may
661
be specified in hex or as ASCII strings and must be 0, 5, or 13 bytes in
662
length.
663
.It Ar ieee802_11_<config>_ifconfig
664
(str) If this configuration suceeds when tried the
665
.Nm ifconfig
666
argument string that would have been used will be replaced with this
667
string.
668
.It Ar ieee802_11_<config>_rts_threshold
669
(integer|MAX) Sets the RTR/CTS threshold for the given iterface.  If set
670
to
671
.Ar MAX ,
672
the maximum value for the interface is used.
673
.It Ar ieee802_11_<config>_wi_create_IBSS
674
(bool) Set to
675
.Ar YES
676
to attempt to act as an access point.  See the documentation on the
677
.Ar -c
678
option to
679
.Nm wicontrol
680
for more information.
681
.It Ar ieee802_11_<config>_wi_ssid
682
(str) The SSID of the access point we are trying to create.
683
.It Ar ieee802_11_<config>_wi_ap_density
684
(str) The density of access points.  Controls some access point
685
switching behavior.  Valid values are:
686
.Ar LOW ,
687
.Ar MEDIUM ,
688
and
689
.Ar HIGH .
690
.It Ar ieee802_11_<config>_wi_max_data_len
691
(integer) Provides access to the
692
.Nm wicontrol
693
command's
694
.Ar -d
695
option.
696
.It Ar ieee802_11_<config>_wi_sleep_interval
697
(integer) Provides access to the
698
.Nm wicontrol
699
command's
700
.Ar -S
701
option.
702
.It Ar ieee802_11_<config>_an_ap<num>
703
(MAC) Set up to 4 access points to preferentialy associate with.  <num>
704
is in the range from 1 to 4 and the value is the MAC address of the
705
access point in question.
706
.It Ar ieee802_11_<config>_an_beacon_period
707
(integer) The ad-hoc beacon period in milliseconds.
708
.It Ar ieee802_11_<config>_an_tx_diversity
709
(str) Set the transmit antenna diversity.  Valid values are:
710
.Ar FACTORY ,
711
.Ar ANTENNA1 ,
712
.Ar ANTENNA2 ,
713
and
714
.Ar BOTH .
715
.It Ar ieee802_11_<config>_an_rx_diversity
716
(str) Set the recieve antenna diversity.  Valid values are the save as
717
for
718
.Ar ieee802_11_<config>_an_tx_diversity .
719
.It Ar ieee802_11_<config>_an_net_join_timeout
720
(integer) Time to try to find an ad-hoc master before giving up and
721
becoming one in milliseconds.
722
.It Ar ieee802_11_<config>_an_tx_power
723
(interger) Set the transmit power.  Valid values depend on the intended
724
market for the card.
725
.It Ar ieee802_11_<config>_an_frag_threshold
726
(integer) Set the fragmentation threshold for this interface.
566
.It Ar rc_conf_files
727
.It Ar rc_conf_files
567
(str) This option is used to specify a list of files that will override
728
(str) This option is used to specify a list of files that will override
568
the settings in
729
the settings in
Lines 1459-1464 Link Here
1459
.Xr motd 5 ,
1620
.Xr motd 5 ,
1460
.Xr accton 8 ,
1621
.Xr accton 8 ,
1461
.Xr amd 8 ,
1622
.Xr amd 8 ,
1623
.Xr ancontrl 8 ,
1462
.Xr apm 8 ,
1624
.Xr apm 8 ,
1463
.Xr atm 8 ,
1625
.Xr atm 8 ,
1464
.Xr cron 8 ,
1626
.Xr cron 8 ,
Lines 1492-1497 Link Here
1492
.Xr timed 8 ,
1654
.Xr timed 8 ,
1493
.Xr vinum 8 ,
1655
.Xr vinum 8 ,
1494
.Xr vnconfig 8 ,
1656
.Xr vnconfig 8 ,
1657
.Xr wicontrol 8 ,
1495
.Xr xntpd 8 ,
1658
.Xr xntpd 8 ,
1496
.Xr xtend 8 ,
1659
.Xr xtend 8 ,
1497
.Xr ypbind 8 ,
1660
.Xr ypbind 8 ,
(-)etc/config_802.11 (+644 lines)
Line 0 Link Here
1
#!/bin/sh
2
#############################################################################
3
# Copyright 2000 The Aerospace Corporation.
4
# All rights reserved.
5
#
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
8
# are met:
9
# 1.  Redistributions of source code must retain the above copyright
10
#     notice, this list of conditions, and the following disclaimer.
11
# 2.  Redistributions in binary form must reproduce the above copyright
12
#     notice, this list of conditions, and the following disclaimer in the
13
#     documentation and/or other materials provided with the distribution.
14
# 3.  The name of The Aerospace Corporation may not be used to endorse or
15
#     promote products derived from this software.
16
#
17
# THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION "AS IS" AND
18
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE
21
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  POSSIBILITY OF
27
# SUCH DAMAGE.
28
#
29
# $FreeBSD$
30
#
31
32
#
33
# config_802.11
34
#
35
# The interface to be configured is passed via the
36
# preifconfig_interface environmental variable.  Upon successful
37
# configuration of an interface, the preifconfig_ifconfig variable is
38
# set if the secessful configuration sets its
39
# ieee802_11_<config>_ifconfig variable.
40
#
41
# The current version supports wi and an adaptors.
42
#
43
44
ieee802_11_set_config() { (
45
	wicontrol="/usr/sbin/wicontrol -i ${preifconfig_interface}"
46
	ancontrol="/usr/sbin/ancontrol -i ${preifconfig_interface}"
47
#	ancontrol="echo ancontrol -i ${preifconfig_interface}"
48
49
	# Convert inputs to cannonical form.  All general arguments are
50
	# cleaned here to reduce the code in the interface specific
51
	# portion of the code.
52
	#
53
	eval mode=\$ieee802_11_${config}_mode
54
	case ${mode} in
55
	[Aa][Dd]-[Hh][Oo][Cc]|[Aa][Dd][Hh][Oo][Cc])
56
		mode="ad-hoc"
57
		;;
58
	[Ii][Nn][Ff][Rr][Aa]*|[Bb][Ss][Ss])
59
		mode="infrastructure"
60
		;;
61
	*)
62
		mode=""
63
		;;
64
	esac
65
66
	eval ssid=\${ieee802_11_${config}_ssid-_unset_}
67
	if [ "${ssid}" != "_unset_" ]; then
68
		ssid1=${ssid}
69
		ssid2="_unset_"
70
	else
71
		ssids=1
72
		while : ; do
73
			eval ssid=\${ieee802_11_${config}_ssid${ssids}-_unset_}
74
			if [ "${ssid}" != "_unset_" ]; then
75
				eval ssid${ssids}=${ssid}
76
				ssids=`expr ${ssids} + 1`
77
			else
78
				break
79
			fi
80
		done
81
	fi
82
83
	eval station_name=\${ieee802_11_${config}_station_name-_unset_}
84
85
	eval rate=\$ieee802_11_${config}_rate
86
	case ${rate} in
87
	1|2|5.5|11)
88
		;;
89
	5)
90
		rate="5.5"
91
		;;
92
	[Aa][Uu][Tt][Oo])
93
		rate="auto"
94
		;;
95
	*)
96
		rate=""
97
		;;
98
	esac
99
100
	eval powermanagement=\$ieee802_11_${config}_powermanagement
101
	case ${powermanagement} in
102
	[Nn][Oo])
103
		powermanagement="no"
104
		;;
105
	[Yy][Ee][Ss])
106
		powermanagement="yes"
107
		;;
108
	[Cc][Aa][Mm])
109
		powermanagement="cam"
110
		;;
111
	[Pp][Ss][Pp])
112
		powermanagement="psp"
113
		;;
114
	[Cc][Aa][Mm]-[Pp][Ss][Pp])
115
		powermanagement="cam-psp"
116
		;;
117
	*)
118
		powermanagement=""
119
		;;
120
	esac
121
		
122
	eval channel=\$ieee802_11_${config}_channel
123
	case ${channel} in
124
	1|2|3|4|5|6|7|8|9|10|11|12|13|14)
125
		;;
126
	*)
127
		channel=""
128
		;;
129
	esac
130
131
	eval wep=\$ieee802_11_${config}_wep
132
	case ${wep} in
133
	[Nn][Oo])
134
		wep="no"
135
		;;
136
	[Yy][Ee][Ss])
137
		wep="yes"
138
		;;
139
	*)
140
		wep=""
141
		;;
142
	esac
143
144
	eval wep_mixed_ok=\$ieee802_11_${config}_wep_mixed_ok
145
	case ${wep_mixed_ok} in
146
	[Nn][Oo])
147
		wep_mixed_ok="no"
148
		;;
149
	[Yy][Ee][Ss])
150
		wep_mixed_ok="yes"
151
		;;
152
	*)
153
		wep_mixed_ok=""
154
		;;
155
	esac
156
157
	eval wep_tx_key=\$ieee802_11_${config}_wep_tx_key
158
	case ${wep_tx_key} in
159
	1|2|3|4)
160
		;;
161
	*)
162
		wep_tx_key=""
163
		;;
164
	esac
165
166
	eval wep_key1=\${ieee802_11_${config}_wep_key1-_unset_}
167
	eval wep_key2=\${ieee802_11_${config}_wep_key2-_unset_}
168
	eval wep_key3=\${ieee802_11_${config}_wep_key3-_unset_}
169
	eval wep_key4=\${ieee802_11_${config}_wep_key4-_unset_}
170
171
	eval mac=\${ieee802_11_${config}_mac-_unset_}
172
173
	eval rts_threshold=\$ieee802_11_${config}_rts_threshold
174
	case ${rts_threshold} in
175
	[0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[12][0-9][0-9][0-9])
176
		if [ ${rts_threshold} -gt 2347 ]; then
177
			rts_threshold="max"
178
		fi
179
		;;
180
	[Mm][Aa][Xx]*)
181
		rts_threshold="max"
182
		;;
183
	*)
184
		rts_threshold=""
185
		;;
186
	esac
187
	
188
	# Each interface type needs to be handled differently due to
189
	# differences in the control programs and custom options.
190
	#
191
	case ${preifconfig_interface} in
192
	wi[0-9]*)
193
		# handle general options
194
		#
195
		if [ -n "${mode}" ]; then
196
			case ${mode} in
197
			ad-hoc)
198
				${wicontrol} -p 3
199
				;;
200
			infrastructure)
201
				${wicontrol} -p 1
202
				;;
203
			esac
204
		fi
205
206
		if [ "${ssid1}" != "_unset_" ]; then
207
			${wicontrol} -n "${ssid1}"
208
		fi
209
210
		if [ "${station_name}" != "_unset_" ]; then
211
			${wicontrol} -s "${station_name}"
212
		fi
213
214
		# I think these values are probably correct for modern
215
		# cards.  However, my tests indicate that the value you
216
		# select has little to do with the speed at which you
217
		# operate.
218
		#
219
		if [ -n "${rate}" ]; then
220
			case ${rate} in
221
			1)
222
				${wicontrol} -t 1
223
				;;
224
			2)
225
				${wicontrol} -t 2
226
				;;
227
			5.5)
228
				${wicontrol} -t 4
229
				;;
230
			11)
231
				${wicontrol} -t 5
232
				;;
233
			auto)
234
				${wicontrol} -t 3
235
				;;
236
			esac
237
		fi
238
239
		if [ -n "${powermanagement}" ]; then
240
			case ${powermanagement} in
241
			no)
242
				${wicontrol} -P 0
243
				;;
244
			*)
245
				${wicontrol} -P 1
246
				;;
247
			esac
248
		fi
249
250
		if [ -n "${channel}" ]; then
251
			${wicontrol} -f ${channel}
252
		fi
253
254
		if [ -n "${wep}" ]; then
255
			case ${wep} in
256
			no)
257
				${wicontrol} -e 0
258
				;;
259
			yes)
260
				${wicontrol} -e 1
261
				;;
262
			esac
263
		fi
264
265
		# wep_mixed_ok isn't an option for wi devices
266
267
		if [ -n "${wep_tx_key}" ]; then
268
			${wicontrol} -T ${wep_tx_key}
269
		fi
270
271
		if [ "${wep_key1}" != "_unset_" ]; then
272
			${wicontrol} -k "${wep_key1}" -v 1
273
		fi
274
		if [ "${wep_key2}" != "_unset_" ]; then
275
			${wicontrol} -k "${wep_key2}" -v 2
276
		fi
277
		if [ "${wep_key3}" != "_unset_" ]; then
278
			${wicontrol} -k "${wep_key3}" -v 3
279
		fi
280
		if [ "${wep_key4}" != "_unset_" ]; then
281
			${wicontrol} -k "${wep_key4}" -v 4
282
		fi
283
284
		if [ -n "${rts_threshold}" ]; then
285
			case ${rts_threshold} in
286
			max)
287
				${wicontrol} -r 2347
288
				;;
289
			*)
290
				${wicontrol} -r ${rts_threshold}
291
				;;
292
			esac
293
		fi
294
295
		# Handle wi specific options
296
		#
297
		eval wi_create_IBSS=\$ieee802_11_${config}_wi_create_IBSS
298
		case ${wi_create_IBSS} in
299
		[Nn][Oo])
300
			${wicontrol} -c 0
301
			;;
302
		[Yy][Ee][Ss])
303
			${wicontrol} -c 1
304
			;;
305
		*)
306
			;;
307
		esac
308
309
		eval wi_ssid=\${ieee802_11_${config}_wi_ssid-_unset_}
310
		if [ "${wi_ssid}" != "_unset_" ]; then
311
			${wicontrol} -q "${wi_ssid}"
312
		fi
313
314
		eval wi_ap_density=\$ieee802_11_${config}_wi_ap_density
315
		case ${wi_ap_density} in
316
		[Ll][Oo][Ww]|1)
317
			${wicontrol} -a 1
318
			;;
319
		[Mm][Ee][Dd][Ii][Uu][Mm]|2)
320
			${wicontrol} -a 2
321
			;;
322
		[Hh][Ii][Gg][Hh]|3)
323
			${wicontrol} -a 3
324
			;;
325
		*)
326
			;;
327
		esac
328
329
		eval wi_max_data_len=\$ieee802_11_${config}_wi_max_data_len
330
		if [ -n "${wi_max_data_length}" ]; then
331
			${wicontrol} -d ${wi_max_data_length}
332
		fi
333
334
		eval wi_sleep_interval=\$ieee802_11_${config}_wi_sleep_interval
335
		if [ -n "${wi_sleep_interval}" ]; then
336
			${wicontrol} -S ${wi_sleep_interval}
337
		fi
338
339
		;;
340
	an[0-9]*)
341
		# handle general options
342
		#
343
		if [ -n "${mode}" ]; then
344
			case ${mode} in
345
			ad-hoc)
346
				${ancontrol} -o 0
347
				;;
348
			infrastructure)
349
				${ancontrol} -o 1
350
				;;
351
			esac
352
		fi
353
354
		if [ "${ssid1}" != "_unset_" ]; then
355
			${ancontrol} -v 1 -n "${ssid1}"
356
			if [ "${ssid2}" != "_unset_" ]; then
357
				${ancontrol} -v 2 -n "${ssid2}"
358
				if [ "${ssid3}" != "_unset_" ]; then
359
					${ancontrol} -v 3 -n "${ssid3}"
360
				fi
361
			fi
362
		fi
363
364
		if [ "${station_name}" != "_unset_" ]; then
365
			${ancontrol} -l "${station_name}"
366
		fi
367
368
		if [ -n "${rate}" ]; then
369
			case ${rate} in
370
			1)
371
				${ancontrol} -t 1
372
				;;
373
			2)
374
				${ancontrol} -t 2
375
				;;
376
			5.5)
377
				${ancontrol} -t 3
378
				;;
379
			11)
380
				${ancontrol} -t 4
381
				;;
382
			auto)
383
				${ancontrol} -t 0
384
				;;
385
			esac
386
		fi
387
388
		if [ -n "${powermanagement}" ]; then
389
			case ${powermanagement} in
390
			no)
391
				${ancontrol} -s 0
392
				;;
393
			# XXX: I think CAM is the right choice for YES,
394
			# but I'm not actually sure.  Maybe what I need
395
			# is the 802.11b spec.
396
			yes)
397
				${ancontrol} -s 1
398
				;;
399
			cam)
400
				${ancontrol} -s 1
401
				;;
402
			psp)
403
				${ancontrol} -s 2
404
				;;
405
			cam-psp)
406
				${ancontrol} -s 3
407
				;;
408
			esac
409
		fi
410
411
		if [ -n "${channel}" ]; then
412
			${ancontrol} -c ${channel}
413
		fi
414
415
		# Hmm, not sure how this works
416
		if [ -n "${wep_mixed_ok}" ]; then
417
			case ${wep_mixed_ok} in
418
			no)
419
				# Turn off
420
				;;
421
			yes)
422
				# Turn on
423
				;;
424
			esac
425
		fi
426
427
		if [ "${wep_key1}" != "_unset_" ]; then
428
			${ancontrol} -v 1 -k "${wep_key1}"
429
		fi
430
		if [ "${wep_key2}" != "_unset_" ]; then
431
			${ancontrol} -v 3 -k "${wep_key2}"
432
		fi
433
		if [ "${wep_key3}" != "_unset_" ]; then
434
			${ancontrol} -v 5 -k "${wep_key3}"
435
		fi
436
		if [ "${wep_key4}" != "_unset_" ]; then
437
			${ancontrol} -v 7 -k "${wep_key4}"
438
		fi
439
440
		# XXX Hack around missing feature in ancontrol
441
		if [ -n "${wep_tx_key}" ]; then
442
			case ${wep_tx_key} in
443
			1)
444
				${ancontrol} -v 1 -k "${wep_key1}"
445
				;;
446
			2)
447
				${ancontrol} -v 3 -k "${wep_key2}"
448
				;;
449
			3)
450
				${ancontrol} -v 5 -k "${wep_key3}"
451
				;;
452
			4)
453
				${ancontrol} -v 7 -k "${wep_key4}"
454
				;;
455
			esac
456
		fi
457
458
		# Needs to be after key setting for some reason
459
		if [ -n "${wep}" ]; then
460
			case ${wep} in
461
			no)
462
				${ancontrol} -W 0
463
				;;
464
			yes)
465
				${ancontrol} -W 1
466
				;;
467
			esac
468
		fi
469
470
		if [ -n "${rts_threshold}" ]; then
471
			case ${rts_threshold} in
472
			max)
473
				${ancontrol} -r 2312
474
				;;
475
			*)
476
				${ancontrol} -r ${rts_threshold}
477
				;;
478
			esac
479
		fi
480
481
482
		# Handle an specific options
483
		#
484
		eval an_ap1=\${ieee802_11_${config}_an_ap1-_unset_}
485
		eval an_ap2=\${ieee802_11_${config}_an_ap2-_unset_}
486
		eval an_ap3=\${ieee802_11_${config}_an_ap3-_unset_}
487
		eval an_ap4=\${ieee802_11_${config}_an_ap4-_unset_}
488
		if [ "${an_ap1}" != "_unset_" ]; then
489
			${ancontrol} -v 1 -a "${an_ap1}"
490
		fi
491
		if [ "${an_ap2}" != "_unset_" ]; then
492
			${ancontrol} -v 2 -a "${an_ap2}"
493
		fi
494
		if [ "${an_ap3}" != "_unset_" ]; then
495
			${ancontrol} -v 3 -a "${an_ap3}"
496
		fi
497
		if [ "${an_ap4}" != "_unset_" ]; then
498
			${ancontrol} -v 4 -a "${an_ap4}"
499
		fi
500
501
		eval an_beacon_period=\$ieee802_11_${config}_an_beacon_period
502
		if [ -n "${an_beacon_period}" ]; then
503
			${ancontrol} -b ${an_beacon_period}
504
		fi
505
506
		eval an_tx_diversity=\$ieee802_11_${config}_an_diversity
507
		eval an_rx_diversity=\$ieee802_11_${config}_an_diversity
508
		case "${an_tx_diversity}" in
509
		'')
510
			;;
511
		[Ff][Aa][Cc][Tt][Oo][Rr][Yy]|0)
512
			${ancontrol} -v 1 -d 0
513
			;;
514
		[Aa][Nn][Tt][Ee][Nn][Nn][Aa]1|1)
515
			${ancontrol} -v 1 -d 1
516
			;;
517
		[Aa][Nn][Tt][Ee][Nn][Nn][Aa]2|2)
518
			${ancontrol} -v 1 -d 2
519
			;;
520
		[Bb][Oo][Tt][Hh]|3)
521
			${ancontrol} -v 1 -d 3
522
			;;
523
		esac
524
		case "${an_rx_diversity}" in
525
		'')
526
			;;
527
		[Ff][Aa][Cc][Tt][Oo][Rr][Yy]|0)
528
			${ancontrol} -v 0 -d 0
529
			;;
530
		[Aa][Nn][Tt][Ee][Nn][Nn][Aa]1|1)
531
			${ancontrol} -v 0 -d 1
532
			;;
533
		[Aa][Nn][Tt][Ee][Nn][Nn][Aa]2|2)
534
			${ancontrol} -v 0 -d 2
535
			;;
536
		[Bb][Oo][Tt][Hh]|3)
537
			${ancontrol} -v 0 -d 3
538
			;;
539
		esac
540
541
		eval an_net_join_timeout=\$ieee802_11_${config}_an_net_join_timeout
542
		if [ -n "${an_net_join_timeout}" ]; then
543
			${ancontrol} -j ${an_net_join_timeout}
544
		fi
545
546
		eval an_tx_power=\$ieee802_11_${config}_an_tx_power
547
		if [ -n "${an_tx_power}" ]; then
548
			${ancontrol} -p ${an_net_tx_power}
549
		fi
550
551
		eval an_frag_threshold=\$ieee802_11_${config}_an_frag_threshold
552
		if [ -n "${an_frag_threshold}" ]; then
553
			${ancontrol} -f ${an_frag_threshold}
554
		fi
555
556
		;;
557
	*)
558
		;;
559
	esac
560
) }
561
562
ieee802_11_check_status() {
563
	eval ieee802_11_mode=\$ieee802_11_${config}_mode
564
	case ${ieee802_11_mode} in
565
	[Aa][Dd]-[Hh][Oo][Cc]|[Aa][Dd][Hh][Oo][Cc])
566
		ieee802_11_mode="ad-hoc"
567
		;;
568
	[Ii][Nn][Ff][Rr][Aa]*|[Bb][Ss][Ss])
569
		ieee802_11_mode="infrastructure"
570
		;;
571
	*)
572
		ieee802_11_mode=""
573
		;;
574
	esac
575
576
	case ${preifconfig_interface} in
577
	wi[0-9]*)
578
		if [ `wicontrol -i ${preifconfig_interface} | sed -e '/^Comms.*/!d' -e 's/.*\[ \([0-9]*\) .*/\1/` -gt 0 ]; then
579
			ieee802_11_is_synced="yes"
580
		else
581
			ieee802_11_is_synced="no"
582
		fi
583
		;;
584
	an[0-9]*)
585
		case ${ieee802_11_mode} in
586
		ad-hoc)
587
			if [ -n "`ancontrol -i ${preifconfig_interface} -S | sed -e '/^Operating.*/!d' -e '/.*synced.*/!d'`" ]; then
588
				ieee802_11_is_synced="yes"
589
			else
590
				ieee802_11_is_synced="no"
591
			fi
592
			;;
593
		infrastructure)
594
			if [ -n "`ancontrol -i ${preifconfig_interface} -S | sed -e '/^Current AP name.*/!d' -e 's/.*\[ *\([a-zA-Z0-9-]*\) *\].*/\1/'`" ]; then
595
				ieee802_11_is_synced="yes"
596
			else
597
				ieee802_11_is_synced="no"
598
			fi
599
			;;
600
		esac
601
		;;
602
	*)
603
		ieee802_11_is_synced="no"
604
	esac
605
}
606
607
# Select the specific config(s) for this interface or else take the default
608
#
609
eval ieee802_11_config=\$ieee802_11_config_${preifconfig_interface}
610
if [ -z "${ieee802_11_config}" ]; then
611
	ieee802_11_config=${ieee802_11_config_default}
612
fi
613
614
# If the config is auto then try all the configs
615
#
616
case ${ieee802_11_config} in
617
[Aa][Uu][Tt][Oo])
618
	ieee802_11_config=${ieee802_11_configs}
619
	;;
620
esac
621
622
sleep 1
623
624
# Try each config in turn until we get one that works or we give up and
625
# use the last one.
626
#
627
for config in ${ieee802_11_config}; do
628
	echo -n "Trying IEEE 802.11 config '$config' on ${preifconfig_interface}..."
629
	ieee802_11_set_config
630
	ifconfig ${preifconfig_interface} up
631
	if [ ${ieee802_11_association_timeout} -gt 0 ]; then
632
		echo -n "sleeping ${ieee802_11_association_timeout}sec..."
633
		sleep ${ieee802_11_association_timeout}
634
	fi
635
	ieee802_11_check_status
636
	ifconfig ${preifconfig_interface} down
637
	if [ "$ieee802_11_is_synced" = "yes" ]; then
638
		echo succeded
639
		eval preifconfig_ifconfig=\${ieee802_11_${config}_ifconfig}
640
		break
641
	else
642
		echo failed
643
	fi
644
done

Return to bug 21967