Skip to content

Commit

Permalink
Bluetooth: Controller: Add explicit LLCP error code check
Browse files Browse the repository at this point in the history
Add unit tests to cover explicit LLCP error code check and
cover the same in the Controller implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
(cherry picked from commit d6f2bc9)
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
  • Loading branch information
cvinayak committed Jul 17, 2024
1 parent 2211c34 commit 59510f9
Show file tree
Hide file tree
Showing 2 changed files with 433 additions and 4 deletions.
16 changes: 13 additions & 3 deletions subsys/bluetooth/controller/ll_sw/ull_llcp_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,19 +382,29 @@ static void lp_enc_store_s(struct ll_conn *conn, struct proc_ctx *ctx, struct pd

static inline uint8_t reject_error_code(struct pdu_data *pdu)
{
uint8_t error;

if (pdu->llctrl.opcode == PDU_DATA_LLCTRL_TYPE_REJECT_IND) {
return pdu->llctrl.reject_ind.error_code;
error = pdu->llctrl.reject_ind.error_code;
#if defined(CONFIG_BT_CTLR_EXT_REJ_IND)
} else if (pdu->llctrl.opcode == PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND) {
return pdu->llctrl.reject_ext_ind.error_code;
error = pdu->llctrl.reject_ext_ind.error_code;
#endif /* CONFIG_BT_CTLR_EXT_REJ_IND */
} else {
/* Called with an invalid PDU */
LL_ASSERT(0);

/* Keep compiler happy */
return BT_HCI_ERR_UNSPECIFIED;
error = BT_HCI_ERR_UNSPECIFIED;
}

/* Check expected error code from the peer */
if (error != BT_HCI_ERR_PIN_OR_KEY_MISSING &&
error != BT_HCI_ERR_UNSUPP_REMOTE_FEATURE) {
error = BT_HCI_ERR_UNSPECIFIED;
}

return error;
}

static void lp_enc_st_wait_rx_enc_rsp(struct ll_conn *conn, struct proc_ctx *ctx, uint8_t evt,
Expand Down
Loading

0 comments on commit 59510f9

Please sign in to comment.