P2PS: Provision Discovery fail event

This extends P2P-PROV-DISC-FAILURE with adv_id and deferred_session_resp
in P2PS cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Krishna Vamsi 2014-12-10 17:21:09 +05:30 committed by Jouni Malinen
parent 1300cc8e8f
commit ab8ee776b9
4 changed files with 36 additions and 7 deletions

View file

@ -3832,6 +3832,9 @@ static void p2p_timeout_prov_disc_during_find(struct p2p_data *p2p)
static void p2p_timeout_prov_disc_req(struct p2p_data *p2p)
{
u32 adv_id = 0;
u8 *adv_mac = NULL;
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
/*
@ -3860,12 +3863,18 @@ static void p2p_timeout_prov_disc_req(struct p2p_data *p2p)
for_join = 1;
}
if (p2p->p2ps_prov) {
adv_id = p2p->p2ps_prov->adv_id;
adv_mac = p2p->p2ps_prov->adv_mac;
}
if (p2p->cfg->prov_disc_fail)
p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx,
p2p->pending_pd_devaddr,
for_join ?
P2P_PROV_DISC_TIMEOUT_JOIN :
P2P_PROV_DISC_TIMEOUT);
P2P_PROV_DISC_TIMEOUT,
adv_id, adv_mac, NULL);
p2p_reset_pending_pd(p2p);
}
}

View file

@ -808,6 +808,9 @@ struct p2p_config {
* @ctx: Callback context from cb_ctx
* @peer: Source address of the response
* @status: Cause of failure, will not be %P2P_PROV_DISC_SUCCESS
* @adv_id: If non-zero, then the adv_id of the PD Request
* @adv_mac: P2P Device Address of the advertizer
* @deferred_session_resp: Deferred session response sent by advertizer
*
* This callback is used to indicate either a failure or no response
* to an earlier provision discovery request.
@ -816,7 +819,9 @@ struct p2p_config {
* 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);
enum p2p_prov_disc_status status,
u32 adv_id, const u8 *adv_mac,
const char *deferred_session_resp);
/**
* invitation_process - Optional callback for processing Invitations

View file

@ -841,7 +841,8 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
msg.wps_config_methods, req_config_methods);
if (p2p->cfg->prov_disc_fail)
p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa,
P2P_PROV_DISC_REJECTED);
P2P_PROV_DISC_REJECTED,
0, NULL, NULL);
p2p_parse_free(&msg);
goto out;
}

View file

@ -3706,7 +3706,9 @@ static void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
static void wpas_prov_disc_fail(void *ctx, const u8 *peer,
enum p2p_prov_disc_status status)
enum p2p_prov_disc_status status,
u32 adv_id, const u8 *adv_mac,
const char *deferred_session_resp)
{
struct wpa_supplicant *wpa_s = ctx;
@ -3726,9 +3728,21 @@ static void wpas_prov_disc_fail(void *ctx, const u8 *peer,
return;
}
if (adv_id && adv_mac && deferred_session_resp) {
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=%d adv_id=%x"
" deferred_session_resp='%s'",
MAC2STR(peer), status, adv_id,
deferred_session_resp);
} else if (adv_id && adv_mac) {
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=%d adv_id=%x",
MAC2STR(peer), status, adv_id);
} else {
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=%d",
MAC2STR(peer), status);
}
wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
status, 0, 0);