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
38 :1:1)config_set
"$device" nosbeacon
1;; # AP+STA, can't use beacon timers for STA
42 *) echo "$device: Invalid mode combination in config"; return 1;;
45 config_set
"$device" vifs
"${ap:+$ap }${adhoc:+$adhoc }${sta:+$sta }${wds:+$wds }"
52 # kill all running hostapd and wpa_supplicant processes that
53 # are running on atheros vifs
54 for pid
in `pidof hostapd wpa_supplicant`; do
55 grep ath
/proc
/$pid/cmdline
>/dev
/null
&& \
62 grep "$device" "$dev/%parent" >/dev
/null
2>/dev
/null
&& {
65 wlanconfig
"$dev" destroy
72 config_get channel
"$device" channel
73 config_get vifs
"$device" vifs
75 disable_atheros
"$device"
79 config_get ifname
"$vif" ifname
80 config_get enc
"$vif" encryption
81 config_get mode
"$vif" mode
83 [ "$mode" = sta
] && config_get nosbeacon
"$device" nosbeacon
85 config_get ifname
"$vif" ifname
86 ifname
=$
(wlanconfig
"$ifname" create wlandev
"$device" wlanmode
"$mode" ${nosbeacon:+nosbeacon})
88 echo "enable_atheros($device): Failed to set up $mode vif $ifname" >&2
91 config_set
"$vif" ifname
"$ifname"
94 # only need to change freq band and channel on the first vif
95 config_get agmode
"$device" mode
100 *g
) agmode
=11g
; pureg
=1;;
104 iwconfig
"$ifname" channel
0
105 iwpriv
"$ifname" mode
"$agmode"
106 iwpriv
"$ifname" pureg
"$pureg"
107 iwconfig
"$ifname" channel
"$channel"
110 config_get_bool hidden
"$vif" hidden
111 iwpriv
"$ifname" hide_ssid
"$hidden"
113 config_get wds
"$vif" wds
115 1|on|enabled
) wds
=1;;
118 iwpriv
"$ifname" wds
"$wds"
123 for idx
in 1 2 3 4; do
124 config_get key
"$vif" "key${idx}"
125 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
127 config_get key
"$vif" key
130 [1234]) iwconfig
"$ifname" enc
"[$key]";;
131 *) iwconfig
"$ifname" enc
"$key";;
135 config_get key
"$vif" key
141 config_get addr
"$vif" bssid
142 iwpriv
"$ifname" wds_add
"$addr"
145 config_get ssid
"$vif" ssid
148 config_get addr
"$vif" bssid
150 iwconfig
"$ifname" ap
"$addr"
155 [ "$mode" = "sta" ] && {
156 config_get_bool bgscan
"$vif" bgscan
1
157 iwpriv
"$ifname" bgscan
"$bgscan"
160 config_get_bool antdiv
"$device" diversity
1
161 sysctl
-w dev.
"$device".diversity
="$antdiv" >&-
163 config_get antrx
"$device" rxantenna
164 if [ -n "$antrx" ]; then
165 sysctl
-w dev.
"$device".rxantenna
="$antrx" >&-
168 config_get anttx
"$device" txantenna
169 if [ -n "$anttx" ]; then
170 sysctl
-w dev.
"$device".txantenna
="$anttx" >&-
173 config_get distance
"$device" distance
174 if [ -n "$distance" ]; then
175 athctrl
-i "$device" -d "$distance" >&-
178 config_get txpwr
"$vif" txpower
179 if [ -n "$txpwr" ]; then
180 iwconfig
"$ifname" txpower
"${txpwr%%.*}"
183 ifconfig
"$ifname" up
186 net_cfg
="$(find_net_config "$vif")"
187 [ -z "$net_cfg" ] ||
{
188 bridge
="$(bridge_interface "$net_cfg")"
189 config_set
"$vif" bridge
"$bridge"
190 start_net
"$ifname" "$net_cfg"
192 iwconfig
"$ifname" essid
"$ssid"
195 hostapd_setup_vif
"$vif" madwifi ||
{
196 echo "enable_atheros($device): Failed to set up wpa for interface $ifname" >&2
197 # make sure this wifi interface won't accidentally stay open without encryption
198 ifconfig
"$ifname" down
199 wlanconfig
"$ifname" destroy
212 cat > /var
/run
/wpa_supplicant-
$ifname.conf
<<EOF
213 ctrl_interface=/var/run/wpa_supplicant
224 #add wpa_supplicant calls here
227 [ -z "$proto" ] || wpa_supplicant
${bridge:+ -b $bridge} -Bw -D wext
-i "$ifname" -c /var
/run
/wpa_supplicant-
$ifname.conf
238 for dev
in $
(ls -d wifi
* 2>&-); do
239 config_get
type "$dev" type
240 [ "$type" = atheros
] && return
242 config wifi-device $dev
248 # option distance 2000
249 # disable radio to prevent an open ap after reflashing:
260 # option bgscan enable
261 option encryption none
This page took 0.064067 seconds and 5 git commands to generate.