P2P: Add callback for provision discovery failure
When provision discovery fails, this new callback will be called so P2P users can react to the failure. Signed-off-by: Jayant Sane <jayant.sane@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
6b56cc2d97
commit
349b213cc8
3 changed files with 28 additions and 0 deletions
|
@ -2734,6 +2734,10 @@ static void p2p_timeout_prov_disc_req(struct p2p_data *p2p)
|
||||||
p2p->pd_retries--;
|
p2p->pd_retries--;
|
||||||
p2p_retry_pd(p2p);
|
p2p_retry_pd(p2p);
|
||||||
} else {
|
} else {
|
||||||
|
if (p2p->cfg->prov_disc_fail)
|
||||||
|
p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx,
|
||||||
|
p2p->pending_pd_devaddr,
|
||||||
|
P2P_PROV_DISC_TIMEOUT);
|
||||||
p2p_reset_pending_pd(p2p);
|
p2p_reset_pending_pd(p2p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,6 +210,12 @@ struct p2p_peer_info {
|
||||||
struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
|
struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum p2p_prov_disc_status {
|
||||||
|
P2P_PROV_DISC_SUCCESS,
|
||||||
|
P2P_PROV_DISC_TIMEOUT,
|
||||||
|
P2P_PROV_DISC_REJECTED,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct p2p_config - P2P configuration
|
* struct p2p_config - P2P configuration
|
||||||
*
|
*
|
||||||
|
@ -602,6 +608,21 @@ struct p2p_config {
|
||||||
*/
|
*/
|
||||||
void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods);
|
void (*prov_disc_resp)(void *ctx, const u8 *peer, u16 config_methods);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* prov_disc_fail - Callback on Provision Discovery failure
|
||||||
|
* @ctx: Callback context from cb_ctx
|
||||||
|
* @peer: Source address of the response
|
||||||
|
* @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS
|
||||||
|
*
|
||||||
|
* This callback is used to indicate either a failure or no response
|
||||||
|
* to an earlier provision discovery request.
|
||||||
|
*
|
||||||
|
* This callback handler can be set to %NULL if provision discovery
|
||||||
|
* is not used or failures do not need to be indicated.
|
||||||
|
*/
|
||||||
|
void (*prov_disc_fail)(void *ctx, const u8 *peer,
|
||||||
|
enum p2p_prov_disc_status status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* invitation_process - Optional callback for processing Invitations
|
* invitation_process - Optional callback for processing Invitations
|
||||||
* @ctx: Callback context from cb_ctx
|
* @ctx: Callback context from cb_ctx
|
||||||
|
|
|
@ -247,6 +247,9 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
|
||||||
if (msg.wps_config_methods != dev->req_config_methods) {
|
if (msg.wps_config_methods != dev->req_config_methods) {
|
||||||
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer rejected "
|
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer rejected "
|
||||||
"our Provisioning Discovery Request");
|
"our Provisioning Discovery Request");
|
||||||
|
if (p2p->cfg->prov_disc_fail)
|
||||||
|
p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa,
|
||||||
|
P2P_PROV_DISC_REJECTED);
|
||||||
p2p_parse_free(&msg);
|
p2p_parse_free(&msg);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue