]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Update pending join interface address during scans
authorAlbert Liu <albertliu@atheros.com>
Mon, 15 Nov 2010 14:16:39 +0000 (16:16 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 15 Nov 2010 14:16:39 +0000 (16:16 +0200)
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

index f9bf472a0bf8ed3ff204fa97db079aa3d54948e2..fe1577e651833a8a2fea38f752a7f0bce11abda5 100644 (file)
@@ -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);