P2PS: Send follow-on PD response only if status is 12

When a follow-on PD request is received, peer should not send a
follow-on PD response except the case when the PD request status value
is 12 (Success: accepted by user). Previously, the wpa_supplicant
implementation behaved differently sending the follow-on PD Response on
any follow-on PD Request.

Fix the issue by adding the following changes:

1. Don't send PD Response if the follow-on PD Request status is
   different than 12 (seeker side).
2. Don't wait for the follow-on PD Response if the follow-on PD
   Request was sent with the status different than 12 (advertiser
   side).
3. If the follow-on PD Request was sent with the status different
   than 12 use the follow-on PD Request ACK as PD completion event
   (advertiser side).
4. Notify ASP about the PD completion by sending P2PS-PROV-DONE with
   the PD Request status (advertiser side).

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
This commit is contained in:
Max Stepanov 2015-09-24 20:37:54 +03:00 committed by Jouni Malinen
parent 9773ea38cf
commit f94e4c20e4
2 changed files with 76 additions and 31 deletions

View file

@ -3326,6 +3326,43 @@ static void p2p_prov_disc_cb(struct p2p_data *p2p, int success)
return;
}
/*
* If after PD Request the peer doesn't expect to receive PD Response
* the PD Request ACK indicates a completion of the current PD. This
* happens only on the advertiser side sending the follow-on PD Request
* with the status different than 12 (Success: accepted by user).
*/
if (p2p->p2ps_prov && !p2p->p2ps_prov->pd_seeker &&
p2p->p2ps_prov->status != P2P_SC_SUCCESS_DEFERRED) {
p2p_dbg(p2p, "P2PS PD completion on Follow-on PD Request ACK");
if (p2p->send_action_in_progress) {
p2p->send_action_in_progress = 0;
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
}
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (p2p->cfg->p2ps_prov_complete) {
p2p->cfg->p2ps_prov_complete(
p2p->cfg->cb_ctx,
p2p->p2ps_prov->status,
p2p->p2ps_prov->adv_mac,
p2p->p2ps_prov->adv_mac,
p2p->p2ps_prov->session_mac,
NULL, p2p->p2ps_prov->adv_id,
p2p->p2ps_prov->session_id,
0, 0, NULL, 0, 0, 0,
NULL, NULL, 0);
}
if (p2p->user_initiated_pd)
p2p_reset_pending_pd(p2p);
p2ps_prov_free(p2p);
return;
}
/*
* This postponing, of resetting pending_action_state, needs to be
* done only for user initiated PD requests and not internal ones.