Bluetooth: Controller: Check for duplicate handles in le_set_ext_adv_enable

If there are duplicate handles the Controller shall return the
error code Invalid HCI Command Parameters (0x12)

Fixes a failure in the EBQ test LE/AdvExt/Req-01 (part of the Ellisys
quality test suite)

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2023-08-02 12:47:55 +02:00 committed by Carles Cufí
parent 5eaace1c01
commit 8ff4585270

View file

@ -3529,6 +3529,18 @@ static void le_set_ext_adv_enable(struct net_buf *buf, struct net_buf **evt)
return;
}
/* Check for duplicate handles */
if (IS_ENABLED(CONFIG_BT_CTLR_PARAM_CHECK)) {
for (uint8_t i = 0U; i < set_num - 1; i++) {
for (uint8_t j = i + 1U; j < set_num; j++) {
if (cmd->s[i].handle == cmd->s[j].handle) {
*evt = cmd_complete_status(BT_HCI_ERR_INVALID_PARAM);
return;
}
}
}
}
s = (void *) cmd->s;
do {
status = ll_adv_set_by_hci_handle_get(s->handle, &handle);