2 append DRIVERS
"atheros"
9 config_get vifs
"$device" vifs
12 config_get ifname
"$vif" ifname
13 config_set
"$vif" ifname
"${ifname:-ath}"
15 config_get mode
"$vif" mode
21 config_get addr
"$vif" bssid
22 config_get ssid
"$vif" ssid
23 [ -z "$addr" -a -n "$ssid" ] && {
24 config_set
"$vif" wds
1
25 config_set
"$vif" mode sta
29 ${addr:+append $mode "$vif"}
31 *) echo "$device($vif): Invalid mode, ignored."; continue;;
35 case "${adhoc:+1}:${sta:+1}:${ap+1}" in
36 # valid mode combinations
39 :1:1)config_set
"$device" nosbeacon
1;; # AP+STA, can't use beacon timers for STA
43 *) echo "$device: Invalid mode combination in config"; return 1;;
46 config_set
"$device" vifs
"${ap:+$ap }${adhoc:+$adhoc }${ahdemo:+$ahdemo }${sta:+$sta }${wds:+$wds }"
53 # kill all running hostapd and wpa_supplicant processes that
54 # are running on atheros vifs
55 for pid
in `pidof hostapd wpa_supplicant`; do
56 grep ath
/proc
/$pid/cmdline
>/dev
/null
&& \
63 grep "$device" "$dev/%parent" >/dev
/null
2>/dev
/null
&& {
66 wlanconfig
"$dev" destroy
73 config_get channel
"$device" channel
74 config_get vifs
"$device" vifs
76 disable_atheros
"$device"
80 config_get ifname
"$vif" ifname
81 config_get enc
"$vif" encryption
82 config_get mode
"$vif" mode
84 [ "$mode" = sta
] && config_get nosbeacon
"$device" nosbeacon
86 config_get ifname
"$vif" ifname
87 ifname
=$
(wlanconfig
"$ifname" create wlandev
"$device" wlanmode
"$mode" ${nosbeacon:+nosbeacon})
89 echo "enable_atheros($device): Failed to set up $mode vif $ifname" >&2
92 config_set
"$vif" ifname
"$ifname"
95 # only need to change freq band and channel on the first vif
96 config_get agmode
"$device" mode
101 *g
) agmode
=11g
; pureg
=1;;
105 iwconfig
"$ifname" channel
0 >/dev
/null
2>/dev
/null
106 ifconfig
"$ifname" up
108 iwpriv
"$ifname" mode
"$agmode"
109 iwpriv
"$ifname" pureg
"$pureg"
110 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
113 config_get_bool hidden
"$vif" hidden
0
114 iwpriv
"$ifname" hide_ssid
"$hidden"
116 config_get_bool ff
"$vif" ff
0
117 iwpriv
"$ifname" ff
"$ff"
119 config_get wds
"$vif" wds
121 1|on|enabled
) wds
=1;;
124 iwpriv
"$ifname" wds
"$wds"
129 for idx
in 1 2 3 4; do
130 config_get key
"$vif" "key${idx}"
131 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
133 config_get key
"$vif" key
136 [1234]) iwconfig
"$ifname" enc
"[$key]";;
137 *) iwconfig
"$ifname" enc
"$key";;
141 config_get key
"$vif" key
147 config_get addr
"$vif" bssid
148 iwpriv
"$ifname" wds_add
"$addr"
151 config_get addr
"$vif" bssid
153 iwconfig
"$ifname" ap
"$addr"
157 config_get ssid
"$vif" ssid
159 [ "$mode" = "sta" ] && {
160 config_get_bool bgscan
"$vif" bgscan
1
161 iwpriv
"$ifname" bgscan
"$bgscan"
164 config_get_bool antdiv
"$device" diversity
1
165 sysctl
-w dev.
"$device".diversity
="$antdiv" >&-
167 config_get antrx
"$device" rxantenna
168 if [ -n "$antrx" ]; then
169 sysctl
-w dev.
"$device".rxantenna
="$antrx" >&-
172 config_get anttx
"$device" txantenna
173 if [ -n "$anttx" ]; then
174 sysctl
-w dev.
"$device".txantenna
="$anttx" >&-
177 config_get distance
"$device" distance
178 if [ -n "$distance" ]; then
179 athctrl
-i "$device" -d "$distance" >&-
182 config_get txpwr
"$vif" txpower
183 if [ -n "$txpwr" ]; then
184 iwconfig
"$ifname" txpower
"${txpwr%%.*}"
187 config_get frag
"$vif" frag
188 if [ -n "$frag" ]; then
189 iwconfig
"$ifname" frag
"${frag%%.*}"
192 config_get rts
"$vif" rts
193 if [ -n "$rts" ]; then
194 iwconfig
"$ifname" rts
"${rts%%.*}"
197 ifconfig
"$ifname" up
198 iwconfig
"$ifname" channel
"$channel" >/dev
/null
2>/dev
/null
201 net_cfg
="$(find_net_config "$vif")"
202 [ -z "$net_cfg" ] ||
{
203 bridge
="$(bridge_interface "$net_cfg")"
204 config_set
"$vif" bridge
"$bridge"
205 start_net
"$ifname" "$net_cfg"
207 iwconfig
"$ifname" essid
"$ssid"
210 config_get_bool isolate
"$vif" isolate
0
211 iwpriv
"$ifname" ap_bridge
"$((isolate^1))"
213 if eval "type hostapd_setup_vif" 2>/dev
/null
>/dev
/null
; then
214 hostapd_setup_vif
"$vif" madwifi ||
{
215 echo "enable_atheros($device): Failed to set up wpa for interface $ifname" >&2
216 # make sure this wifi interface won't accidentally stay open without encryption
217 ifconfig
"$ifname" down
218 wlanconfig
"$ifname" destroy
232 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
233 ctrl_interface=/var/run/wpa_supplicant
244 #add wpa_supplicant calls here
247 [ -z "$proto" ] || wpa_supplicant
${bridge:+ -b $bridge} -Bw -D wext
-i "$ifname" -c /var
/run
/wpa_supplicant-
$ifname.conf
258 for dev
in $
(ls -d wifi
* 2>&-); do
259 config_get
type "$dev" type
260 [ "$type" = atheros
] && return
262 config wifi-device $dev
266 # REMOVE THIS LINE TO ENABLE WIFI:
274 option encryption none
This page took 0.0669149999999999 seconds and 5 git commands to generate.