From e6012e839d4cf77413e0f4cf35cbfd9f71291632 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 14 Jun 2015 23:14:26 +0300 Subject: [PATCH] P2P: Update target GO Device Address from BSS entry during join 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 --- wpa_supplicant/p2p_supplicant.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 84cc5593b..6e6bdca87 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -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;