From bd26031b4b87672012d54b77d3bf6e7bece24af4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 28 Nov 2014 17:21:51 +0200 Subject: [PATCH] wext: Fix non-WPA/WPA2 connection with extra IEs The associate() handler was not prepared for params->wpa_ie containing some other IEs than WPA/RSN IE and ended up configuring security policy incorrectly for open networks if such IEs were present. Fix this by using wpa_proto parameter instead of IEs to determine security policy for driver configuration. Signed-off-by: Jouni Malinen --- src/drivers/driver_wext.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c index 428808d7c..1e531b797 100644 --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -2061,12 +2061,12 @@ int wpa_driver_wext_associate(void *priv, if (wpa_driver_wext_set_gen_ie(drv, params->wpa_ie, params->wpa_ie_len) < 0) ret = -1; - if (params->wpa_ie == NULL || params->wpa_ie_len == 0) - value = IW_AUTH_WPA_VERSION_DISABLED; - else if (params->wpa_ie[0] == WLAN_EID_RSN) + if (params->wpa_proto & WPA_PROTO_RSN) value = IW_AUTH_WPA_VERSION_WPA2; - else + else if (params->wpa_proto & WPA_PROTO_WPA) value = IW_AUTH_WPA_VERSION_WPA; + else + value = IW_AUTH_WPA_VERSION_DISABLED; if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_WPA_VERSION, value) < 0) ret = -1; @@ -2085,7 +2085,7 @@ int wpa_driver_wext_associate(void *priv, value = params->key_mgmt_suite != WPA_KEY_MGMT_NONE || params->pairwise_suite != WPA_CIPHER_NONE || params->group_suite != WPA_CIPHER_NONE || - params->wpa_ie_len; + (params->wpa_proto & (WPA_PROTO_RSN | WPA_PROTO_WPA)); if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_PRIVACY_INVOKED, value) < 0) ret = -1;