[PATCH 1/3] P2P: rejecting provision discovery request for single p2p interface as GC

Jouni Malinen j
Wed Aug 5 02:42:34 PDT 2015

On Wed, Aug 05, 2015 at 08:28:52AM +0000, Avichal Agarwal wrote:
> This patch will work when there is only single p2p interface (which act as both  GC and GO).
> It rejects provision discovery request when single p2p interface is already connected as group client.

Why would this be needed? What harm is there in replying to provision
discovery request even if there is already a group in operation? The P2P
design should allow a peer to request a new group to be formed and the
local device can then ask the user to select whether to reject such
request or whether to tear down the current group and accept the new
request in case the device supports only a single concurrent group.

> diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
> @@ -456,7 +456,24 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
>  		" with config methods 0x%x (freq=%d)",
>  		MAC2STR(sa), msg.wps_config_methods, rx_freq);

There should be no compile time hardcoded defines for this type of
changes. It is possible to automatically determine whether the driver
and current configuration supports multiple groups.

> +	dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) {

Why is this using dl_list_for_each_safe()? What could change in the peer
table during this loop?

> +		if (p2p->cfg->go_connected &&
> +			p2p->cfg->go_connected(p2p->cfg->cb_ctx,
> +				dev->info.p2p_device_addr)) {
> +				p2p_dbg(p2p, " Already connected  Provision Discovery Request  Ignored\n");
> +				reject = P2P_SC_FAIL_REJECTED_BY_USER;
> +				failflag=1;
> +				break;
> +			}
> +	}
> +	#endif	

This sounds quite strange.. Why would we need to check explicitly for a
connection to a GO here? Is this trying to figure out that we have a
group and are not the GO in that group? If so, there has to be better
ways of doing that.. Anyway, I do not think I would accept this change,
so not much need to clean this up either. I don't see much point in
claiming that the user rejected a provision discovery in this type of
case unless we have actually asked the user.

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list