[PATCH] P2P: prevent p2pdev from roaming

Arend van Spriel arend
Mon Dec 1 01:32:58 PST 2014


On 12/01/14 09:36, Michal Kazior wrote:
> 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>
> ---
>   wpa_supplicant/events.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
> index c404dd2..62aa32e 100644
> --- a/wpa_supplicant/events.c
> +++ b/wpa_supplicant/events.c
> @@ -1139,6 +1139,12 @@ static void wpa_supplicant_rsn_preauth_scan_results(
>   }
>
>
> +static int wpa_supplicant_is_p2pdev(struct wpa_supplicant *wpa_s)
> +{
> +	return wpa_s->parent&&  wpa_s->parent->p2p_dev == wpa_s;
> +}
> +
> +
>   static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
>   				       struct wpa_bss *selected,
>   				       struct wpa_ssid *ssid)
> @@ -1146,6 +1152,8 @@ static int wpa_supplicant_need_to_roam(struct wpa_supplicant *wpa_s,
>   	struct wpa_bss *current_bss = NULL;
>   	int min_diff;
>
> +	if (wpa_supplicant_is_p2pdev(wpa_s))

Could check wpa_s->p2p_mgmt here instead, which is set for dedicated p2p 
management interface, ie. p2pdev.

Regards,
Arend

> +		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