]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add more debug prints for WPA/RSN selection issues for connection
authorJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 11:49:52 +0000 (13:49 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 22 Dec 2014 11:49:52 +0000 (13:49 +0200)
ap_ft_sae test case managed to hit a somewhat unclear error case which
resulted in "WPA: Failed to select WPA/RSN" print and not enough
information to figure out what exactly had went wrong.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c

index 54ae823288ab7c90d14ee80174de006929ddda87..011b6054d899cce7a0adfaf22cc3145897dab69f 100644 (file)
@@ -259,12 +259,16 @@ static void sme_send_authentication(struct wpa_supplicant *wpa_s,
                struct wpa_ie_data ied;
 
                rsn = wpa_bss_get_ie(bss, WLAN_EID_RSN);
-               if (rsn &&
-                   wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ied) == 0) {
-                       if (wpa_key_mgmt_sae(ied.key_mgmt)) {
-                               wpa_dbg(wpa_s, MSG_DEBUG, "Using SAE auth_alg");
-                               params.auth_alg = WPA_AUTH_ALG_SAE;
-                       }
+               if (!rsn) {
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "SAE enabled, but target BSS does not advertise RSN");
+               } else if (wpa_parse_wpa_ie(rsn, 2 + rsn[1], &ied) == 0 &&
+                          wpa_key_mgmt_sae(ied.key_mgmt)) {
+                       wpa_dbg(wpa_s, MSG_DEBUG, "Using SAE auth_alg");
+                       params.auth_alg = WPA_AUTH_ALG_SAE;
+               } else {
+                       wpa_dbg(wpa_s, MSG_DEBUG,
+                               "SAE enabled, but target BSS does not advertise SAE AKM for RSN");
                }
        }
 #endif /* CONFIG_SAE */
index 995c8d84bfd890f03452a0be4c2a3568d647d142..cb99067ce2db54c56469bb3a7d71b5a05cbbf320 100644 (file)
@@ -1003,7 +1003,7 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
                wpa_dbg(wpa_s, MSG_DEBUG, "RSN: using IEEE 802.11i/D9.0");
                proto = WPA_PROTO_RSN;
        } else if (bss_wpa && (ssid->proto & WPA_PROTO_WPA) &&
-                  wpa_parse_wpa_ie(bss_wpa, 2 +bss_wpa[1], &ie) == 0 &&
+                  wpa_parse_wpa_ie(bss_wpa, 2 + bss_wpa[1], &ie) == 0 &&
                   (ie.group_cipher & ssid->group_cipher) &&
                   (ie.pairwise_cipher & ssid->pairwise_cipher) &&
                   (ie.key_mgmt & ssid->key_mgmt)) {
@@ -1021,6 +1021,40 @@ int wpa_supplicant_set_suites(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_HS20 */
        } else if (bss) {
                wpa_msg(wpa_s, MSG_WARNING, "WPA: Failed to select WPA/RSN");
+               wpa_dbg(wpa_s, MSG_DEBUG,
+                       "WPA: ssid proto=0x%x pairwise_cipher=0x%x group_cipher=0x%x key_mgmt=0x%x",
+                       ssid->proto, ssid->pairwise_cipher, ssid->group_cipher,
+                       ssid->key_mgmt);
+               wpa_dbg(wpa_s, MSG_DEBUG, "WPA: BSS " MACSTR " ssid='%s'%s%s%s",
+                       MAC2STR(bss->bssid),
+                       wpa_ssid_txt(bss->ssid, bss->ssid_len),
+                       bss_wpa ? " WPA" : "",
+                       bss_rsn ? " RSN" : "",
+                       bss_osen ? " OSEN" : "");
+               if (bss_rsn) {
+                       wpa_hexdump(MSG_DEBUG, "RSN", bss_rsn, 2 + bss_rsn[1]);
+                       if (wpa_parse_wpa_ie(bss_rsn, 2 + bss_rsn[1], &ie)) {
+                               wpa_dbg(wpa_s, MSG_DEBUG,
+                                       "Could not parse RSN element");
+                       } else {
+                               wpa_dbg(wpa_s, MSG_DEBUG,
+                                       "RSN: pairwise_cipher=0x%x group_cipher=0x%x key_mgmt=0x%x",
+                                       ie.pairwise_cipher, ie.group_cipher,
+                                       ie.key_mgmt);
+                       }
+               }
+               if (bss_wpa) {
+                       wpa_hexdump(MSG_DEBUG, "WPA", bss_wpa, 2 + bss_wpa[1]);
+                       if (wpa_parse_wpa_ie(bss_wpa, 2 + bss_wpa[1], &ie)) {
+                               wpa_dbg(wpa_s, MSG_DEBUG,
+                                       "Could not parse WPA element");
+                       } else {
+                               wpa_dbg(wpa_s, MSG_DEBUG,
+                                       "WPA: pairwise_cipher=0x%x group_cipher=0x%x key_mgmt=0x%x",
+                                       ie.pairwise_cipher, ie.group_cipher,
+                                       ie.key_mgmt);
+                       }
+               }
                return -1;
        } else {
                if (ssid->proto & WPA_PROTO_OSEN)