fix(ble_mesh): fixed proxy server might send segment message with incorrect format

(cherry picked from commit 7738bca124)

Co-authored-by: luoxu <luoxu@espressif.com>
This commit is contained in:
Luo Xu
2025-06-03 20:23:39 +08:00
committed by luoxu
parent a468bbcadd
commit 42a3c9b024
4 changed files with 8 additions and 7 deletions

View File

@@ -667,7 +667,7 @@ int bt_le_ext_adv_start(const uint8_t inst_id,
interval >>= 1; interval >>= 1;
interval += (bt_mesh_get_rand() % (interval + 1)); interval += (bt_mesh_get_rand() % (interval + 1));
BT_INFO("%u->%u", param->interval_min, interval); BT_DBG("%u->%u", param->interval_min, interval);
} }
#endif #endif

View File

@@ -1223,7 +1223,7 @@ int bt_le_ext_adv_start(const uint8_t inst_id,
interval >>= 1; interval >>= 1;
interval += (bt_mesh_get_rand() % (interval + 1)); interval += (bt_mesh_get_rand() % (interval + 1));
BT_INFO("%u->%u", param->interval_min, interval); BT_DBG("%u->%u", param->interval_min, interval);
} }
#endif #endif

View File

@@ -1363,7 +1363,7 @@ int bt_mesh_proxy_server_segment_send(struct bt_mesh_conn *conn, uint8_t type,
net_buf_simple_pull(msg, mtu); net_buf_simple_pull(msg, mtu);
while (msg->len) { while (msg->len) {
if (msg->len + 1 < mtu) { if (msg->len + 1 <= mtu) {
net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type)); net_buf_simple_push_u8(msg, BLE_MESH_PROXY_PDU_HDR(BLE_MESH_PROXY_SAR_LAST, type));
proxy_send(conn, msg->data, msg->len); proxy_send(conn, msg->data, msg->len);
break; break;

View File

@@ -2,7 +2,7 @@
/* /*
* SPDX-FileCopyrightText: 2017 Intel Corporation * SPDX-FileCopyrightText: 2017 Intel Corporation
* SPDX-FileContributor: 2020-2024 Espressif Systems (Shanghai) CO LTD * SPDX-FileContributor: 2020-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -102,13 +102,14 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
{ {
uint8_t idx = 0; uint8_t idx = 0;
uint8_t cnt = 0; uint8_t cnt = 0;
uint8_t pair_num = unprov_dev_info_fifo.pair_num;
if (uuid == NULL || addr == NULL) { if (uuid == NULL && addr == NULL) {
BT_WARN("No available information to query"); BT_WARN("No available information to query");
return -1; return -1;
} }
while (cnt < unprov_dev_info_fifo.pair_num) { while (cnt < pair_num) {
idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM; idx = (cnt + unprov_dev_info_fifo.start_idx) % BLE_MESH_STORE_UNPROV_INFO_MAX_NUM;
if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) { if (query_type & BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID) {
if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) { if (!memcmp(unprov_dev_info_fifo.info[idx].addr, addr, 6)) {
@@ -134,7 +135,7 @@ int bt_mesh_unprov_dev_info_query(uint8_t uuid[16], uint8_t addr[6],
cnt++; cnt++;
} }
if (cnt == unprov_dev_info_fifo.pair_num) { if (cnt == pair_num) {
return -1; return -1;
} }