English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/freewrt_1_0/package/broadcom-wl-util/files/wireless-broadcom.pre-up

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2951 - (show annotations) (download)
Tue Jun 26 19:20:08 2007 UTC (6 years, 8 months ago) by tha
File size: 5152 byte(s)
Madwifi (fixing bug: #155):
 - downgraded to 0.9.2.1, because in 0.9.3.x the madwifi kernel module
   oopses in monitor mode.
 - applied debian's security fixed for 0.9.2.1, because every 
   unpatched version before 0.9.3.1 is vulnerable to three knows security
   issues (see madwifi.org).
 - converted four manual patches to the freewrt patch format
 - thx to shorty for sending a one-liner fix in the Makefile for 0.9.2.1

Aiccu (fixing a bug reported via the xen-users ml by Frank Matthiess):
 - merged fix from trunk rev #2881 for fixing a bug regarding a broken
   IP Header in the aiccu packets.

Broadcom-wl-util (fixing bug: #334):
 - qouted the wpa password in the if-<pre>up.d scripts.
   hopefully this fixes this bug. Until now I only checked that it 
   doesn't brake something that was already working before.

Freeradius (fixing bug: #321):
 - the init.d script now exports the correct library path before radiusd
   is started. otherwise the daemon fails in certain setups because some
   libraries cannot be found. thx to tg for this fix.

License:
 - updated the license file to refelect the current developer team.
   the names and the alphabetic order has been "stolen" by me from
   http://www.freewrt.org/trac/wiki/Development/Developers


1 #!/bin/sh
2 #
3 # Wireless configuration script
4 # Copyright (c) 2006 Dirk Nehring <dnehring@freewrt.org>
5 #
6 [ "$IF_WIRELESS_TYPE" != "broadcom" ] && exit 0
7
8 #
9 # init driver
10 #
11 [ "${IFACE%%[0-9]*}" = "eth" ] && ip link set up dev $IFACE
12 wl radio on
13 wl infra 1
14 wl monitor 0
15 wl macmode 0
16 wl mac none
17 wl lazywds 0
18 wl up
19
20 # kill nas
21 pid="$(cat /var/run/nas.lan.pid 2>&-)"
22 [ -n "$pid" -a -d "/proc/$pid" ] && kill $pid
23
24 # get interface name if bridged
25 [ "$IF_WIRELESS_BRIDGE_IF" ] && ifname=$IF_WIRELESS_BRIDGE_IF
26
27 #
28 # check SSID
29 #
30 [ "$IF_WIRELESS_SSID" ] || exit 1
31
32 #
33 # set country
34 #
35 [ "$IF_WIRELESS_COUNTRY" ] && ( wl down; wl country $IF_WIRELESS_COUNTRY; wl up )
36
37 #
38 # set gmode
39 #
40 [ "$IF_WIRELESS_GMODE" ] && ( wl down; wl gmode $IF_WIRELESS_GMODE; wl up )
41
42 #
43 # set operation mode
44 #
45 case "$IF_WIRELESS_MODE" in
46 ap)
47 nas_auth="-A "
48 wl ap 1
49 ;;
50 sta)
51 # Bridging does not work in client mode.
52 [ "$ifname" = "br0" ] && exit
53 nas_auth="-S "
54 wl ap 0
55 # XXX TODO: "wl wet 1" when bridging
56 ;;
57 adhoc)
58 wl ap 0
59 wl infra 0
60 wl join $IF_WIRELESS_SSID imode ibss
61 ;;
62 wds)
63 [ "$IF_WIRELESS_WDS" ] || ( logger -t wireless "no wireless-wds entry found, aborting";exit 1;)
64 wl ap 1
65 ;;
66 monitor)
67 wl ap 0
68 wl monitor 1
69 ;;
70 *)
71 echo "Unknown operation mode '$IF_WIRELESS_MODE'"
72 exit 1
73 ;;
74 esac
75
76 #
77 # set isolate mode
78 #
79 [ "$IF_WIRELESS_ISOLATE" ] && wl ap_isolate $IF_WIRELESS_ISOLATE
80
81 #
82 # set macmode mode
83 #
84 [ "$IF_WIRELESS_MACMODE" ] && wl macmode $IF_WIRELESS_MACMODE
85
86 #
87 # set MAC addresses
88 #
89 [ "$IF_WIRELESS_MAC" ] && wl mac $IF_WIRELESS_MAC
90
91 #
92 # set WLAN channel
93 #
94 [ "$IF_WIRELESS_CHANNEL" ] && wl channel $IF_WIRELESS_CHANNEL
95
96 #
97 # set frameburst
98 #
99 [ "$IF_WIRELESS_FRAMEBURST" ] && wl frameburst $IF_WIRELESS_FRAMEBURST
100
101 #
102 # set afterburner
103 #
104 [ "$IF_WIRELESS_AFTERBURNER" ] && wl afterburner_override $IF_WIRELESS_AFTERBURNER
105
106 #
107 # encryption
108 #
109 case "$IF_WIRELESS_ENCRYPTION" in
110 wep)
111 crypto_num=1
112 wl wep on
113 wl tkip off
114 wl aes off
115 ;;
116 tkip)
117 crypto_num=2
118 wl wep off
119 wl tkip on
120 wl aes off
121 ;;
122 aes)
123 crypto_num=4
124 wl wep off
125 wl tkip off
126 wl aes on
127 ;;
128 aes+tkip)
129 crypto_num=6
130 wl wep off
131 wl tkip on
132 wl aes on
133 ;;
134 esac
135 wl wsec $crypto_num
136
137 #
138 # security "none"
139 #
140 [ "$IF_WIRELESS_SECURITY" = "none" ] && {
141 wl wep 0
142 wl wsec 0
143 wl ssid $IF_WIRELESS_SSID
144
145 [ "$IF_WIRELESS_MODE" = "sta" ] && wl join $IF_WIRELESS_SSID
146
147 exit 0
148 }
149
150 #
151 # security "wep"
152 #
153 [ "$IF_WIRELESS_SECURITY" = "wep" ] && {
154 wl wep 1
155 wl eap off
156 wl wpa_auth 0
157 wl wsec 1
158
159 [ "$IF_WIRELESS_MODE" = "sta" ] && {
160 case "$IF_WIRELESS_AUTHORIZATION" in
161 open)
162 authorization="open"
163 ;;
164 shared)
165 authorization="shared"
166 ;;
167 *)
168 authorization="open"
169 ;;
170 esac
171
172 wl join $IF_WIRELESS_SSID key $IF_WIRELESS_KEY1 amode $authorization
173 exit 0
174 } || {
175 [ "$IF_WIRELESS_KEY1" ] && wl addwep 0 "$IF_WIRELESS_KEY1"
176 [ "$IF_WIRELESS_KEY2" ] && wl addwep 1 "$IF_WIRELESS_KEY2"
177 [ "$IF_WIRELESS_KEY3" ] && wl addwep 2 "$IF_WIRELESS_KEY3"
178 [ "$IF_WIRELESS_KEY4" ] && wl addwep 3 "$IF_WIRELESS_KEY4"
179 [ "$IF_WIRELESS_KEY" ] && wl primary_key "$(($IF_WIRELESS_KEY-1))"
180 wl ssid $IF_WIRELESS_SSID
181 }
182 exit 0
183 }
184
185 # wpa rekeying
186 gtk_rekey=$IF_WIRELESS_WPA_GTK_REKEY
187 gtk_rekey=${gtk_rekey#0}
188 gtk_rekey=${gtk_rekey:-3600}
189
190 #
191 # security "wpa-psk"
192 #
193 [ "$IF_WIRELESS_SECURITY" = "wpa-psk" ] && {
194 wl eap off
195 case "$IF_WIRELESS_AUTHORIZATION" in
196 psk)
197 auth=4
198 ;;
199 psk2)
200 auth=128
201 ;;
202 "psk psk2")
203 auth=132
204 ;;
205 esac
206 wl wpa_auth $auth
207 wl ssid $IF_WIRELESS_SSID
208 [ "$IF_WIRELESS_MODE" != "wds" ] && {
209 /usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l $ifname} -H 34954 -i $IFACE $nas_auth -m $auth -k "$IF_WIRELESS_WPA_KEY" -s "$IF_WIRELESS_SSID" -w $crypto_num -g $gtk_rekey &
210 [ "$IF_WIRELESS_BRIDGE_IF" ] && echo "/usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l $ifname} -H 34954 -i $IFACE $nas_auth -m $auth -k \"$IF_WIRELESS_WPA_KEY\" -s \"$IF_WIRELESS_SSID\" -w $crypto_num -g $gtk_rekey &" >/var/run/nas.lan.cmd
211 }
212 exit 0
213 }
214
215 #
216 # security "8021x"
217 #
218 [ "$IF_WIRELESS_SECURITY" = "8021x" ] && {
219 case "$IF_WIRELESS_AUTHORIZATION" in
220 wep)
221 wl wpa_auth 0
222 /usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l ${ifname}} -H 34954 -i $IFACE &
223 [ "$IF_WIRELESS_BRIDGE_IF" ] && echo "/usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l ${ifname}} -H 34954 -i $IFACE &" >/var/run/nas.lan.cmd
224 exit 0
225 ;;
226 wpa)
227 auth=2
228 ;;
229 wpa2)
230 auth=64
231 ;;
232 "wpa wpa2")
233 auth=66
234 ;;
235 esac
236 wl wpa_auth $auth
237 wl ssid $IF_WIRELESS_SSID
238
239 /usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l $ifname} -H 34954 -i $IFACE -A -m $auth -r "$IF_WIRELESS_RADIUS_KEY" -h $IF_WIRELESS_RADIUS_IPADDR -p ${IF_WIRELESS_RADIUS_PORT:-1812} -t 36000 -s "$IF_WIRELESS_SSID" -w $crypto_num -g $gtk_rekey &
240 [ "$IF_WIRELESS_BRIDGE_IF" ] && echo "/usr/sbin/nas -P /var/run/nas.lan.pid ${ifname:+ -l $ifname} -H 34954 -i $IFACE -A -m $auth -r \"$IF_WIRELESS_RADIUS_KEY\" -h $IF_WIRELESS_RADIUS_IPADDR -p ${IF_WIRELESS_RADIUS_PORT:-1812} -t 36000 -s \"$IF_WIRELESS_SSID\" -w $crypto_num -g $gtk_rekey &" >/var/run/nas.lan.cmd
241 exit 0
242 }
243
244 exit 0

Properties

Name Value
svn:executable *

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20