*bg) agmode=11g;;
*g) agmode=11g; pureg=1;;
*a) agmode=11a;;
- *) agmode=11g;;
+ *) agmode=auto;;
esac
- iwconfig "$ifname" channel 0
+ iwconfig "$ifname" channel 0 >/dev/null 2>/dev/null
+ ifconfig "$ifname" up
iwpriv "$ifname" mode "$agmode"
iwpriv "$ifname" pureg "$pureg"
- iwconfig "$ifname" channel "$channel"
+ iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
}
config_get_bool hidden "$vif" hidden
iwconfig "$ifname" enc "[$idx]" "${key:-off}"
done
config_get key "$vif" key
- iwconfig "$ifname" enc "${key:-1}"
+ key="${key:-1}"
+ case "$key" in
+ [1234]) iwconfig "$ifname" enc "[$key]";;
+ *) iwconfig "$ifname" enc "$key";;
+ esac
;;
PSK|psk|PSK2|psk2)
config_get key "$vif" key
config_get addr "$vif" bssid
iwpriv "$ifname" wds_add "$addr"
;;
- *)
- config_get ssid "$vif" ssid
- ;;
adhoc)
config_get addr "$vif" bssid
[ -z "$addr" ] || {
}
;;
esac
+ config_get ssid "$vif" ssid
[ "$mode" = "sta" ] && {
config_get_bool bgscan "$vif" bgscan 1
fi
ifconfig "$ifname" up
+ iwconfig "$ifname" channel "$channel" >/dev/null 2>/dev/null
local net_cfg bridge
net_cfg="$(find_net_config "$vif")"
iwconfig "$ifname" essid "$ssid"
case "$mode" in
ap)
- hostapd_setup_vif "$vif" madwifi || {
- echo "enable_atheros($device): Failed to set up wpa for interface $ifname" >&2
- # make sure this wifi interface won't accidentally stay open without encryption
- ifconfig "$ifname" down
- wlanconfig "$ifname" destroy
- continue
- }
+ config_get_bool isolate "$vif" isolate 0
+ iwpriv "$ifname" ap_bridge "$((isolate^1))"
+
+ if eval "type hostapd_setup_vif" 2>/dev/null >/dev/null; then
+ hostapd_setup_vif "$vif" madwifi || {
+ echo "enable_atheros($device): Failed to set up wpa for interface $ifname" >&2
+ # make sure this wifi interface won't accidentally stay open without encryption
+ ifconfig "$ifname" down
+ wlanconfig "$ifname" destroy
+ continue
+ }
+ fi
;;
wds|sta)
case "$enc" in
#add wpa_supplicant calls here
;;
esac
- wpa_supplicant ${bridge:+ -b $bridge} -Bw -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
+ [ -z "$proto" ] || wpa_supplicant ${bridge:+ -b $bridge} -Bw -D wext -i "$ifname" -c /var/run/wpa_supplicant-$ifname.conf
;;
esac
first=0
detect_atheros() {
cd /proc/sys/dev
[ -d ath ] || return
- for dev in wifi*; do
+ for dev in $(ls -d wifi* 2>&-); do
config_get type "$dev" type
[ "$type" = atheros ] && return
cat <<EOF