mac80211: use wpa_supplicant for unencrypted connections to improve client mode relia...
authorFelix Fietkau <nbd@openwrt.org>
Mon, 8 Feb 2010 13:42:14 +0000 (13:42 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 8 Feb 2010 13:42:14 +0000 (13:42 +0000)
SVN-Revision: 19550

package/hostapd/files/wpa_supplicant.sh
package/mac80211/files/lib/wifi/mac80211.sh

index 8f7f503c1fcfd7870d6a6cc6dfaf17376a8e0e63..ccf31baa903c01dc844b358281485bb8e80a8690 100644 (file)
@@ -12,6 +12,9 @@ wpa_supplicant_setup_vif() {
        }
 
        case "$enc" in
+               *none*)
+                       key_mgmt='NONE'
+               ;;
                *wep*)
                        key_mgmt='NONE'
                        config_get key "$vif" key
index 62b8e7ed3a4e4ce462939989bcfef17123151931..27e234d83f88397f8079be11ba46aa7822a9aa1c 100644 (file)
@@ -312,6 +312,9 @@ enable_mac80211() {
                        local key keystring
 
                        case "$enc" in
+                               *none*)
+                                       config_get keymgmt "$vif" keymgmt
+                               ;;
                                *wep*)
                                        config_get keymgmt "$vif" keymgmt
                                        if [ -z "$keymgmt" ]; then
@@ -397,7 +400,18 @@ enable_mac80211() {
                                                fi
                                        ;;
                                        *)
-                                               iw dev "$ifname" connect "$ssid" ${fixed:+$freq} $bssid
+                                               if [ -z "$keymgmt" ]; then
+                                                       iw dev "$ifname" connect "$ssid" ${fixed:+$freq} $bssid
+                                               else
+                                                       if eval "type wpa_supplicant_setup_vif" 2>/dev/null >/dev/null; then
+                                                               wpa_supplicant_setup_vif "$vif" wext || {
+                                                                       echo "enable_mac80211($device): Failed to set up wpa_supplicant for interface $ifname" >&2
+                                                                       # make sure this wifi interface won't accidentally stay open without encryption
+                                                                       ifconfig "$ifname" down
+                                                                       continue
+                                                               }
+                                                       fi
+                                               fi
                                        ;;
                                esac