Message ID | 1674720915.466491438763332055.JavaMail.weblogic@epmlwas08c |
---|---|
State | Rejected |
Headers | show |
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); > > + #ifdef SINGLE_P2P_INTERAFCE 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.
diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index 065321c..f54c093 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -431,8 +431,8 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, const u8 *data, size_t len, int rx_freq) { struct p2p_message msg; - struct p2p_device *dev; - int freq; + struct p2p_device *dev,*n; + int freq,failflag=0; enum p2p_status_code reject = P2P_SC_FAIL_INCOMPATIBLE_PARAMS; struct wpabuf *resp; u32 adv_id = 0; @@ -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); + #ifdef SINGLE_P2P_INTERAFCE + dl_list_for_each_safe(dev, n, &p2p->devices, struct p2p_device, list) { + 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 + dev = p2p_get_device(p2p, sa); + + if(dev && failflag) + goto out; + if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) { p2p_dbg(p2p, "Provision Discovery Request from unknown peer " MACSTR, MAC2STR(sa)); @@ -471,6 +488,9 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, dev->info.wfd_subelems = wpabuf_dup(msg.wfd_subelems); } + if(failflag) + goto out; + if (msg.adv_id) allowed_config_methods |= WPS_CONFIG_P2PS; else