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 <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-06-14 23:14:26 +03:00
parent dd025790e5
commit e6012e839d

View file

@ -4411,10 +4411,25 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
wpa_s->pending_join_iface_addr); wpa_s->pending_join_iface_addr);
} }
if (bss) { if (bss) {
u8 dev_addr[ETH_ALEN];
freq = bss->freq; freq = bss->freq;
wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency " wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency "
"from BSS table: %d MHz (SSID %s)", freq, "from BSS table: %d MHz (SSID %s)", freq,
wpa_ssid_txt(bss->ssid, bss->ssid_len)); 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) { if (freq > 0) {
u16 method; u16 method;