P2P: Set user_initiated_pd separately from the join parameter

p2p_prov_disc_req() used the join parameter to figure out whether the PD
request was a user initiated or not. This does not cover all use cases
of PD, so add a separate parameter to allow caller to indicate whether
the user requested the operation.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Sunil Dutt 2012-11-23 00:48:58 +02:00 committed by Jouni Malinen
parent 16e38f2e34
commit 6752716663
5 changed files with 13 additions and 11 deletions

View file

@ -958,6 +958,7 @@ int p2p_reject(struct p2p_data *p2p, const u8 *peer_addr);
* @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)
* @user_initiated_pd: Flag to indicate if initiated by user or not
* Returns: 0 on success, -1 on failure
*
* This function can be used to request a discovered P2P peer to display a PIN
@ -969,7 +970,8 @@ 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, int force_freq);
u16 config_methods, int join, int force_freq,
int user_initiated_pd);
/**
* p2p_sd_request - Schedule a service discovery query

View file

@ -211,7 +211,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
else
return -1;
return p2p_prov_disc_req(p2p, dev->info.p2p_device_addr,
config_method, 0, 0);
config_method, 0, 0, 1);
}
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;

View file

@ -408,7 +408,8 @@ 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, int force_freq)
u16 config_methods, int join, int force_freq,
int user_initiated_pd)
{
struct p2p_device *dev;
@ -446,11 +447,7 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
return 0;
}
/*
* We use the join param as a cue to differentiate between user
* initiated PD request and one issued during finds (internal).
*/
p2p->user_initiated_pd = !join;
p2p->user_initiated_pd = user_initiated_pd;
if (p2p->user_initiated_pd)
p2p->pd_retries = MAX_PROV_DISC_REQ_RETRIES;