aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/events.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2012-10-08 14:49:54 (GMT)
committerJouni Malinen <j@w1.fi>2012-10-08 14:49:54 (GMT)
commitc9a8221800dfe18e5af3d2085ad5617d5f7fe9f1 (patch)
treec7bc9925ca25515641a227638752d4a0c812255d /wpa_supplicant/events.c
parent458cb3019108b6cb8c0c1cab94ae6ebf244eda27 (diff)
downloadhostap-c9a8221800dfe18e5af3d2085ad5617d5f7fe9f1.zip
hostap-c9a8221800dfe18e5af3d2085ad5617d5f7fe9f1.tar.gz
hostap-c9a8221800dfe18e5af3d2085ad5617d5f7fe9f1.tar.bz2
Filter out unlikely "pre-shared key may be incorrect" messages
Add a function to filter out known cases of disconnection during 4-way handshake that are caused by something else than mismatch in PSK. This commit adds the case where the local end determines a mismatch in WPA/RSN element between Beacon/Probe Response frames and EAPOL-Key msg 3/4. This can avoid some potentially confusing "WPA: 4-Way Handshake failed - pre-shared key may be incorrect" ctrl_iface messages. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/events.c')
-rw-r--r--wpa_supplicant/events.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 5399f76..53b8338 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1815,6 +1815,28 @@ static void wpa_supplicant_event_disassoc(struct wpa_supplicant *wpa_s,
}
+static int could_be_psk_mismatch(struct wpa_supplicant *wpa_s, u16 reason_code,
+ int locally_generated)
+{
+ if (wpa_s->wpa_state != WPA_4WAY_HANDSHAKE ||
+ !wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt))
+ return 0; /* Not in 4-way handshake with PSK */
+
+ /*
+ * It looks like connection was lost while trying to go through PSK
+ * 4-way handshake. Filter out known disconnection cases that are caused
+ * by something else than PSK mismatch to avoid confusing reports.
+ */
+
+ if (locally_generated) {
+ if (reason_code == WLAN_REASON_IE_IN_4WAY_DIFFERS)
+ return 0;
+ }
+
+ return 1;
+}
+
+
static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
u16 reason_code,
int locally_generated)
@@ -1840,8 +1862,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
return;
}
- if (wpa_s->wpa_state == WPA_4WAY_HANDSHAKE &&
- wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
+ if (could_be_psk_mismatch(wpa_s, reason_code, locally_generated)) {
wpa_msg(wpa_s, MSG_INFO, "WPA: 4-Way Handshake failed - "
"pre-shared key may be incorrect");
wpas_auth_failed(wpa_s);