]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Update target GO Device Address from BSS entry during join
authorJouni Malinen <j@w1.fi>
Sun, 14 Jun 2015 20:14:26 +0000 (23:14 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 14 Jun 2015 20:16:55 +0000 (23:16 +0300)
It is possible for P2P_CONNECT-join command to be issued on a GO's P2P
Interface Address before the P2P peer entry is available to map this
into the GO's P2P Device Address. This could result in the join
operation failing to continue after receiving PD Response due to the
address mismatch (source address = P2P Device Address while only the P2P
Interface Address is known). Fix this by updating the pending join P2P
Device Address based on the BSS entry, if needed.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/p2p_supplicant.c

index 84cc5593bb437f989fa37c6ba00cc1461b7b2fde..6e6bdca8735df20b957d79286bd8ef70adf8b890 100644 (file)
@@ -4411,10 +4411,25 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
                                               wpa_s->pending_join_iface_addr);
        }
        if (bss) {
+               u8 dev_addr[ETH_ALEN];
+
                freq = bss->freq;
                wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
                           "from BSS table: %d MHz (SSID %s)", freq,
                           wpa_ssid_txt(bss->ssid, bss->ssid_len));
+               if (p2p_parse_dev_addr((const u8 *) (bss + 1), bss->ie_len,
+                                      dev_addr) == 0 &&
+                   os_memcmp(wpa_s->pending_join_dev_addr,
+                             wpa_s->pending_join_iface_addr, ETH_ALEN) == 0 &&
+                   os_memcmp(dev_addr, wpa_s->pending_join_dev_addr,
+                             ETH_ALEN) != 0) {
+                       wpa_printf(MSG_DEBUG,
+                                  "P2P: Update target GO device address based on BSS entry: " MACSTR " (was " MACSTR ")",
+                                  MAC2STR(dev_addr),
+                                  MAC2STR(wpa_s->pending_join_dev_addr));
+                       os_memcpy(wpa_s->pending_join_dev_addr, dev_addr,
+                                 ETH_ALEN);
+               }
        }
        if (freq > 0) {
                u16 method;