From fe13209eb1a8ba3b7a982c6d7c1a621718e9f90d Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Mon, 22 Apr 2024 14:40:00 +0200 Subject: [PATCH] Bluetooth: Mesh: fix start rx transaction before tx is ended Commit fixes behavior when provisioning protocol accepts incoming transaction before ongoing tx transaction is still active (device didn't receive acknowledgement yet). Incoming data are ignored until ack is not received. Specification: 5.3.3 Generic Provisioning behavior ... If the sender receives a Transaction Acknowledgement message, then the transaction has completed. If the sender receives a message with other PDU types, then the message shall be ignored. ... Signed-off-by: Aleksandr Khromykh --- subsys/bluetooth/mesh/pb_adv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/subsys/bluetooth/mesh/pb_adv.c b/subsys/bluetooth/mesh/pb_adv.c index c5c56b1e5b0..e5946e739d6 100644 --- a/subsys/bluetooth/mesh/pb_adv.c +++ b/subsys/bluetooth/mesh/pb_adv.c @@ -482,6 +482,11 @@ static void gen_prov_cont(struct prov_rx *rx, struct net_buf_simple *buf) { uint8_t seg = CONT_SEG_INDEX(rx->gpc); + if (link.tx.adv[0]) { + LOG_DBG("Ongoing tx transaction has not been completed yet"); + return; + } + LOG_DBG("len %u, seg_index %u", buf->len, seg); if (!link.rx.seg && link.rx.id == rx->xact_id) { @@ -570,6 +575,11 @@ static void gen_prov_start(struct prov_rx *rx, struct net_buf_simple *buf) { uint8_t seg = SEG_NVAL; + if (link.tx.adv[0]) { + LOG_DBG("Ongoing tx transaction has not been completed yet"); + return; + } + if (rx->xact_id == link.rx.id) { if (!link.rx.seg) { if (!ack_pending()) {