]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Add send_auth_reply() caller info in debug logging
authorBen Greear <greearb@candelatech.com>
Thu, 7 Dec 2017 17:14:49 +0000 (09:14 -0800)
committerJouni Malinen <j@w1.fi>
Mon, 2 Apr 2018 13:47:26 +0000 (16:47 +0300)
This can help one understand better what happens during the
authentication exchange.

Signed-off-by: Ben Greear <greearb@candelatech.com>
src/ap/ieee802_11.c

index 68bc333033e678d08c134556e63810da595a7e84..3fe8af0ce7a6c8ac26f77d36b678d72067867aee 100644 (file)
@@ -277,7 +277,7 @@ static u16 auth_shared_key(struct hostapd_data *hapd, struct sta_info *sta,
 static int send_auth_reply(struct hostapd_data *hapd,
                           const u8 *dst, const u8 *bssid,
                           u16 auth_alg, u16 auth_transaction, u16 resp,
-                          const u8 *ies, size_t ies_len)
+                          const u8 *ies, size_t ies_len, const char *dbg)
 {
        struct ieee80211_mgmt *reply;
        u8 *buf;
@@ -304,9 +304,9 @@ static int send_auth_reply(struct hostapd_data *hapd,
                os_memcpy(reply->u.auth.variable, ies, ies_len);
 
        wpa_printf(MSG_DEBUG, "authentication reply: STA=" MACSTR
-                  " auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu)",
+                  " auth_alg=%d auth_transaction=%d resp=%d (IE len=%lu) (dbg=%s)",
                   MAC2STR(dst), auth_alg, auth_transaction,
-                  resp, (unsigned long) ies_len);
+                  resp, (unsigned long) ies_len, dbg);
        if (hostapd_drv_send_mlme(hapd, reply, rlen, 0) < 0)
                wpa_printf(MSG_INFO, "send_auth_reply: send failed");
        else
@@ -328,7 +328,8 @@ static void handle_auth_ft_finish(void *ctx, const u8 *dst, const u8 *bssid,
        int reply_res;
 
        reply_res = send_auth_reply(hapd, dst, bssid, WLAN_AUTH_FT,
-                                   auth_transaction, status, ies, ies_len);
+                                   auth_transaction, status, ies, ies_len,
+                                   "auth-ft-finish");
 
        sta = ap_get_sta(hapd, dst);
        if (sta == NULL)
@@ -424,7 +425,7 @@ static int auth_sae_send_commit(struct hostapd_data *hapd,
 
        reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 1,
                                    WLAN_STATUS_SUCCESS, wpabuf_head(data),
-                                   wpabuf_len(data));
+                                   wpabuf_len(data), "sae-send-commit");
 
        wpabuf_free(data);
 
@@ -445,7 +446,7 @@ static int auth_sae_send_confirm(struct hostapd_data *hapd,
 
        reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 2,
                                    WLAN_STATUS_SUCCESS, wpabuf_head(data),
-                                   wpabuf_len(data));
+                                   wpabuf_len(data), "sae-send-confirm");
 
        wpabuf_free(data);
 
@@ -812,7 +813,8 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                pos = mgmt->u.auth.variable;
                end = ((const u8 *) mgmt) + len;
                send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
-                               auth_transaction, resp, pos, end - pos);
+                               auth_transaction, resp, pos, end - pos,
+                               "auth-sae-reflection-attack");
                goto remove_sta;
        }
 
@@ -821,7 +823,8 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
                send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
                                auth_transaction, resp,
                                wpabuf_head(hapd->conf->sae_commit_override),
-                               wpabuf_len(hapd->conf->sae_commit_override));
+                               wpabuf_len(hapd->conf->sae_commit_override),
+                               "sae-commit-override");
                goto remove_sta;
        }
 #endif /* CONFIG_TESTING_OPTIONS */
@@ -1011,7 +1014,7 @@ reply:
                send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
                                auth_transaction, resp,
                                data ? wpabuf_head(data) : (u8 *) "",
-                               data ? wpabuf_len(data) : 0);
+                               data ? wpabuf_len(data) : 0, "auth-sae");
        }
 
 remove_sta:
@@ -1535,7 +1538,7 @@ static void handle_auth_fils_finish(struct hostapd_data *hapd,
                WLAN_AUTH_FILS_SK_PFS : WLAN_AUTH_FILS_SK;
        send_auth_reply(hapd, sta->addr, hapd->own_addr, auth_alg, 2, resp,
                        data ? wpabuf_head(data) : (u8 *) "",
-                       data ? wpabuf_len(data) : 0);
+                       data ? wpabuf_len(data) : 0, "auth-fils-finish");
        wpabuf_free(data);
 
        if (resp == WLAN_STATUS_SUCCESS) {
@@ -2032,7 +2035,7 @@ static void handle_auth(struct hostapd_data *hapd,
 
        reply_res = send_auth_reply(hapd, mgmt->sa, mgmt->bssid, auth_alg,
                                    auth_transaction + 1, resp, resp_ies,
-                                   resp_ies_len);
+                                   resp_ies_len, "handle-auth");
 
        if (sta && sta->added_unassoc && (resp != WLAN_STATUS_SUCCESS ||
                                          reply_res != WLAN_STATUS_SUCCESS)) {