From 0d7b44099f7b105495eadd58d3581051e448e67d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 10 Apr 2010 22:39:49 +0300 Subject: [PATCH] SME: Do not try to use FT over-the-air if PTK is not available --- src/rsn_supp/wpa.c | 8 ++++++++ src/rsn_supp/wpa.h | 6 ++++++ wpa_supplicant/sme.c | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 09b161995..885d17326 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -2548,3 +2548,11 @@ void wpa_sm_drop_sa(struct wpa_sm *sm) os_memset(&sm->ptk, 0, sizeof(sm->ptk)); os_memset(&sm->tptk, 0, sizeof(sm->tptk)); } + + +int wpa_sm_has_ptk(struct wpa_sm *sm) +{ + if (sm == NULL) + return 0; + return sm->ptk_set; +} diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index 72bf8f455..4faea8d5b 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -124,6 +124,7 @@ int wpa_sm_rx_eapol(struct wpa_sm *sm, const u8 *src_addr, int wpa_sm_parse_own_wpa_ie(struct wpa_sm *sm, struct wpa_ie_data *data); int wpa_sm_pmksa_cache_list(struct wpa_sm *sm, char *buf, size_t len); void wpa_sm_drop_sa(struct wpa_sm *sm); +int wpa_sm_has_ptk(struct wpa_sm *sm); #else /* CONFIG_NO_WPA */ @@ -323,6 +324,11 @@ wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies, size_t ies_len, return -1; } +static inline int wpa_sm_has_ptk(struct wpa_sm *sm) +{ + return 0; +} + #endif /* CONFIG_IEEE80211R */ #endif /* WPA_H */ diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index a31f2dbaa..32c35be87 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -183,7 +183,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s, } if (wpa_s->sme.ft_used && - os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0) { + os_memcmp(md, wpa_s->sme.mobility_domain, 2) == 0 && + wpa_sm_has_ptk(wpa_s->wpa)) { wpa_printf(MSG_DEBUG, "SME: Trying to use FT " "over-the-air"); params.auth_alg = WPA_AUTH_ALG_FT;