diff mbox

Issue in network selection, when dynamically changing AP from WEP toWPA2 personal

Message ID DCC83D5EF3994A41BDD49325FCA71C0C0A2FD18B@IRSMSX106.ger.corp.intel.com
State Not Applicable
Headers show

Commit Message

Klouz, AymenX Sept. 20, 2013, 9:42 a.m. UTC
Hi All,

I encountered a special issue from supplicant when it is already connected to an AP that switch dynamically from WEP to WPA.

Here is the steps to reproduce :

- Clear all the registered networks

- Connect to a WEP access point
    Useful Trace :
    I/WifiHW  (  442): REPLY: ====
    I/WifiHW  (  442): REPLY: bssid=c8:4c:75:20:c0:6c
    I/WifiHW  (  442): REPLY: freq=2462
    I/WifiHW  (  442): REPLY: flags=[WEP][ESS]
    I/WifiHW  (  442): REPLY: ssid=CWS4400
    I/WifiHW  (  442): REPLY: ====
    D/wpa_supplicant( 7635): wlan0: 9: c8:4c:75:20:c0:6c ssid='CWS4400' wpa_ie_len=0 rsn_ie_len=0 caps=0x411 level=-52
    D/wpa_supplicant( 7635): wlan0:    allow in non-WPA/WPA2
    D/wpa_supplicant( 7635): wlan0:    selected BSS c8:4c:75:20:c0:6c ssid='CWS4400'

- After connecting, switch the AP to WPA

- A disconnection from the WEP network is observed, then BSSID is added into blacklist
    Useful Trace :
    I/wpa_supplicant( 7635): wlan0: CTRL-EVENT-DISCONNECTED bssid=c8:4c:75:20:c0:6c reason=0
    D/wpa_supplicant( 7635): Added BSSID c8:4c:75:20:c0:6c into blacklist

- A New Network is available, with the same bssid, ssid etc ... but different security flags
    Useful Trace :
    I/WifiHW  (  442): REPLY: ====
    I/WifiHW  (  442): REPLY: bssid=c8:4c:75:20:c0:6c
    I/WifiHW  (  442): REPLY: freq=2462
    I/WifiHW  (  442): REPLY: flags=[WPA-PSK-TKIP][ESS]
    I/WifiHW  (  442): REPLY: ssid=CWS4400
    I/WifiHW  (  442): REPLY: ====

- The supplicant tries to connect to a new network but no one is registered except the one that is already blacklisted, so it tries to clear the network from blacklist and try to reconnect to it
    Useful Trace :
    D/wpa_supplicant( 7635): wlan0: No APs found - clear blacklist and try again
    D/wpa_supplicant( 7635): Removed BSSID c8:4c:75:20:c0:6c from blacklist (clear)
    D/wpa_supplicant( 7635): wlan0: Selecting BSS from priority group 1
    D/wpa_supplicant( 7635): wlan0: 0: c8:4c:75:20:c0:6c ssid='CWS4400' wpa_ie_len=22 rsn_ie_len=0 caps=0x411 level=-50
    D/wpa_supplicant( 7635): wlan0:    skip WPA IE - key mgmt mismatch
    D/wpa_supplicant( 7635): wlan0:    allow in non-WPA/WPA2
    D/wpa_supplicant( 7635): wlan0:    selected BSS c8:4c:75:20:c0:6c ssid='CWS4400'
    D/wpa_supplicant( 7635): wlan0: Request association: reassociate: 1  selected: c8:4c:75:20:c0:6c  bssid: 00:00:00:00:00:00                          pending: 00:00:00:00:00:00  wpa_state: SCANNING
    I/wpa_supplicant( 7635): wlan0: Trying to associate with c8:4c:75:20:c0:6c (SSID='CWS4400' freq=2462 MHz)
    D/wpa_supplicant( 7635): wlan0: Event ASSOC_REJECT (13) received
    I/wpa_supplicant( 7635): wlan0: CTRL-EVENT-ASSOC-REJECT bssid=c8:4c:75:20:c0:6c status_code=12
    E/wpa_supplicant( 7635): Retrying assoc: 2

--> From the trace we can see that the supplicant does not make difference between the new network (WPA) and the old registered one (WEP). It tries then to reassociate for 10 times although it is not dealing with the same network. A patch that add a key mgmt mismatch flag when trying to connect to a WPA network with WEP secutiry settings would prevent such an issue. Please refer to the attached patch.

Could you please confirm the issue and the fix ?

Best regards,

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Comments

Jouni Malinen Sept. 23, 2013, 8:20 a.m. UTC | #1
On Fri, Sep 20, 2013 at 09:42:42AM +0000, Klouz, AymenX wrote:
> I encountered a special issue from supplicant when it is already connected to an AP that switch dynamically from WEP to WPA.

> --> From the trace we can see that the supplicant does not make difference between the new network (WPA) and the old registered one (WEP). It tries then to reassociate for 10 times although it is not dealing with the same network. A patch that add a key mgmt mismatch flag when trying to connect to a WPA network with WEP secutiry settings would prevent such an issue. Please refer to the attached patch.

This is the way a WEP station that is not aware of WPA/WPA2 would behave
and that used to be the expected wpa_supplicant behavior with WEP
configuration. In other words, this was not really an issue but the
designed functionality.. Anyway, this was changed recently with this
commit:
http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=86bd1410503913b719417f32457631a2ee1095ed
diff mbox

Patch

From a1dc44ae042378c2bdf064180fd1cc379607fc4b Mon Sep 17 00:00:00 2001
From: Aymen KLOUZ <aymenx.klouz@intel.com>
Date: Fri, 20 Sep 2013 11:11:42 +0200
Subject: [PATCH] BZ: 122181

Category: [device enablement | feature differentiation | aosp improvement]

Domain: <domain>-<sub-domain>
Origin: [internal | upstream <uri> | 3rd-party <name>]
Upstream-Candidate: [yes | no, needs rework | no, proprietary | no, not-aosp]

Change-Id: I945f43c7fa0da190a341cdf70fbff6f1498d8065
Signed-off-by: Aymen KLOUZ <aymenx.klouz@intel.com>
---
 wpa_supplicant/events.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 5156d5f..d9c990b 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -372,6 +372,7 @@  static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
 	const u8 *rsn_ie, *wpa_ie;
 	int ret;
 	int wep_ok;
+	Boolean keymgmt_mismatch = FALSE;
 
 	ret = wpas_wps_ssid_bss_match(wpa_s, ssid, bss);
 	if (ret >= 0)
@@ -422,6 +423,7 @@  static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
 		if (!(ie.key_mgmt & ssid->key_mgmt)) {
 			wpa_dbg(wpa_s, MSG_DEBUG, "   skip RSN IE - key mgmt "
 				"mismatch");
+			keymgmt_mismatch = TRUE;
 			break;
 		}
 
@@ -479,6 +481,7 @@  static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
 		if (!(ie.key_mgmt & ssid->key_mgmt)) {
 			wpa_dbg(wpa_s, MSG_DEBUG, "   skip WPA IE - key mgmt "
 				"mismatch");
+			keymgmt_mismatch = TRUE;
 			break;
 		}
 
@@ -498,7 +501,7 @@  static int wpa_supplicant_ssid_bss_match(struct wpa_supplicant *wpa_s,
 		return 0;
 	}
 
-	if (!wpa_key_mgmt_wpa(ssid->key_mgmt)) {
+	if (!wpa_key_mgmt_wpa(ssid->key_mgmt) && !keymgmt_mismatch) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "   allow in non-WPA/WPA2");
 		return 1;
 	}
-- 
1.8.1.2