hostapd: Add send_auth_reply() caller info in debug logging

This can help one understand better what happens during the
authentication exchange.

Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2017-12-07 09:14:49 -08:00 committed by Jouni Malinen
parent d89edb6112
commit e7525a2954

View 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, static int send_auth_reply(struct hostapd_data *hapd,
const u8 *dst, const u8 *bssid, const u8 *dst, const u8 *bssid,
u16 auth_alg, u16 auth_transaction, u16 resp, 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; struct ieee80211_mgmt *reply;
u8 *buf; u8 *buf;
@ -304,9 +304,9 @@ static int send_auth_reply(struct hostapd_data *hapd,
os_memcpy(reply->u.auth.variable, ies, ies_len); os_memcpy(reply->u.auth.variable, ies, ies_len);
wpa_printf(MSG_DEBUG, "authentication reply: STA=" MACSTR 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, 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) if (hostapd_drv_send_mlme(hapd, reply, rlen, 0) < 0)
wpa_printf(MSG_INFO, "send_auth_reply: send failed"); wpa_printf(MSG_INFO, "send_auth_reply: send failed");
else else
@ -328,7 +328,8 @@ static void handle_auth_ft_finish(void *ctx, const u8 *dst, const u8 *bssid,
int reply_res; int reply_res;
reply_res = send_auth_reply(hapd, dst, bssid, WLAN_AUTH_FT, 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); sta = ap_get_sta(hapd, dst);
if (sta == NULL) 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, reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 1,
WLAN_STATUS_SUCCESS, wpabuf_head(data), WLAN_STATUS_SUCCESS, wpabuf_head(data),
wpabuf_len(data)); wpabuf_len(data), "sae-send-commit");
wpabuf_free(data); 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, reply_res = send_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 2,
WLAN_STATUS_SUCCESS, wpabuf_head(data), WLAN_STATUS_SUCCESS, wpabuf_head(data),
wpabuf_len(data)); wpabuf_len(data), "sae-send-confirm");
wpabuf_free(data); 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; pos = mgmt->u.auth.variable;
end = ((const u8 *) mgmt) + len; end = ((const u8 *) mgmt) + len;
send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE, 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; 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, send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
auth_transaction, resp, auth_transaction, resp,
wpabuf_head(hapd->conf->sae_commit_override), 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; goto remove_sta;
} }
#endif /* CONFIG_TESTING_OPTIONS */ #endif /* CONFIG_TESTING_OPTIONS */
@ -1011,7 +1014,7 @@ reply:
send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE, send_auth_reply(hapd, mgmt->sa, mgmt->bssid, WLAN_AUTH_SAE,
auth_transaction, resp, auth_transaction, resp,
data ? wpabuf_head(data) : (u8 *) "", data ? wpabuf_head(data) : (u8 *) "",
data ? wpabuf_len(data) : 0); data ? wpabuf_len(data) : 0, "auth-sae");
} }
remove_sta: 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; WLAN_AUTH_FILS_SK_PFS : WLAN_AUTH_FILS_SK;
send_auth_reply(hapd, sta->addr, hapd->own_addr, auth_alg, 2, resp, send_auth_reply(hapd, sta->addr, hapd->own_addr, auth_alg, 2, resp,
data ? wpabuf_head(data) : (u8 *) "", data ? wpabuf_head(data) : (u8 *) "",
data ? wpabuf_len(data) : 0); data ? wpabuf_len(data) : 0, "auth-fils-finish");
wpabuf_free(data); wpabuf_free(data);
if (resp == WLAN_STATUS_SUCCESS) { 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, reply_res = send_auth_reply(hapd, mgmt->sa, mgmt->bssid, auth_alg,
auth_transaction + 1, resp, resp_ies, auth_transaction + 1, resp, resp_ies,
resp_ies_len); resp_ies_len, "handle-auth");
if (sta && sta->added_unassoc && (resp != WLAN_STATUS_SUCCESS || if (sta && sta->added_unassoc && (resp != WLAN_STATUS_SUCCESS ||
reply_res != WLAN_STATUS_SUCCESS)) { reply_res != WLAN_STATUS_SUCCESS)) {