nimble/ll: Start LL response timer when sending start encrypt
Make sure start that we receive start encrypt response withing 40 sec
otherwise drop the link
@@ -1137,6 +1137,11 @@ ble_ll_ctrl_start_enc_send(struct ble_ll_conn_sm *connsm)
if (om) {
om->om_data[0] = BLE_LL_CTRL_START_ENC_REQ;
ble_ll_conn_enqueue_pkt(connsm, om, BLE_LL_LLID_CTRL, 1);
+
+ /* Wait for LL_START_ENC_RSP */
+ connsm->cur_ctrl_proc = BLE_LL_CTRL_PROC_ENCRYPT;
+ ble_ll_ctrl_start_rsp_timer(connsm);
+
rc = 0;
} else {
rc = -1;
@@ -1353,11 +1358,12 @@ ble_ll_ctrl_rx_start_enc_rsp(struct ble_ll_conn_sm *connsm)
return BLE_ERR_MAX;
}
+ ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_ENCRYPT);
+
/* If master, we are done. Stop control procedure and sent event to host */
if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) {
/* We are encrypted */
connsm->enc_data.enc_state = CONN_ENC_S_ENCRYPTED;
- ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_ENCRYPT);
#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_PING) == 1)
ble_ll_conn_auth_pyld_timer_start(connsm);
#endif
