1 append DRIVERS
"broadcom"
6 local adhoc sta apmode mon
7 local adhoc_if sta_if ap_if mon_if
9 config_get vifs
"$device" vifs
11 config_get mode
"$vif" mode
23 ap_if
="${ap_if:+$ap_if }$vif"
26 config_get addr
"$vif" bssid
28 addr
=$
(echo "$addr" |
tr 'A-F' 'a-f')
36 *) echo "$device($vif): Invalid mode";;
39 config_set
"$device" wds
"$wds"
42 for vif
in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
43 config_set
"$vif" ifname
"wl0${_c:+.$_c}"
46 config_set
"$device" vifs
"${adhoc_if:-$sta_if $ap_if $mon_if}"
49 for vif
in 0 1 2 3; do
50 append ifdown
"vif $vif" "$N"
51 append ifdown
"enabled 0" "$N"
61 case "$adhoc:$sta:$apmode:$mon" in
95 # make sure the interfaces are down and removed from all bridges
96 for dev
in wl0 wl0.1 wl0.2 wl0.3
; do
97 ifconfig
"$dev" down
2>/dev
/null
>/dev
/null
&& {
107 config_get channel
"$device" channel
108 config_get country
"$device" country
109 config_get maxassoc
"$device" maxassoc
110 config_get wds
"$device" wds
111 config_get vifs
"$device" vifs
112 config_get distance
"$device" distance
113 config_get slottime
"$device" slottime
114 config_get rxant
"$device" rxant
115 config_get txant
"$device" txant
116 config_get_bool frameburst
"$device" frameburst
117 config_get macfilter
"$device" macfilter
118 config_get maclist
"$device" maclist
119 local vif_pre_up vif_post_up vif_do_up
126 [ -z "$slottime" ] && {
127 [ -n "$distance" ] && {
128 # slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
129 slottime
="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
132 slottime
="${slottime:--1}"
148 config_get mode
"$vif" mode
149 append vif_pre_up
"vif $_c" "$N"
150 append vif_post_up
"vif $_c" "$N"
152 [ "$mode" = "sta" ] ||
{
153 config_get_bool hidden
"$vif" hidden
0
154 append vif_pre_up
"closed $hidden" "$N"
155 config_get_bool isolate
"$vif" isolate
0
156 append vif_pre_up
"ap_isolate $isolate" "$N"
164 config_get enc
"$vif" encryption
170 config_get key
"$vif" key
174 for knr
in 1 2 3 4; do
175 config_get k
"$vif" key
$knr
176 [ -n "$k" ] ||
continue
177 [ "$defkey" = "$knr" ] && def
="=" || def
=""
178 append vif_do_up
"wepkey $def$knr,$k" "$N"
182 *) append vif_do_up
"wepkey =1,$key" "$N";;
187 config_get key
"$vif" key
189 wpa
*+wpa2
*|WPA
*+WPA2
*|
*psk
+*psk2|
*PSK
+*PSK2
) auth
=132; wsec
=6;;
190 wpa2
*|WPA2
*|
*PSK2|
*psk2
) auth
=128; wsec
=4;;
193 eval "${vif}_key=\"\$key\""
194 nasopts
="-k \"\$${vif}_key\""
199 config_get key
"$vif" key
200 config_get server
"$vif" server
201 config_get port
"$vif" port
203 wpa
*+wpa2
*|WPA
*+WPA2
*) auth
=66; wsec
=6;;
204 wpa2
*|WPA2
*) auth
=64; wsec
=4;;
207 eval "${vif}_key=\"\$key\""
208 nasopts
="-r \"\$${vif}_key\" -h $server -p ${port:-1812}"
211 append vif_do_up
"wsec $wsec" "$N"
212 append vif_do_up
"wpa_auth $auth" "$N"
213 append vif_do_up
"wsec_restrict $wsec_r" "$N"
214 append vif_do_up
"eap_restrict $eap_r" "$N"
216 config_get ssid
"$vif" ssid
217 append vif_post_up
"vlan_mode 0" "$N"
218 append vif_post_up
"ssid $ssid" "$N"
219 append vif_do_up
"ssid $ssid" "$N"
221 [ "$mode" = "monitor" ] && {
222 append vif_post_up
"monitor $monitor" "$N"
223 append vif_post_up
"passive $passive" "$N"
226 append vif_post_up
"enabled 1" "$N"
228 config_get ifname
"$vif" ifname
229 #append if_up "ifconfig $ifname up" ";$N"
231 net_cfg
="$(find_net_config "$vif")"
232 [ -z "$net_cfg" ] ||
{
233 bridge
="$(bridge_interface "$net_cfg")"
234 append if_up
"start_net '$ifname' '$net_cfg'" ";$N"
235 append if_up
"set_wifi_up '$vif' '$ifname'" ";$N"
237 [ -z "$nasopts" ] ||
{
238 eval "${vif}_ssid=\"\$ssid\""
241 [ "$mode" = "sta" ] && {
243 [ -z "$bridge" ] ||
{
244 append vif_post_up
"supplicant 1" "$N"
245 append vif_post_up
"passphrase $key" "$N"
250 [ -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 &"
254 killall
-KILL nas
>&- 2>&-
259 ${mssid:+mssid $mssid}
267 monitor ${monitor:-0}
268 passive ${passive:-0}
271 macfilter ${macfilter:-0}
272 maclist ${maclist:-none}
275 country ${country:-IL0}
276 ${channel:+channel $channel}
277 maxassoc ${maxassoc:-128}
278 slottime ${slottime:--1}
279 ${frameburst:+frameburst $frameburst}
294 [ -f /proc
/net
/wl0
] ||
return
295 config_get
type wl0
type
296 [ "$type" = broadcom
] && return
298 config wifi-device wl0
302 # REMOVE THIS LINE TO ENABLE WIFI:
310 option encryption none