From a422d9b4c2a5fe0ddf37a5957f5a97482c528635 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 29 Dec 2019 19:30:33 +0200 Subject: [PATCH] RRB: More debug prints for local delivery This makes it easier to figure out how frames are delivered directly between BSSs operated within a single hostapd process. Signed-off-by: Jouni Malinen --- src/ap/wpa_auth_ft.c | 39 +++++++++++++++++++++++++-------------- src/ap/wpa_auth_glue.c | 16 ++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c index a599be225..d24feb560 100644 --- a/src/ap/wpa_auth_ft.c +++ b/src/ap/wpa_auth_ft.c @@ -951,8 +951,9 @@ wpa_ft_rrb_seq_req(struct wpa_authenticator *wpa_auth, goto err; } - wpa_printf(MSG_DEBUG, "FT: Send out sequence number request to " MACSTR, - MAC2STR(src_addr)); + wpa_printf(MSG_DEBUG, "FT: Send sequence number request from " MACSTR + " to " MACSTR, + MAC2STR(wpa_auth->addr), MAC2STR(src_addr)); item = os_zalloc(sizeof(*item)); if (!item) goto err; @@ -1997,9 +1998,6 @@ static int wpa_ft_pull_pmk_r1(struct wpa_state_machine *sm, key = r0kh->key; key_len = sizeof(r0kh->key); - wpa_printf(MSG_DEBUG, "FT: Send PMK-R1 pull request to remote R0KH " - "address " MACSTR, MAC2STR(r0kh->addr)); - if (r0kh->seq->rx.num_last == 0) { /* A sequence request will be sent out anyway when pull * response is received. Send it out now to avoid one RTT. */ @@ -2008,6 +2006,10 @@ static int wpa_ft_pull_pmk_r1(struct wpa_state_machine *sm, key_len, NULL, 0, NULL, 0, NULL); } + wpa_printf(MSG_DEBUG, "FT: Send PMK-R1 pull request from " MACSTR + " to remote R0KH address " MACSTR, + MAC2STR(sm->wpa_auth->addr), MAC2STR(r0kh->addr)); + if (first && random_get_bytes(sm->ft_pending_pull_nonce, FT_RRB_NONCE_LEN) < 0) { wpa_printf(MSG_DEBUG, "FT: Failed to get random data for " @@ -3687,6 +3689,10 @@ static int wpa_ft_rrb_rx_pull(struct wpa_authenticator *wpa_auth, goto out; } + wpa_printf(MSG_DEBUG, "FT: Send PMK-R1 pull response from " MACSTR + " to " MACSTR, + MAC2STR(wpa_auth->addr), MAC2STR(src_addr)); + resp[0].type = FT_RRB_S1KH_ID; resp[0].len = f_s1kh_id_len; resp[0].data = f_s1kh_id; @@ -4193,6 +4199,10 @@ static int wpa_ft_rrb_rx_seq_req(struct wpa_authenticator *wpa_auth, goto out; } + wpa_printf(MSG_DEBUG, "FT: Send sequence number response from " MACSTR + " to " MACSTR, + MAC2STR(wpa_auth->addr), MAC2STR(src_addr)); + seq_resp_auth[0].type = FT_RRB_NONCE; seq_resp_auth[0].len = f_nonce_len; seq_resp_auth[0].data = f_nonce; @@ -4452,9 +4462,11 @@ void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, size_t alen, elen; int no_defer = 0; - wpa_printf(MSG_DEBUG, "FT: RRB-OUI received frame from remote AP " - MACSTR, MAC2STR(src_addr)); - wpa_printf(MSG_DEBUG, "FT: RRB-OUI frame - oui_suffix=%d", oui_suffix); + wpa_printf(MSG_DEBUG, "FT: RRB-OUI(" MACSTR + ") received frame from remote AP " + MACSTR " oui_suffix=%u dst=" MACSTR, + MAC2STR(wpa_auth->addr), MAC2STR(src_addr), oui_suffix, + MAC2STR(dst_addr)); wpa_hexdump(MSG_MSGDUMP, "FT: RRB frame payload", data, data_len); if (is_multicast_ether_addr(src_addr)) { @@ -4464,13 +4476,8 @@ void wpa_ft_rrb_oui_rx(struct wpa_authenticator *wpa_auth, const u8 *src_addr, return; } - if (is_multicast_ether_addr(dst_addr)) { - wpa_printf(MSG_DEBUG, - "FT: RRB-OUI received frame from remote AP " MACSTR - " to multicast address " MACSTR, - MAC2STR(src_addr), MAC2STR(dst_addr)); + if (is_multicast_ether_addr(dst_addr)) no_defer = 1; - } if (data_len < sizeof(u16)) { wpa_printf(MSG_DEBUG, "FT: RRB-OUI frame too short"); @@ -4545,6 +4552,10 @@ static int wpa_ft_generate_pmk_r1(struct wpa_authenticator *wpa_auth, return -1; } + wpa_printf(MSG_DEBUG, "FT: Send PMK-R1 push from " MACSTR + " to remote R0KH address " MACSTR, + MAC2STR(wpa_auth->addr), MAC2STR(r1kh->addr)); + if (wpa_ft_rrb_build_r0(r1kh->key, sizeof(r1kh->key), push, pmk_r0, r1kh->id, s1kh_id, push_auth, wpa_auth->addr, FT_PACKET_R0KH_R1KH_PUSH, diff --git a/src/ap/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c index daddc59cc..5d207e3f8 100644 --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c @@ -688,6 +688,12 @@ static void hostapd_oui_deliver_later(void *eloop_ctx, void *timeout_ctx) dl_list_for_each_safe(data, n, &hapd->l2_oui_queue, struct oui_deliver_later_data, list) { oui_ctx = hostapd_wpa_get_oui(hapd, data->oui_suffix); + wpa_printf(MSG_DEBUG, "RRB(%s): %s src=" MACSTR " dst=" MACSTR + " oui_suffix=%u data_len=%u data=%p", + hapd->conf->iface, __func__, + MAC2STR(data->src_addr), MAC2STR(data->dst_addr), + data->oui_suffix, (unsigned int) data->data_len, + data); if (hapd->wpa_auth && oui_ctx) { eth_p_oui_deliver(oui_ctx, data->src_addr, data->dst_addr, @@ -733,6 +739,12 @@ static int hostapd_wpa_auth_oui_iter(struct hostapd_iface *iface, void *ctx) data = os_zalloc(sizeof(*data) + idata->data_len); if (!data) return 1; + wpa_printf(MSG_DEBUG, + "RRB(%s): local delivery to %s dst=" MACSTR + " oui_suffix=%u data_len=%u data=%p", + idata->src_hapd->conf->iface, hapd->conf->iface, + MAC2STR(idata->dst_addr), idata->oui_suffix, + (unsigned int) idata->data_len, data); os_memcpy(data->src_addr, idata->src_hapd->own_addr, ETH_ALEN); os_memcpy(data->dst_addr, idata->dst_addr, ETH_ALEN); @@ -768,6 +780,10 @@ static int hostapd_wpa_auth_send_oui(void *ctx, const u8 *dst, u8 oui_suffix, struct hostapd_data *hapd = ctx; struct eth_p_oui_ctx *oui_ctx; + wpa_printf(MSG_DEBUG, "RRB(%s): send to dst=" MACSTR + " oui_suffix=%u data_len=%u", + hapd->conf->iface, MAC2STR(dst), oui_suffix, + (unsigned int) data_len); #ifdef CONFIG_IEEE80211R_AP if (hapd->iface->interfaces && hapd->iface->interfaces->for_each_interface) {