@@ -1034,14 +1034,16 @@ struct p2p_config {
* @ssid_len: Buffer for returning length of @ssid
* @group_iface: Buffer for returning whether a separate group interface
* would be used
+ * @freq: if a currently running P2P GO is to be used, its current freq
+ * would be used
* Returns: 1 if GO info found, 0 otherwise
*
* This is used to compose New Group settings (SSID, and intended
* address) during P2PS provisioning if results of provisioning *might*
* result in our being an autonomous GO.
*/
- int (*get_go_info)(void *ctx, u8 *intended_addr,
- u8 *ssid, size_t *ssid_len, int *group_iface);
+ int (*get_go_info)(void *ctx, u8 *intended_addr, u8 *ssid,
+ size_t *ssid_len, int *group_iface, int *freq);
/**
* remove_stale_groups - Remove stale P2PS groups
@@ -40,21 +40,30 @@ static void p2p_build_wps_ie_config_methods(struct wpabuf *buf,
}
-static void p2ps_add_new_group_info(struct p2p_data *p2p, struct wpabuf *buf)
+static void p2ps_add_new_group_info(struct p2p_data *p2p,
+ struct p2p_device *dev,
+ struct wpabuf *buf)
{
int found;
u8 intended_addr[ETH_ALEN];
u8 ssid[SSID_MAX_LEN];
size_t ssid_len;
int group_iface;
+ int force_freq;
if (!p2p->cfg->get_go_info)
return;
found = p2p->cfg->get_go_info(
p2p->cfg->cb_ctx, intended_addr, ssid,
- &ssid_len, &group_iface);
+ &ssid_len, &group_iface, &force_freq);
if (found) {
+ if (force_freq > 0) {
+ p2p->p2ps_prov->force_freq = force_freq;
+ p2p->p2ps_prov->pref_freq = 0;
+
+ p2p_prepare_channel(p2p, dev, force_freq, 0, 0);
+ }
p2p_buf_add_group_id(buf, p2p->cfg->dev_addr,
ssid, ssid_len);
@@ -99,7 +108,7 @@ static void p2ps_add_pd_req_attrs(struct p2p_data *p2p, struct p2p_device *dev,
if (!follow_on_req_fail &&
(prov->conncap & (P2PS_SETUP_GROUP_OWNER |
P2PS_SETUP_NEW)))
- p2ps_add_new_group_info(p2p, buf);
+ p2ps_add_new_group_info(p2p, dev, buf);
if (prov->status >= 0)
p2p_buf_add_status(buf, (u8) prov->status);
@@ -331,7 +340,7 @@ static struct wpabuf * p2p_build_prov_disc_resp(struct p2p_data *p2p,
}
if (!persist && (conncap & P2PS_SETUP_GROUP_OWNER))
- p2ps_add_new_group_info(p2p, buf);
+ p2ps_add_new_group_info(p2p, dev, buf);
/* Add Operating Channel if conncap indicates GO */
if (persist || (conncap & P2PS_SETUP_GROUP_OWNER)) {
@@ -608,20 +608,6 @@ wpas_p2p_get_cli_group(struct wpa_supplicant *wpa_s)
}
-/* Find an active P2P group where we are the GO */
-static struct wpa_ssid * wpas_p2p_group_go_ssid(struct wpa_supplicant *wpa_s,
- u8 *bssid)
-{
- struct wpa_supplicant *go = wpas_p2p_get_go_group(wpa_s);
-
- if (!go)
- return NULL;
-
- os_memcpy(bssid, go->own_addr, ETH_ALEN);
- return go->current_ssid;
-}
-
-
/* Find a persistent group where we are the GO */
static struct wpa_ssid *
wpas_p2p_get_persistent_go(struct wpa_supplicant *wpa_s)
@@ -3675,12 +3661,12 @@ static int wpas_get_persistent_group(void *ctx, const u8 *addr, const u8 *ssid,
}
-static int wpas_get_go_info(void *ctx, u8 *intended_addr,
- u8 *ssid, size_t *ssid_len, int *group_iface)
+static int wpas_get_go_info(void *ctx, u8 *intended_addr, u8 *ssid,
+ size_t *ssid_len, int *group_iface, int *freq)
{
struct wpa_supplicant *wpa_s = ctx;
+ struct wpa_supplicant *go;
struct wpa_ssid *s;
- u8 bssid[ETH_ALEN];
/*
* group_iface will be set to 1 only if a dedicated interface for P2P
@@ -3690,17 +3676,25 @@ static int wpas_get_go_info(void *ctx, u8 *intended_addr,
* that the pending interface should be used.
*/
*group_iface = 0;
- s = wpas_p2p_group_go_ssid(wpa_s, bssid);
- if (!s) {
+
+ if (freq)
+ *freq = 0;
+
+ go = wpas_p2p_get_go_group(wpa_s);
+ if (!go) {
s = wpas_p2p_get_persistent_go(wpa_s);
*group_iface = wpas_p2p_create_iface(wpa_s);
if (s)
- os_memcpy(bssid, s->bssid, ETH_ALEN);
+ os_memcpy(intended_addr, s->bssid, ETH_ALEN);
else
return 0;
+ } else {
+ s = go->current_ssid;
+ os_memcpy(intended_addr, go->own_addr, ETH_ALEN);
+ if (freq)
+ *freq = go->assoc_freq;
}
- os_memcpy(intended_addr, bssid, ETH_ALEN);
os_memcpy(ssid, s->ssid, s->ssid_len);
*ssid_len = s->ssid_len;
In case that there is an active P2P GO that is going to be used for the P2PS PD, force its current operating frequency in the PD attributes. Signed-off-by: Ilan Peer <ilan.peer@intel.com> --- src/p2p/p2p.h | 6 ++++-- src/p2p/p2p_pd.c | 17 +++++++++++++---- wpa_supplicant/p2p_supplicant.c | 36 +++++++++++++++--------------------- 3 files changed, 32 insertions(+), 27 deletions(-)