- case "$enc" in
- PSK|psk|PSK2|psk2)
- case "$enc" in
- PSK|psk)
- proto='proto=WPA'
- passphrase="${key}"
- ;;
- PSK2|psk2)
- proto='proto=RSN'
- passphrase=`wpa_passphrase ${ssid} "${key}" | grep psk | grep -v \#| cut -d= -f2`
- ;;
- esac
-
- cat > /var/run/wpa_supplicant-$ifname.conf <<EOF
-network={
- scan_ssid=1
- ssid="$ssid"
- key_mgmt=WPA-PSK
- $proto
- psk=$passphrase
-}
-EOF
- ;;
- WPA|wpa|WPA2|wpa2)
- #add wpa_supplicant calls here
- ;;
- esac
- [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -B -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
+ if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
+ wpa_supplicant_setup_vif "$vif" madwifi || {
+ echo "enable_atheros($device): Failed to set up wpa_supplicant for interface $ifname" >&2
+ ifconfig "$ifname" down
+ wlanconfig "$ifname" destroy
+ continue
+ }
+ fi