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
27 [ -z "$addr" ] || append wds
"$addr"
33 *) echo "$device($vif): Invalid mode";;
36 config_set
"$device" wds
"$wds"
39 for vif
in ${adhoc_if:-$sta_if $ap_if $mon_if}; do
40 config_set
"$vif" ifname
"wl0${_c:+.$_c}"
43 config_set
"$device" vifs
"${adhoc_if:-$sta_if $ap_if $mon_if}"
46 for vif
in 0 1 2 3; do
47 append ifdown
"vif $vif" "$N"
48 append ifdown
"enabled 0" "$N"
58 case "$adhoc:$sta:$apmode:$mon" in
92 # make sure the interfaces are down and removed from all bridges
93 for dev
in wl0 wl0.1 wl0.2 wl0.3
; do
94 ifconfig
"$dev" down
2>/dev
/null
>/dev
/null
&& {
104 config_get channel
"$device" channel
105 config_get country
"$device" country
106 config_get maxassoc
"$device" maxassoc
107 config_get wds
"$device" wds
108 config_get vifs
"$device" vifs
109 config_get distance
"$device" distance
110 config_get slottime
"$device" slottime
111 config_get rxant
"$device" rxant
112 config_get txant
"$device" txant
113 config_get_bool frameburst
"$device" frameburst
114 config_get macfilter
"$device" macfilter
115 config_get maclist
"$device" maclist
116 local vif_pre_up vif_post_up vif_do_up
123 [ -z "$slottime" ] && {
124 [ -n "$distance" ] && {
125 # slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
126 slottime
="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
129 slottime
="${slottime:--1}"
145 config_get mode
"$vif" mode
146 append vif_pre_up
"vif $_c" "$N"
147 append vif_post_up
"vif $_c" "$N"
149 [ "$mode" = "sta" ] ||
{
150 config_get_bool hidden
"$vif" hidden
0
151 append vif_pre_up
"closed $hidden" "$N"
152 config_get_bool isolate
"$vif" isolate
0
153 append vif_pre_up
"ap_isolate $isolate" "$N"
161 config_get enc
"$vif" encryption
167 config_get key
"$vif" key
171 for knr
in 1 2 3 4; do
172 config_get k
"$vif" key
$knr
173 [ -n "$k" ] ||
continue
174 [ "$defkey" = "$knr" ] && def
="=" || def
=""
175 append vif_do_up
"wepkey $def$knr,$k" "$N"
179 *) append vif_do_up
"wepkey =1,$key" "$N";;
184 config_get key
"$vif" key
186 wpa
*+wpa2
*|WPA
*+WPA2
*|
*psk
+*psk2|
*PSK
+*PSK2
) auth
=132; wsec
=6;;
187 wpa2
*|WPA2
*|
*PSK2|
*psk2
) auth
=128; wsec
=4;;
190 eval "${vif}_key=\"\$key\""
191 nasopts
="-k \"\$${vif}_key\""
196 config_get key
"$vif" key
197 config_get server
"$vif" server
198 config_get port
"$vif" port
200 wpa
*+wpa2
*|WPA
*+WPA2
*) auth
=66; wsec
=6;;
201 wpa2
*|WPA2
*) auth
=64; wsec
=4;;
204 eval "${vif}_key=\"\$key\""
205 nasopts
="-r \"\$${vif}_key\" -h $server -p ${port:-1812}"
208 append vif_do_up
"wsec $wsec" "$N"
209 append vif_do_up
"wpa_auth $auth" "$N"
210 append vif_do_up
"wsec_restrict $wsec_r" "$N"
211 append vif_do_up
"eap_restrict $eap_r" "$N"
213 config_get ssid
"$vif" ssid
214 append vif_post_up
"vlan_mode 0" "$N"
215 append vif_post_up
"ssid $ssid" "$N"
216 append vif_do_up
"ssid $ssid" "$N"
218 [ "$mode" = "monitor" ] && {
219 append vif_post_up
"monitor $monitor" "$N"
220 append vif_post_up
"passive $passive" "$N"
223 append vif_post_up
"enabled 1" "$N"
225 config_get ifname
"$vif" ifname
226 #append if_up "ifconfig $ifname up" ";$N"
228 net_cfg
="$(find_net_config "$vif")"
229 [ -z "$net_cfg" ] ||
{
230 bridge
="$(bridge_interface "$net_cfg")"
231 append if_up
"start_net '$ifname' '$net_cfg'" ";$N"
232 append if_up
"set_wifi_up '$vif' '$ifname'" ";$N"
234 [ -z "$nasopts" ] ||
{
235 eval "${vif}_ssid=\"\$ssid\""
238 [ "$mode" = "sta" ] && {
240 [ -z "$bridge" ] ||
{
241 append vif_post_up
"supplicant 1" "$N"
242 append vif_post_up
"passphrase $key" "$N"
247 [ -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 &"
251 killall
-KILL nas
>&- 2>&-
256 ${mssid:+mssid $mssid}
264 monitor ${monitor:-0}
265 passive ${passive:-0}
268 macfilter ${macfilter:-0}
269 maclist ${maclist:-none}
272 country ${country:-IL0}
273 ${channel:+channel $channel}
274 maxassoc ${maxassoc:-128}
275 slottime ${slottime:--1}
276 ${frameburst:+frameburst $frameburst}
291 [ -f /proc
/net
/wl0
] ||
return
292 config_get
type wl0
type
293 [ "$type" = broadcom
] && return
295 config wifi-device wl0
299 # REMOVE THIS LINE TO ENABLE WIFI:
307 option encryption none