Bluetooth: Controller: Fix per adv interval value check

Invalid values should result in BT_HCI_ERR_INVALID_PARAM

The interval check should only fail with
BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL if the requested range
cannot be fulfilled by the controller (ie. there is no overlap
with the supported range)

Fixes EBQ tests HCI/DDI/BI-53-C through HCI/DDI/BI-61-C and
HCI/CCO/BI-64-C

Signed-off-by: Troels Nilsson <trnn@demant.com>
This commit is contained in:
Troels Nilsson 2024-02-29 12:41:11 +01:00 committed by Fabio Baltieri
commit 9ce9d57732

View file

@ -3652,17 +3652,25 @@ static void le_set_per_adv_param(struct net_buf *buf, struct net_buf **evt)
const uint32_t min_interval =
sys_le16_to_cpu(cmd->min_interval);
/* Compare periodic advertising interval maximum with
if ((min_interval > max_interval) ||
(min_interval < BT_HCI_LE_PER_ADV_INTERVAL_MIN)) {
*evt = cmd_complete_status(BT_HCI_ERR_INVALID_PARAM);
return;
}
/* Compare periodic advertising interval with
* implementation supported periodic advertising interval
* maximum value defined in the Kconfig
* CONFIG_BT_CTLR_ADV_PERIODIC_INTERVAL_MAX.
*/
if ((min_interval > max_interval) ||
(min_interval < BT_HCI_LE_PER_ADV_INTERVAL_MIN) ||
(max_interval > CONFIG_BT_CTLR_ADV_PERIODIC_INTERVAL_MAX)) {
if (min_interval > CONFIG_BT_CTLR_ADV_PERIODIC_INTERVAL_MAX) {
*evt = cmd_complete_status(BT_HCI_ERR_UNSUPP_FEATURE_PARAM_VAL);
return;
}
if (max_interval > CONFIG_BT_CTLR_ADV_PERIODIC_INTERVAL_MAX) {
max_interval = CONFIG_BT_CTLR_ADV_PERIODIC_INTERVAL_MAX;
}
}
status = ll_adv_set_by_hci_handle_get(cmd->handle, &handle);