From 54960629190829595bf35c40a5df3683e28ed964 Mon Sep 17 00:00:00 2001 From: Albert Liu Date: Mon, 15 Nov 2010 16:16:39 +0200 Subject: [PATCH] P2P: Update pending join interface address during scans Since the P2P peer entry may not have been available at the time the join request was issued, we need to allow the P2P Interface Address to be updated during join-scans when the P2P peer entry for the GO may be added. --- wpa_supplicant/p2p_supplicant.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f9bf472a0..fe1577e65 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2441,6 +2441,7 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s, { struct wpa_bss *bss; int freq; + u8 iface_addr[ETH_ALEN]; eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL); @@ -2455,6 +2456,23 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s, freq = p2p_get_oper_freq(wpa_s->global->p2p, wpa_s->pending_join_iface_addr); + if (freq < 0 && + 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) + { + wpa_printf(MSG_DEBUG, "P2P: Overwrite pending interface " + "address for join from " MACSTR " to " MACSTR + " based on newly discovered P2P peer entry", + MAC2STR(wpa_s->pending_join_iface_addr), + MAC2STR(iface_addr)); + os_memcpy(wpa_s->pending_join_iface_addr, iface_addr, + ETH_ALEN); + + freq = p2p_get_oper_freq(wpa_s->global->p2p, + wpa_s->pending_join_iface_addr); + } if (freq >= 0) { wpa_printf(MSG_DEBUG, "P2P: Target GO operating frequency " "from P2P peer table: %d MHz", freq);