From b19c098e75d1dfa681960d9656d36001464a746e Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Thu, 15 May 2014 15:55:21 -0700 Subject: [PATCH] Send authentication failure reason in wpas_auth_failed() "WRONG_KEY" - possibly wrong psk "AUTH_FAILED" - authentication failure "CONN_FAILED" - continiuos connection failure Signed-off-by: Dmitry Shmidt --- wpa_supplicant/events.c | 4 ++-- wpa_supplicant/wpa_supplicant.c | 8 ++++---- wpa_supplicant/wpa_supplicant_i.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 9bc812d4e..eb27b57e7 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2149,7 +2149,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s, "pre-shared key may be incorrect"); if (wpas_p2p_4way_hs_failed(wpa_s) > 0) return; /* P2P group removed */ - wpas_auth_failed(wpa_s); + wpas_auth_failed(wpa_s, "WRONG_KEY"); } if (!wpa_s->disconnected && (!wpa_s->auto_reconnect_disabled || @@ -2607,7 +2607,7 @@ static void wpas_event_disconnect(struct wpa_supplicant *wpa_s, const u8 *addr, (wpa_s->key_mgmt & WPA_KEY_MGMT_IEEE8021X_NO_WPA)) && eapol_sm_failed(wpa_s->eapol))) && !wpa_s->eap_expected_failure)) - wpas_auth_failed(wpa_s); + wpas_auth_failed(wpa_s, "AUTH_FAILED"); #ifdef CONFIG_P2P if (deauth && reason_code > 0) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2b253ac17..0b871d07b 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4333,7 +4333,7 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) if (count > 3 && wpa_s->current_ssid) { wpa_printf(MSG_DEBUG, "Continuous association failures - " "consider temporary network disabling"); - wpas_auth_failed(wpa_s); + wpas_auth_failed(wpa_s, "CONN_FAILED"); } switch (count) { @@ -4498,7 +4498,7 @@ int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s) } -void wpas_auth_failed(struct wpa_supplicant *wpa_s) +void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason) { struct wpa_ssid *ssid = wpa_s->current_ssid; int dur; @@ -4552,9 +4552,9 @@ void wpas_auth_failed(struct wpa_supplicant *wpa_s) ssid->disabled_until.sec = now.sec + dur; wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TEMP_DISABLED - "id=%d ssid=\"%s\" auth_failures=%u duration=%d", + "id=%d ssid=\"%s\" auth_failures=%u duration=%d reason=%s", ssid->id, wpa_ssid_txt(ssid->ssid, ssid->ssid_len), - ssid->auth_failures, dur); + ssid->auth_failures, dur, reason); } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index a57f962de..3ae439dcb 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -933,7 +933,7 @@ void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s); void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid); int wpas_driver_bss_selection(struct wpa_supplicant *wpa_s); int wpas_is_p2p_prioritized(struct wpa_supplicant *wpa_s); -void wpas_auth_failed(struct wpa_supplicant *wpa_s); +void wpas_auth_failed(struct wpa_supplicant *wpa_s, char *reason); void wpas_clear_temp_disabled(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid, int clear_failures); int disallowed_bssid(struct wpa_supplicant *wpa_s, const u8 *bssid);