From: Jouni Malinen Date: Sat, 10 Apr 2010 19:39:49 +0000 (+0300) Subject: SME: Do not try to use FT over-the-air if PTK is not available X-Git-Tag: hostap_0_7_2~68 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=libeap.git;a=commitdiff_plain;h=0d7b44099f7b105495eadd58d3581051e448e67d SME: Do not try to use FT over-the-air if PTK is not available --- diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index 09b1619..885d173 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 72bf8f4..4faea8d 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 a31f2db..32c35be 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;