wpas_p2p_group_formation_timeout and p2p_group_formation

Michael Olbrich m.olbrich at pengutronix.de
Thu Dec 17 03:28:29 PST 2015


Hi,

On Mon, Nov 30, 2015 at 09:47:34PM +0200, Jouni Malinen wrote:
> On Mon, Nov 30, 2015 at 11:54:39AM +0100, Michael Olbrich wrote:
> P2P: Complete group formation on client data connection
> 
> This was already the case in the GO role where the first client
> connection is waited before marking
> wpa_s->p2p_go_group_formation_completed = 1 and clearing
> wpa_s->global->p2p_group_formation. However, in the P2P Client role,
> that was done already at the completion of the WPS exchange. This can be
> problematic since group formation timeout may still try to clear the
> group and with wpa_s->global->p2p_group_formation == NULL, the correct
> group interface may not be found.
> 
> Fix this by postponing clearing of wpa_s->global->p2p_group_formation on
> the P2P Client side until the data connection has been completed and
> group is declared started.

FYI: I've tested this now and it works as expected.

Thanks,
Michael

> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> index a60ae6e..077c5fe 100644
> --- a/wpa_supplicant/p2p_supplicant.c
> +++ b/wpa_supplicant/p2p_supplicant.c
> @@ -6340,6 +6340,8 @@ void wpas_p2p_wps_success(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
>  		eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT, 0,
>  				       wpas_p2p_group_formation_timeout,
>  				       wpa_s->parent, NULL);
> +		/* Complete group formation on successful data connection. */
> +		wpa_s->p2p_go_group_formation_completed = 0;
>  	} else if (ssid) {
>  		/*
>  		 * Use a separate timeout for initial data connection to
> @@ -6890,6 +6892,15 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
>  		return;
>  
>  	wpa_s->show_group_started = 0;
> +	if (!wpa_s->p2p_go_group_formation_completed &&
> +	    wpa_s->global->p2p_group_formation == wpa_s) {
> +		wpa_dbg(wpa_s, MSG_DEBUG,
> +			"P2P: Marking group formation completed on client on data connection");
> +		wpa_s->p2p_go_group_formation_completed = 1;
> +		wpa_s->global->p2p_group_formation = NULL;
> +		wpa_s->p2p_in_provisioning = 0;
> +		wpa_s->p2p_in_invitation = 0;
> +	}
>  
>  	os_memset(go_dev_addr, 0, ETH_ALEN);
>  	if (ssid->bssid_set)
> -- 
> 1.9.1

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the Hostap mailing list