From da94015d2ea0601c167aa332ee031bb14c282a73 Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Thu, 17 Apr 2025 01:15:17 +0530 Subject: [PATCH] P2P2: Include the requested method in the bootstrap response notification In the bootstrap response indication, send the requested bootstrap method by the device to align with config method indicated in P2P-R1 provision discovery indication to the applications. Signed-off-by: Vinay Gannevaram --- src/p2p/p2p_pd.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index f08fa0e10..b0f893e7f 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -1713,7 +1713,8 @@ static void p2p_process_prov_disc_bootstrap_resp(struct p2p_data *p2p, if (p2p->cfg->bootstrap_rsp_rx) p2p->cfg->bootstrap_rsp_rx(p2p->cfg->cb_ctx, sa, status, - rx_freq, bootstrap); + rx_freq, + dev->req_bootstrap_method); return; } @@ -1721,13 +1722,35 @@ static void p2p_process_prov_disc_bootstrap_resp(struct p2p_data *p2p, if (msg->pbma_info_len >= 2) bootstrap = WPA_GET_LE16(msg->pbma_info); + /* Overwrite the status if bootstrap method does not match */ + if (status == P2P_SC_SUCCESS && + !(bootstrap == P2P_PBMA_PIN_CODE_DISPLAY && + dev->req_bootstrap_method == P2P_PBMA_PIN_CODE_KEYPAD) && + !(bootstrap == P2P_PBMA_PIN_CODE_KEYPAD && + dev->req_bootstrap_method == P2P_PBMA_PIN_CODE_DISPLAY) && + !(bootstrap == P2P_PBMA_PASSPHRASE_DISPLAY && + dev->req_bootstrap_method == P2P_PBMA_PASSPHRASE_KEYPAD) && + !(bootstrap == P2P_PBMA_PASSPHRASE_KEYPAD && + dev->req_bootstrap_method == P2P_PBMA_PASSPHRASE_DISPLAY) && + !(bootstrap == P2P_PBMA_NFC_TAG && + dev->req_bootstrap_method == P2P_PBMA_NFC_READER) && + !(bootstrap == P2P_PBMA_NFC_READER && + dev->req_bootstrap_method == P2P_PBMA_NFC_TAG) && + !(bootstrap == P2P_PBMA_QR_DISPLAY && + dev->req_bootstrap_method == P2P_PBMA_QR_SCAN) && + !(bootstrap == P2P_PBMA_QR_SCAN && + dev->req_bootstrap_method == P2P_PBMA_QR_DISPLAY) && + !(bootstrap == P2P_PBMA_OPPORTUNISTIC && + dev->req_bootstrap_method == P2P_PBMA_OPPORTUNISTIC)) + status = P2P_SC_FAIL_INVALID_PARAMS; + p2p->cfg->send_action_done(p2p->cfg->cb_ctx); if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG) dev->flags &= ~P2P_DEV_PD_BEFORE_GO_NEG; if (p2p->cfg->bootstrap_rsp_rx) p2p->cfg->bootstrap_rsp_rx(p2p->cfg->cb_ctx, sa, status, - rx_freq, bootstrap); + rx_freq, dev->req_bootstrap_method); } -- 2.47.2