Skip to content

Commit b7c4d9a

Browse files
committed
Merge branch 'bugfix/btdm_add_check_peer_addr_type_in_set_adv_params_v3.0' into 'release/v3.0'
Component/bt: add check peer addr type in set adv params (backport v3.0) See merge request idf/esp-idf!3737
2 parents 9ee965c + 896d406 commit b7c4d9a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

components/bt/bluedroid/api/include/esp_gap_ble_api.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ typedef struct {
219219
esp_ble_adv_type_t adv_type; /*!< Advertising type */
220220
esp_ble_addr_type_t own_addr_type; /*!< Owner bluetooth device address type */
221221
esp_bd_addr_t peer_addr; /*!< Peer device bluetooth device address */
222-
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type */
222+
esp_ble_addr_type_t peer_addr_type; /*!< Peer device bluetooth device address type, only support public address type and random address type */
223223
esp_ble_adv_channel_t channel_map; /*!< Advertising channel map */
224224
esp_ble_adv_filter_t adv_filter_policy; /*!< Advertising filter policy */
225225
} esp_ble_adv_params_t;

components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c

+6
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,12 @@ static void btc_ble_start_advertising (esp_ble_adv_params_t *ble_adv_params, tBT
514514
status = ESP_BT_STATUS_PARM_INVALID;
515515
LOG_ERROR("Invalid advertisting channel map parameters.\n");
516516
}
517+
518+
if (!BLE_ISVALID_PARAM(ble_adv_params->peer_addr_type, BLE_ADDR_TYPE_PUBLIC, BLE_ADDR_TYPE_RANDOM)) {
519+
status = ESP_BT_STATUS_PARM_INVALID;
520+
LOG_ERROR("Invalid advertisting peer address type parameters.\n");
521+
}
522+
517523
if(status != ESP_BT_STATUS_SUCCESS) {
518524
if(start_adv_cback) {
519525
start_adv_cback(status);

0 commit comments

Comments
 (0)