P2P: Fix Provision Discovery channel for some join-GO cases

The Provision Discovery Request needs to be sent on the operating
channel of the GO and as such, the frequency from the BSS table
(scan results) need to override the frequency in the P2P peer
table that could be based on the Listen channel of the GO.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2011-12-18 17:21:25 +02:00
parent 19030351b9
commit 1ef2f7ffcf
5 changed files with 16 additions and 11 deletions

View file

@ -2373,7 +2373,7 @@ void p2p_continue_find(struct p2p_data *p2p)
MACSTR " (config methods 0x%x)",
MAC2STR(dev->info.p2p_device_addr),
dev->req_config_methods);
if (p2p_send_prov_disc_req(p2p, dev, 0) == 0)
if (p2p_send_prov_disc_req(p2p, dev, 0, 0) == 0)
return;
}
}
@ -2442,7 +2442,7 @@ static void p2p_retry_pd(struct p2p_data *p2p)
MACSTR " (config methods 0x%x)",
MAC2STR(dev->info.p2p_device_addr),
dev->req_config_methods);
p2p_send_prov_disc_req(p2p, dev, 0);
p2p_send_prov_disc_req(p2p, dev, 0, 0);
return;
}
}

View file

@ -897,6 +897,7 @@ int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr);
* @peer_addr: MAC address of the peer P2P client
* @config_methods: WPS Config Methods value (only one bit set)
* @join: Whether this is used by a client joining an active group
* @force_freq: Forced TX frequency for the frame (mainly for the join case)
* Returns: 0 on success, -1 on failure
*
* This function can be used to request a discovered P2P peer to display a PIN
@ -908,7 +909,7 @@ int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr);
* indicated with the p2p_config::prov_disc_resp() callback.
*/
int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
u16 config_methods, int join);
u16 config_methods, int join, int force_freq);
/**
* p2p_sd_request - Schedule a service discovery query

View file

@ -619,7 +619,7 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
const u8 *data, size_t len);
int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
int join);
int join, int force_freq);
void p2p_reset_pending_pd(struct p2p_data *p2p);
/* p2p_invitation.c */

View file

@ -283,12 +283,16 @@ out:
int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
int join)
int join, int force_freq)
{
struct wpabuf *req;
int freq;
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (force_freq > 0)
freq = force_freq;
else
freq = dev->listen_freq > 0 ? dev->listen_freq :
dev->oper_freq;
if (freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen/Operating frequency known for the "
@ -336,7 +340,7 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
u16 config_methods, int join)
u16 config_methods, int join, int force_freq)
{
struct p2p_device *dev;
@ -385,7 +389,7 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
if (p2p->user_initiated_pd && p2p->state == P2P_IDLE)
p2p->pd_retries = MAX_PROV_DISC_REQ_RETRIES;
return p2p_send_prov_disc_req(p2p, dev, join);
return p2p_send_prov_disc_req(p2p, dev, join, force_freq);
}

View file

@ -2549,8 +2549,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
}
if (p2p_prov_disc_req(wpa_s->global->p2p,
wpa_s->pending_join_dev_addr, method, 1)
< 0) {
wpa_s->pending_join_dev_addr, method, 1,
freq) < 0) {
wpa_printf(MSG_DEBUG, "P2P: Failed to send Provision "
"Discovery Request before joining an "
"existing group");
@ -3359,7 +3359,7 @@ int wpas_p2p_prov_disc(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
return -1;
return p2p_prov_disc_req(wpa_s->global->p2p, peer_addr,
config_methods, join);
config_methods, join, 0);
}