SME: Do not try to use FT over-the-air if PTK is not available
authorJouni Malinen <j@w1.fi>
Sat, 10 Apr 2010 19:39:49 +0000 (22:39 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 10 Apr 2010 19:39:49 +0000 (22:39 +0300)
src/rsn_supp/wpa.c
src/rsn_supp/wpa.h
wpa_supplicant/sme.c

index 09b1619..885d173 100644 (file)
@@ -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;
+}
index 72bf8f4..4faea8d 100644 (file)
@@ -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 */
index a31f2db..32c35be 100644 (file)
@@ -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;