Skip to content

Commit 0985cce

Browse files
alxelaxrlubos
authored andcommitted
[nrf fromlist] tests: bluetooth: tester: fix model rx handler
Commit fixes the model rx handler. Model can receive maximum access payload. Test should be able fit maximum access payload and its own header for serial communication. Upstream PR #: 99576 Signed-off-by: Aleksandr Khromykh <[email protected]> (cherry picked from commit b3b381b6473384d61bb777f57bcbf6e2577d92a4)
1 parent df20fa5 commit 0985cce

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tests/bluetooth/tester/src/btp/btp_mesh.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ struct btp_mesh_prov_node_added_ev {
11941194
struct btp_mesh_model_recv_ev {
11951195
uint16_t src;
11961196
uint16_t dst;
1197-
uint8_t payload_len;
1197+
uint16_t payload_len;
11981198
uint8_t payload[];
11991199
} __packed;
12001200

tests/bluetooth/tester/src/btp_mesh.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5332,12 +5332,12 @@ void net_recv_ev(uint8_t ttl, uint8_t ctl, uint16_t src, uint16_t dst, const voi
53325332
void model_recv_ev(uint16_t src, uint16_t dst, const void *payload,
53335333
size_t payload_len)
53345334
{
5335-
NET_BUF_SIMPLE_DEFINE(buf, UINT8_MAX);
5335+
NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_RX_SDU_MAX + sizeof(struct btp_mesh_model_recv_ev));
53365336
struct btp_mesh_model_recv_ev *ev;
53375337

53385338
LOG_DBG("src 0x%04x dst 0x%04x payload_len %zu", src, dst, payload_len);
53395339

5340-
if (payload_len > net_buf_simple_tailroom(&buf)) {
5340+
if (payload_len + sizeof(*ev) > net_buf_simple_tailroom(&buf)) {
53415341
LOG_ERR("Payload size exceeds buffer size");
53425342
return;
53435343
}

0 commit comments

Comments
 (0)