de9870ce651ba91dd5815ebb083a947ab7c97440
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 }"
54 # psk-mixed/tkip => WPA1+2 PSK, TKIP
55 # wpa-psk2/tkip+aes => WPA2 PSK, CCMP+TKIP
56 # wpa2/tkip+aes => WPA2 RADIUS, CCMP+TKIP
59 # TODO: move this parsing function somewhere generic, so that
60 # later it can be reused by drivers that don't use hostapd
62 # crypto defaults: WPA2 vs WPA1
64 wpa2
*|WPA2
*|
*PSK2
*|
*psk2
*)
78 # explicit override for crypto setting
80 *tkip
+aes|
*TKIP
+AES|
*tkip
+ccmp|
*TKIP
+CCMP
) crypto
="CCMP TKIP";;
81 *tkip|
*TKIP
) crypto
="TKIP";;
82 *aes|
*AES|
*ccmp|
*CCMP
) crypto
="CCMP";;
85 # use crypto/auth settings for building the hostapd config
88 config_get psk
"$vif" key
89 append hostapd_cfg
"wpa_passphrase=$psk" "$N"
92 # FIXME: add wpa+radius here
98 config_get ifname
"$vif" ifname
99 config_get bridge
"$vif" bridge
100 config_get ssid
"$vif" ssid
101 cat > /var
/run
/hostapd-
$ifname.conf
<<EOF
104 ${bridge:+bridge=$bridge}
111 hostapd
-B /var
/run
/hostapd-
$ifname.conf
117 # kill all running hostapd and wpa_supplicant processes that
118 # are running on atheros vifs
119 for pid
in `pidof hostapd wpa_supplicant`; do
120 grep ath
/proc
/$pid/cmdline
>/dev
/null
&& \
127 grep "$device" "$dev/%parent" >/dev
/null
2>/dev
/null
&& {
130 wlanconfig
"$dev" destroy
137 config_get channel
"$device" channel
138 config_get vifs
"$device" vifs
140 disable_atheros
"$device"
143 config_get ifname
"$vif" ifname
144 config_get enc
"$vif" encryption
145 config_get mode
"$vif" mode
147 [ "$mode" = sta
] && config_get nosbeacon
"$device" nosbeacon
149 config_get ifname
"$vif" ifname
150 ifname
=$
(wlanconfig
"$ifname" create wlandev
"$device" wlanmode
"$mode" ${nosbeacon:+nosbeacon})
152 echo "enable_atheros($device): Failed to set up $mode vif $ifname" >&2
155 config_set
"$vif" ifname
"$ifname"
157 config_get wds
"$vif" wds
159 1|on|enabled
) wds
=1;;
162 iwpriv
"$ifname" wds
"$wds"
167 for idx
in 1 2 3 4; do
168 config_get key
"$vif" "key${idx}"
169 iwconfig
"$ifname" enc
"[$idx]" "${key:-off}"
171 config_get key
"$vif" key
172 iwconfig
"$ifname" enc
"[${key:-1}]"
178 config_get addr
"$vif" bssid
179 iwpriv
"$ifname" wds_add
"$addr"
182 config_get ssid
"$vif" ssid
185 iwconfig
"$ifname" channel
"$channel"
186 ifconfig
"$ifname" up
189 net_cfg
="$(find_net_config "$vif")"
190 [ -z "$net_cfg" ] ||
{
191 bridge
="$(bridge_interface "$net_cfg")"
192 config_set
"$vif" bridge
"$bridge"
193 start_net
"$ifname" "$net_cfg"
197 hostapd_setup_vif
"$vif" madwifi ||
{
198 echo "enable_atheros($device): Failed to set up wpa for interface $ifname" >&2
199 # make sure this wifi interface won't accidentally stay open without encryption
200 ifconfig
"$ifname" down
201 wlanconfig
"$ifname" destroy
206 iwconfig
"$ifname" essid
"$ssid"
207 # FIXME: implement wpa_supplicant calls here
218 config_get
type "$dev" type
219 [ "$type" = atheros
] && return
221 config wifi-device $dev
231 option encryption none
This page took 0.052657 seconds and 3 git commands to generate.