[PATCH v2] P2P: prevent p2pdev from roaming

Michal Kazior michal.kazior
Mon Dec 1 01:54:11 PST 2014

It was possible for a P2P_DEVICE to receive scan results and
subsequently start roaming due to a matching network. This caused
P2P find stop working (state machines seemed to be confused).

The test case was as follows:

 1. start wpa_s on wlan1,
 2. wlan1 scans, matches BSS and connects to configured network,
 3. p2p_find, p2p_connect (p2p-wlan1-0 gets created) as client,
 4. kill the GO (e.g. eject usb dongle) to trigger beacon loss on client,
 5. p2p-wlan-1-0 disconnects, runs scan but results aren't consumed so
    sibling wpa_s get them (including the P2P_DEVICE: p2p-dev-wlan1 in
    this case),
 6. p2p-dev-wlan1 starts sme-connect work becuase it finds a matching network
    (the one wlan1 is already connected to).

Since p2p-dev-* isn't even a netdev make sure to prevent roaming
for it and prevent subsequent state machine confusion.

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>

     * use wpa_s->p2p_mgmt [Arend]

 wpa_supplicant/events.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index c404dd2..61ad696 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -1146,6 +1146,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
 	struct wpa_bss *current_bss = NULL;
 	int min_diff;
+	if (wpa_s->p2p_mgmt)
+		return 0; /* p2pdev isn't even a netdev so it can't roam */
 	if (wpa_s->reassociate)
 		return 1; /* explicit request to reassociate */
 	if (wpa_s->wpa_state < WPA_ASSOCIATED)

More information about the Hostap mailing list