1 append DRIVERS
"broadcom"
7 local adhoc_if sta_if ap_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"
29 *) echo "$device($vif): Invalid mode";;
32 config_set
"$device" wds
"$wds"
35 for vif
in ${adhoc_if:-$sta_if $ap_if}; do
36 config_set
"$vif" ifname
"wl0${_c:+.$_c}"
39 config_set
"$device" vifs
"${adhoc_if:-$sta_if $ap_if}"
42 for vif
in 0 1 2 3; do
43 append ifdown
"vif $vif" "$N"
44 append ifdown
"enabled 0" "$N"
52 case "$adhoc:$sta:$apmode" in
79 # make sure the interfaces are down and removed from all bridges
80 for dev
in wl0 wl0.1 wl0.2 wl0.3
; do
81 ifconfig
"$dev" down
2>/dev
/null
>/dev
/null
&& {
91 config_get channel
"$device" channel
92 config_get country
"$device" country
93 config_get maxassoc
"$device" maxassoc
94 config_get wds
"$device" wds
95 config_get vifs
"$device" vifs
96 config_get distance
"$device" distance
97 config_get slottime
"$device" slottime
98 config_get rxant
"$device" rxant
99 config_get txant
"$device" txant
100 local vif_pre_up vif_post_up vif_do_up
107 [ -z "$slottime" ] && {
108 [ -n "$distance" ] && {
109 # slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
110 slottime
="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
113 slottime
="${slottime:--1}"
117 config_get mode
"$vif" mode
118 append vif_pre_up
"vif $_c" "$N"
119 append vif_post_up
"vif $_c" "$N"
121 [ "$mode" = "sta" ] ||
{
122 config_get_bool hidden
"$vif" hidden
0
123 append vif_pre_up
"closed $hidden" "$N"
124 config_get_bool isolate
"$vif" isolate
0
125 append vif_pre_up
"ap_isolate $isolate" "$N"
133 config_get enc
"$vif" encryption
139 config_get key
"$vif" key
143 for knr
in 1 2 3 4; do
144 config_get k
"$vif" key
$knr
145 [ -n "$k" ] ||
continue
146 [ "$defkey" = "$knr" ] && def
="=" || def
=""
147 append vif_pre_up
"wepkey $def$knr,$k" "$N"
151 *) append vif_pre_up
"wepkey =1,$key" "$N";;
156 config_get key
"$vif" key
158 wpa
*+wpa2
*|WPA
*+WPA2
*|
*psk
+*psk2|
*PSK
+*PSK2
) auth
=132; wsec
=6;;
159 wpa2
*|WPA2
*|
*PSK2|
*psk2
) auth
=128; wsec
=4;;
162 eval "${vif}_key=\"\$key\""
163 nasopts
="-k \"\$${vif}_key\""
168 config_get key
"$vif" key
169 config_get server
"$vif" server
170 config_get port
"$vif" port
172 wpa
*+wpa2
*|WPA
*+WPA2
*) auth
=66; wsec
=6;;
173 wpa2
*|WPA2
*) auth
=64; wsec
=4;;
176 eval "${vif}_key=\"\$key\""
177 nasopts
="-r \"\$${vif}_key\" -h $server -p $port"
180 append vif_post_up
"wsec $wsec" "$N"
181 append vif_post_up
"wpa_auth $auth" "$N"
182 append vif_post_up
"wsec_restrict $wsec_r" "$N"
183 append vif_post_up
"eap_restrict $eap_r" "$N"
185 config_get ssid
"$vif" ssid
186 append vif_post_up
"vlan_mode 0" "$N"
187 append vif_post_up
"ssid $ssid" "$N"
189 sta|adhoc
) append vif_do_up
"ssid $ssid" "$N";;
192 append vif_post_up
"enabled 1" "$N"
194 config_get ifname
"$vif" ifname
195 #append if_up "ifconfig $ifname up" ";$N"
197 net_cfg
="$(find_net_config "$vif")"
198 [ -z "$net_cfg" ] ||
{
199 bridge
="$(bridge_interface "$net_cfg")"
200 append if_up
"start_net '$ifname' '$net_cfg'" ";$N"
201 append if_up
"set_wifi_up '$vif' '$ifname'" ";$N"
203 [ -z "$nasopts" ] ||
{
204 eval "${vif}_ssid=\"\$ssid\""
207 [ "$mode" = "sta" ] && {
209 [ -z "$bridge" ] ||
{
210 append vif_pre_up
"supplicant 1" "$N"
211 append vif_pre_up
"passphrase $key" "$N"
216 [ -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 &"
220 killall
-KILL nas
>&- 2>&-
239 ${channel:+channel $channel}
240 country ${country:-IL0}
241 maxassoc ${maxassoc:-128}
242 slottime ${slottime:--1}
257 [ -f /proc
/net
/wl0
] ||
return
258 config_get
type wl0
type
259 [ "$type" = broadcom
] && return
261 config wifi-device wl0
265 # REMOVE THIS LINE TO ENABLE WIFI:
273 option encryption none