Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nimble/host: Send GAP pairing complete event only for pairing #1886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions nimble/host/src/ble_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ ble_sm_process_result(uint16_t conn_handle, struct ble_sm_result *res,

ble_hs_unlock();

if (res->enc_cb &&
if (proc && (proc->flags & BLE_SM_PROC_F_PAIRING) && res->enc_cb &&
res->app_status != BLE_HS_ENOTCONN) {
/* Do not send this event on broken connection */
ble_gap_pairing_complete_event(conn_handle, res->sm_err);
Expand Down Expand Up @@ -1831,6 +1831,7 @@ ble_sm_pair_req_rx(uint16_t conn_handle, struct os_mbuf **om,
if (proc != NULL) {
proc->conn_handle = conn_handle;
proc->state = BLE_SM_PROC_STATE_PAIR;
proc->flags = BLE_SM_PROC_F_PAIRING;
ble_sm_insert(proc);

proc->pair_req[0] = BLE_SM_OP_PAIR_REQ;
Expand Down Expand Up @@ -2575,7 +2576,7 @@ ble_sm_pair_initiate(uint16_t conn_handle)
} else {
proc->conn_handle = conn_handle;
proc->state = BLE_SM_PROC_STATE_PAIR;
proc->flags |= BLE_SM_PROC_F_INITIATOR;
proc->flags |= BLE_SM_PROC_F_INITIATOR | BLE_SM_PROC_F_PAIRING;

ble_hs_lock();
ble_sm_insert(proc);
Expand Down
1 change: 1 addition & 0 deletions nimble/host/src/ble_sm_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ struct ble_sm_dhkey_check {
#define BLE_SM_PROC_F_AUTHENTICATED 0x08
#define BLE_SM_PROC_F_SC 0x10
#define BLE_SM_PROC_F_BONDING 0x20
#define BLE_SM_PROC_F_PAIRING 0x40

#define BLE_SM_KE_F_ENC_INFO 0x01
#define BLE_SM_KE_F_MASTER_ID 0x02
Expand Down
Loading