From: Jouni Malinen Date: Tue, 9 Feb 2021 18:41:08 +0000 (+0200) Subject: DPP2: Fix Authentication Request destination in the chirping case X-Git-Tag: hostap_2_10~595 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad59639ed8757e68af8520b307cff11e8544ff10;p=thirdparty%2Fhostap.git DPP2: Fix Authentication Request destination in the chirping case The Authentication Request frames triggered by the reception of a Presence Announcement frame were sent to the broadcast address. This is not correct behavior since the source MAC address of the Presence Announcement frame was supposed to override the Responder MAC address. Fix this by using that source MAC address to avoid unnecessary use of broadcast frames. Signed-off-by: Jouni Malinen --- diff --git a/src/ap/dpp_hostapd.c b/src/ap/dpp_hostapd.c index e106df513..e1e5a3ac4 100644 --- a/src/ap/dpp_hostapd.c +++ b/src/ap/dpp_hostapd.c @@ -495,7 +495,9 @@ static int hostapd_dpp_auth_init_next(struct hostapd_data *hapd) freq = auth->freq[auth->freq_idx++]; auth->curr_freq = freq; - if (is_zero_ether_addr(auth->peer_bi->mac_addr)) + if (!is_zero_ether_addr(auth->peer_mac_addr)) + dst = auth->peer_mac_addr; + else if (is_zero_ether_addr(auth->peer_bi->mac_addr)) dst = broadcast; else dst = auth->peer_bi->mac_addr; @@ -1299,8 +1301,9 @@ hostapd_dpp_rx_presence_announcement(struct hostapd_data *hapd, const u8 *src, auth->neg_freq = freq; - if (!is_zero_ether_addr(peer_bi->mac_addr)) - os_memcpy(auth->peer_mac_addr, peer_bi->mac_addr, ETH_ALEN); + /* The source address of the Presence Announcement frame overrides any + * MAC address information from the bootstrapping information. */ + os_memcpy(auth->peer_mac_addr, src, ETH_ALEN); hapd->dpp_auth = auth; if (hostapd_dpp_auth_init_next(hapd) < 0) { diff --git a/wpa_supplicant/dpp_supplicant.c b/wpa_supplicant/dpp_supplicant.c index 910602e34..8df938db4 100644 --- a/wpa_supplicant/dpp_supplicant.c +++ b/wpa_supplicant/dpp_supplicant.c @@ -709,7 +709,9 @@ static int wpas_dpp_auth_init_next(struct wpa_supplicant *wpa_s) freq = auth->freq[auth->freq_idx++]; auth->curr_freq = freq; - if (is_zero_ether_addr(auth->peer_bi->mac_addr)) + if (!is_zero_ether_addr(auth->peer_mac_addr)) + dst = auth->peer_mac_addr; + else if (is_zero_ether_addr(auth->peer_bi->mac_addr)) dst = broadcast; else dst = auth->peer_bi->mac_addr; @@ -2056,8 +2058,9 @@ wpas_dpp_rx_presence_announcement(struct wpa_supplicant *wpa_s, const u8 *src, auth->neg_freq = freq; - if (!is_zero_ether_addr(peer_bi->mac_addr)) - os_memcpy(auth->peer_mac_addr, peer_bi->mac_addr, ETH_ALEN); + /* The source address of the Presence Announcement frame overrides any + * MAC address information from the bootstrapping information. */ + os_memcpy(auth->peer_mac_addr, src, ETH_ALEN); wpa_s->dpp_auth = auth; if (wpas_dpp_auth_init_next(wpa_s) < 0) {