]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Fix Authentication Request destination in the chirping case
authorJouni Malinen <jouni@codeaurora.org>
Tue, 9 Feb 2021 18:41:08 +0000 (20:41 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 9 Feb 2021 18:41:08 +0000 (20:41 +0200)
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 <jouni@codeaurora.org>
src/ap/dpp_hostapd.c
wpa_supplicant/dpp_supplicant.c

index e106df5136e62bd6be85b74efebb09697784ba99..e1e5a3ac4bb36a73de3d65d57e96332f59467112 100644 (file)
@@ -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) {
index 910602e346dc5058df0ea1e5223890bd154ebb1a..8df938db40d9ffe6ef7a1de5154ea0d4b658bfee 100644 (file)
@@ -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) {