case "$enc" in
wep)
config_get keymgmt "$vif" keymgmt
- if [ -e "$keymgmt" ]; then
+ if [ -n "$keymgmt" ]; then
for idx in 1 2 3 4; do
local zidx
- zidx = idx - 1
+ zidx = $((idx - 1))
config_get key "$vif" "key${idx}"
if [ -n "$key" ]; then
append keystring "${zidx}:${key} "
done
fi
;;
- wpa)
+ *wpa*|*psk*)
config_get key "$vif" key
;;
esac
config_get bssid "$vif" bssid
case "$enc" in
wep)
- if [ -e "$keymgmt" ]; then
+ if [ -n "$keymgmt" ]; then
[ -n "$keystring" ] &&
iw dev "$ifname" connect "$ssid" ${fixed:+$freq} $bssid key "$keystring"
else
fi
fi
;;
- wpa*|psk*)
+ *wpa*|*psk*)
config_get key "$vif" key
if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
wpa_supplicant_setup_vif "$vif" wext || {