From 4e5367516b80d599c7ae269842eddf9eefea0115 Mon Sep 17 00:00:00 2001 From: "Chandrasekaran, Manishekar" Date: Thu, 14 Aug 2014 16:44:32 +0530 Subject: [PATCH] P2P: Overwrite pending interface only after verifying BSS entry Previously, the P2P Interface Address of the peer gets updated in the peer table every time based on the scan results. For example, in a two port concurrency scenario, where the peer device has two interfaces with unique P2P Interface Addresses and with same P2P Device Address, based on the Probe Response/Beacon frames from these two interfaces, their peer table gets updated, but each of these updates happens in the peer table only based on the P2P Device Address. So, the same peer's P2P Interface address is updated every time and hence, at any instant, only one P2P Device Address to P2P Interface Address mapping entry exist in the peer table for the peer which has two interfaces. When we try to join a group operated by the peer, lookup happens in the peer table and when an interface entry is not available, the pending interface address gets overwritten with the P2P Device Address and hence the P2P connection can fail. Since the BSS table is the one that is up-to-date, this fix will ensure that the interface overwriting will happen only when there is no BSS entry for the pending P2P Interface Address as well. Signed-off-by: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index d91877cb3..58d27cb3d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4354,8 +4354,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s, p2p_get_interface_addr(wpa_s->global->p2p, wpa_s->pending_join_dev_addr, iface_addr) == 0 && - os_memcmp(iface_addr, wpa_s->pending_join_dev_addr, ETH_ALEN) != 0) - { + os_memcmp(iface_addr, wpa_s->pending_join_dev_addr, ETH_ALEN) != 0 + && !wpa_bss_get_bssid(wpa_s, wpa_s->pending_join_iface_addr)) { wpa_printf(MSG_DEBUG, "P2P: Overwrite pending interface " "address for join from " MACSTR " to " MACSTR " based on newly discovered P2P peer entry",