mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-14 05:57:55 +00:00
Add adv interval min/max range check
This commit is contained in:
committed by
Abhinav Kudnar
parent
5854ae7dc4
commit
e2ec7a3dea
@@ -2831,6 +2831,20 @@ ble_gap_adv_validate(uint8_t own_addr_type, const ble_addr_t *peer_addr,
|
||||
return BLE_HS_EALREADY;
|
||||
}
|
||||
|
||||
if (adv_params->itvl_min &&
|
||||
#if MYNEWT_VAL(BLE_HIGH_DUTY_ADV_ITVL)
|
||||
(adv_params->itvl_min < 0x5)
|
||||
#else
|
||||
(adv_params->itvl_min < 0x20)
|
||||
#endif
|
||||
) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (adv_params->itvl_max && adv_params->itvl_max > 0x4000) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
switch (adv_params->conn_mode) {
|
||||
case BLE_GAP_CONN_MODE_NON:
|
||||
/* High duty cycle only allowed for directed advertising. */
|
||||
@@ -3200,6 +3214,20 @@ ble_gap_ext_adv_params_validate(const struct ble_gap_ext_adv_params *params)
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (params->itvl_min &&
|
||||
#if MYNEWT_VAL(BLE_HIGH_DUTY_ADV_ITVL)
|
||||
(params->itvl_min < 0x5)
|
||||
#else
|
||||
(params->itvl_min < 0x20)
|
||||
#endif
|
||||
) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
if (params->itvl_max && params->itvl_max > 0xFFFFFF) {
|
||||
return BLE_HS_EINVAL;
|
||||
}
|
||||
|
||||
/* Don't allow connectable advertising if we won't be able to allocate
|
||||
* a new connection.
|
||||
*/
|
||||
@@ -6473,6 +6501,10 @@ ble_gap_validate_conn_params(const struct ble_gap_upd_params *params)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (params->supervision_timeout < 0x000A || params->supervision_timeout > 0xC80) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user