1 append DRIVERS
"broadcom"
6 local adhoc sta apmode mon
7 local adhoc_if sta_if ap_if mon_if
10 config_get vifs
"$device" vifs
12 config_get mode
"$vif" mode
25 ap_if
="${ap_if:+$ap_if }$vif"
28 config_get addr
"$vif" bssid
30 addr
=$
(echo "$addr" |
tr 'A-F' 'a-f')
38 *) echo "$device($vif): Invalid mode";;
41 config_set
"$device" wds
"$wds"
44 for vif
in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
45 config_set
"$vif" ifname
"wl0${_c:+.$_c}"
48 config_set
"$device" vifs
"${adhoc_if:-$sta_if $ap_if $mon_if}"
51 for vif
in 0 1 2 3; do
52 append ifdown
"vif $vif" "$N"
53 append ifdown
"enabled 0" "$N"
58 if [ "$_c" -gt 1 ]; then
67 case "$adhoc:$sta:$apmode:$mon" in
101 # make sure the interfaces are down and removed from all bridges
102 for dev
in wl0 wl0.1 wl0.2 wl0.3
; do
103 ifconfig
"$dev" down
2>/dev
/null
>/dev
/null
&& {
113 config_get channel
"$device" channel
114 config_get country
"$device" country
115 config_get maxassoc
"$device" maxassoc
116 config_get wds
"$device" wds
117 config_get vifs
"$device" vifs
118 config_get distance
"$device" distance
119 config_get slottime
"$device" slottime
120 config_get rxant
"$device" rxant
121 config_get txant
"$device" txant
122 config_get_bool frameburst
"$device" frameburst
123 config_get macfilter
"$device" macfilter
124 config_get maclist
"$device" maclist
125 local vif_pre_up vif_post_up vif_do_up
132 [ -z "$slottime" ] && {
133 [ -n "$distance" ] && {
134 # slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
135 slottime
="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
138 slottime
="${slottime:--1}"
154 config_get mode
"$vif" mode
155 append vif_pre_up
"vif $_c" "$N"
156 append vif_post_up
"vif $_c" "$N"
157 append vif_do_up
"vif $_c" "$N"
159 [ "$mode" = "sta" ] ||
{
160 config_get_bool hidden
"$vif" hidden
0
161 append vif_pre_up
"closed $hidden" "$N"
162 config_get_bool isolate
"$vif" isolate
0
163 append vif_pre_up
"ap_isolate $isolate" "$N"
171 config_get enc
"$vif" encryption
177 config_get key
"$vif" key
181 for knr
in 1 2 3 4; do
182 config_get k
"$vif" key
$knr
183 [ -n "$k" ] ||
continue
184 [ "$defkey" = "$knr" ] && def
="=" || def
=""
185 append vif_do_up
"wepkey $def$knr,$k" "$N"
189 *) append vif_do_up
"wepkey =1,$key" "$N";;
194 config_get key
"$vif" key
196 wpa
*+wpa2
*|WPA
*+WPA2
*|
*psk
+*psk2|
*PSK
+*PSK2
) auth
=132; wsec
=6;;
197 wpa2
*|WPA2
*|
*PSK2|
*psk2
) auth
=128; wsec
=4;;
200 eval "${vif}_key=\"\$key\""
201 nasopts
="-k \"\$${vif}_key\""
206 config_get key
"$vif" key
207 config_get server
"$vif" server
208 config_get port
"$vif" port
210 wpa
*+wpa2
*|WPA
*+WPA2
*) auth
=66; wsec
=6;;
211 wpa2
*|WPA2
*) auth
=64; wsec
=4;;
214 eval "${vif}_key=\"\$key\""
215 nasopts
="-r \"\$${vif}_key\" -h $server -p ${port:-1812}"
218 append vif_do_up
"wsec $wsec" "$N"
219 append vif_do_up
"wpa_auth $auth" "$N"
220 append vif_do_up
"wsec_restrict $wsec_r" "$N"
221 append vif_do_up
"eap_restrict $eap_r" "$N"
223 config_get ssid
"$vif" ssid
224 append vif_post_up
"vlan_mode 0" "$N"
225 append vif_post_up
"ssid $ssid" "$N"
226 append vif_do_up
"ssid $ssid" "$N"
228 [ "$mode" = "monitor" ] && {
229 append vif_post_up
"monitor $monitor" "$N"
230 append vif_post_up
"passive $passive" "$N"
233 append vif_post_up
"enabled 1" "$N"
235 config_get ifname
"$vif" ifname
236 #append if_up "ifconfig $ifname up" ";$N"
238 net_cfg
="$(find_net_config "$vif")"
239 [ -z "$net_cfg" ] ||
{
240 bridge
="$(bridge_interface "$net_cfg")"
241 append if_up
"start_net '$ifname' '$net_cfg'" ";$N"
242 append if_up
"set_wifi_up '$vif' '$ifname'" ";$N"
244 [ -z "$nasopts" ] ||
{
245 eval "${vif}_ssid=\"\$ssid\""
248 [ "$mode" = "sta" ] && {
250 [ -z "$bridge" ] ||
{
251 append vif_post_up
"supplicant 1" "$N"
252 append vif_post_up
"passphrase $key" "$N"
257 [ -z "$nas" -o "$use_nas" = "0" ] || nas_cmd
="${nas_cmd:+$nas_cmd$N}$nas -P /var/run/nas.$ifname.pid -H 34954 ${bridge:+ -l $bridge} -i $ifname $nas_mode -m $auth -w $wsec -s \"\$${vif}_ssid\" -g 3600 $nasopts &"
261 killall
-KILL nas
>&- 2>&-
266 ${mssid:+mssid $mssid}
274 monitor ${monitor:-0}
275 passive ${passive:-0}
278 macfilter ${macfilter:-0}
279 maclist ${maclist:-none}
282 country ${country:-IL0}
283 ${channel:+channel $channel}
284 maxassoc ${maxassoc:-128}
285 slottime ${slottime:--1}
286 ${frameburst:+frameburst $frameburst}
301 [ -f /proc
/net
/wl0
] ||
return
302 config_get
type wl0
type
303 [ "$type" = broadcom
] && return
305 config wifi-device wl0
309 # REMOVE THIS LINE TO ENABLE WIFI:
317 option encryption none