Merge branch 'bugfix/add_authmode_wpa_wpa2_wpa3_psk_v5.0' into 'release/v5.0'

esp_wifi: Handle case when AP advertises WPA, WPA2 and WPA3 securities simultaneously and other bugfixes (Backport v5.0)

See merge request espressif/esp-idf!29678
This commit is contained in:
Jiang Jiang Jian 2024-05-28 17:34:18 +08:00
commit cb4d647d0c
7 changed files with 17 additions and 20 deletions

View File

@ -366,7 +366,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list)
int data_len;
uint8_t *p;
// malloc size: (len + RSSI + ssid buffer) * apCount;
uint malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount;
uint32_t malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount;
p = data = osi_malloc(malloc_size);
if (data == NULL) {
BTC_TRACE_ERROR("malloc error\n");
@ -375,7 +375,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list)
type = BLUFI_BUILD_TYPE(BLUFI_TYPE_DATA, BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST);
for (int i = 0; i < apCount; ++i)
{
uint len = strlen((const char *)list[i].ssid);
uint32_t len = strlen((const char *)list[i].ssid);
data_len = (p - data);
//current_len + ssid + rssi + total_len_value
if((data_len + len + 1 + 1) > malloc_size) {

View File

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -139,9 +139,9 @@ esp_err_t esp_ble_mesh_node_input_string(const char *string)
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_INPUT_STRING;
memset(arg.input_string.string, 0, sizeof(arg.input_string.string));
strncpy(arg.input_string.string, string,
MIN(strlen(string), sizeof(arg.input_string.string)));
arg.input_string.string[sizeof(arg.input_string.string) - 1] = 0;
strncpy(arg.input_string.string, string, sizeof(arg.input_string.string) - 1);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
@ -162,8 +162,8 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name)
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_SET_DEVICE_NAME;
memset(arg.set_device_name.name, 0, sizeof(arg.set_device_name.name));
strncpy(arg.set_device_name.name, name, ESP_BLE_MESH_DEVICE_NAME_MAX_LEN);
arg.set_device_name.name[sizeof(arg.set_device_name.name) - 1] = 0;
strncpy(arg.set_device_name.name, name, sizeof(arg.set_device_name.name) - 1);
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
@ -210,9 +210,8 @@ esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link
msg.pid = BTC_PID_PROV;
msg.act = BTC_BLE_MESH_ACT_PROVISIONER_INPUT_STR;
memset(arg.provisioner_input_str.string, 0, sizeof(arg.provisioner_input_str.string));
strncpy(arg.provisioner_input_str.string, string,
MIN(strlen(string), sizeof(arg.provisioner_input_str.string)));
arg.provisioner_input_str.string[sizeof(arg.provisioner_input_str.string) - 1] = 0;
strncpy(arg.provisioner_input_str.string, string, sizeof(arg.provisioner_input_str.string) - 1);
arg.provisioner_input_str.link_idx = link_idx;
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL)

View File

@ -37,7 +37,8 @@ typedef struct {
tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0};
extern void btm_ble_inter_set(bool extble_inter);
static char *btm_ble_hci_status_to_str(tHCI_STATUS status)
#if !UC_BT_STACK_NO_LOG
static const char *btm_ble_hci_status_to_str(tHCI_STATUS status)
{
switch(status) {
case HCI_SUCCESS:
@ -186,6 +187,7 @@ static char *btm_ble_hci_status_to_str(tHCI_STATUS status)
return NULL;
}
#endif /* !UC_BT_STACK_NO_LOG */
void btm_ble_extendadvcb_init(void)
{

View File

@ -949,6 +949,7 @@ static void btu_hcif_esco_connection_chg_evt (UINT8 *p)
static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_len,
void *p_cplt_cback)
{
uint8_t status;
switch (opcode) {
case HCI_INQUIRY_CANCEL:
/* Tell inquiry processing that we are done */
@ -1011,7 +1012,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
btm_ble_clear_white_list_complete(p, evt_len);
break;
case HCI_BLE_WRITE_ADV_PARAMS: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci write adv params error 0x%x", status);
@ -1019,7 +1019,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
}
case HCI_BLE_RC_PARAM_REQ_REPLY: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci connection params reply command error 0x%x", status);
@ -1027,7 +1026,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
break;
}
case HCI_BLE_RC_PARAM_REQ_NEG_REPLY: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("hci connection params neg reply command error %x", status);
@ -1100,13 +1098,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
case HCI_BLE_SET_EXT_ADV_DATA:
case HCI_BLE_SET_EXT_SCAN_RSP_DATA:
case HCI_BLE_SET_EXT_ADV_ENABLE: {
uint8_t status;
STREAM_TO_UINT8 (status, p);
HCI_TRACE_EVENT("%s opcode 0x%x status 0x%x", __func__, opcode, status);
break;
}
case HCI_BLE_READ_PHY: {
uint8_t status;
uint16_t conn_handle;
uint8_t tx_phy;
uint8_t rx_phy;
@ -1129,7 +1125,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
case HCI_BLE_PERIOD_ADV_SYNC_TRANS:
case HCI_BLE_PERIOD_ADV_SET_INFO_TRANS:
case HCI_BLE_SET_PAST_PARAMS: {
UINT8 status;
UINT16 conn_handle;
STREAM_TO_UINT8(status, p);
STREAM_TO_UINT16(conn_handle, p);
@ -1143,7 +1138,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC) {
btm_vsc_complete (p, opcode, evt_len, (tBTM_CMPL_CB *)p_cplt_cback);
}
uint8_t status;
STREAM_TO_UINT8 (status, p);
if(status != HCI_SUCCESS) {
HCI_TRACE_ERROR("CC evt: op=0x%x, status=0x%x", opcode, status);

@ -1 +1 @@
Subproject commit 5cebf92b398440266977440db81b0315831aeb41
Subproject commit 4cbb797214650d5ff5e9854cfb4cc10e8c9bda4c

View File

@ -0,0 +1 @@
CONFIG_COMPILER_OPTIMIZATION_SIZE=y

View File

@ -7,6 +7,7 @@ CONFIG_CTRL_BTDM_MODEM_SLEEP=y
CONFIG_BT_GATTS_SEND_SERVICE_CHANGE_MANUAL=y
CONFIG_BT_BTU_TASK_STACK_SIZE=4512
CONFIG_BT_BLE_42_FEATURES_SUPPORTED=y
CONFIG_BT_STACK_NO_LOG=y
# Partition Table
CONFIG_PARTITION_TABLE_CUSTOM=y