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
78 # make sure the interfaces are down and removed from all bridges
79 for dev
in wl0 wl0.1 wl0.2 wl0.3
; do
80 ifconfig
"$dev" down
2>/dev
/null
>/dev
/null
&& {
90 config_get channel
"$device" channel
91 config_get country
"$device" country
92 config_get maxassoc
"$device" maxassoc
93 config_get wds
"$device" wds
94 config_get vifs
"$device" vifs
95 config_get distance
"$device" distance
96 config_get slottime
"$device" slottime
97 local vif_pre_up vif_post_up vif_do_up
104 [ -z "$slottime" ] && {
105 [ -n "$distance" ] && {
106 # slottime = 9 + (distance / 150) + (distance % 150 ? 1 : 0)
107 slottime
="$((9 + ($distance / 150) + 1 - (150 - ($distance % 150)) / 150 ))"
110 slottime
="${slottime:--1}"
114 config_get mode
"$vif" mode
115 append vif_pre_up
"vif $_c" "$N"
116 append vif_post_up
"vif $_c" "$N"
118 [ "$mode" = "sta" ] ||
{
119 config_get_bool hidden
"$vif" hidden
1
120 append vif_pre_up
"closed $hidden" "$N"
121 config_get_bool isolate
"$vif" isolate
122 append vif_pre_up
"ap_isolate $isolate" "$N"
130 config_get enc
"$vif" encryption
136 config_get key
"$vif" key
140 for knr
in 1 2 3 4; do
141 config_get k
"$vif" key
$knr
142 [ -n "$k" ] ||
continue
143 [ "$defkey" = "$knr" ] && def
="=" || def
=""
144 append vif_pre_up
"wepkey $def$knr,$k" "$N"
148 *) append vif_pre_up
"wepkey =1,$key" "$N";;
153 config_get key
"$vif" key
155 wpa2
*|WPA2
*|PSK2
*|psk2
*) auth
=128; wsec
=4;;
158 eval "${vif}_key=\"\$key\""
159 nasopts
="-k \"\$${vif}_key\""
164 config_get key
"$vif" key
165 config_get server
"$vif" server
166 config_get port
"$vif" port
168 wpa2
*|WPA2
*) auth
=64; wsec
=4;;
171 eval "${vif}_key=\"\$key\""
172 nasopts
="-r \"\$${vif}_key\" -h $server -p $port"
175 append vif_post_up
"wsec $wsec" "$N"
176 append vif_post_up
"wpa_auth $auth" "$N"
177 append vif_post_up
"wsec_restrict $wsec_r" "$N"
178 append vif_post_up
"eap_restrict $eap_r" "$N"
180 config_get ssid
"$vif" ssid
181 append vif_post_up
"vlan_mode 0"
182 append vif_post_up
"ssid $ssid" "$N"
184 sta|adhoc
) append vif_do_up
"ssid $ssid" "$N";;
187 append vif_post_up
"enabled 1" "$N"
189 config_get ifname
"$vif" ifname
190 append if_up
"ifconfig $ifname up" ";$N"
192 net_cfg
="$(find_net_config "$vif")"
193 [ -z "$net_cfg" ] ||
{
194 bridge
="$(bridge_interface "$net_cfg")"
195 append if_up
"start_net '$ifname' '$net_cfg'" ";$N"
197 [ -z "$nasopts" ] ||
{
198 eval "${vif}_ssid=\"\$ssid\""
200 [ "$vif" = "$sta_if" ] && mode
="-S"
201 [ -z "$nas" ] || nas_cmd
="${nas_cmd:+$nas_cmd$N}$nas -P /var/run/nas.$ifname.pid -H 34954 ${bridge:+ -l $bridge} -i $ifname $mode -m $auth -w $wsec -s \"\$${vif}_ssid\" -g 3600 $nasopts &"
205 killall
-KILL nas
>&- 2>&-
219 channel ${channel:-0}
220 country ${country:-IL0}
221 maxassoc ${maxassoc:-128}
222 slottime ${slottime:--1}
237 [ -f /proc
/net
/wl0
] ||
return
238 config_get
type wl0
type
239 [ "$type" = broadcom
] && return
241 config wifi-device wl0
250 option encryption none