From 44f86b81a3134ad6d9ac8d71c33c5880572cf8f8 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 8 Feb 2024 14:47:24 +0100 Subject: [PATCH] Bluetooth: Mesh: Disable randomization in DFD model for canceling update Disable randomization in the access layer when cancelling update in the distribution server model. This is needed because the server sends 2 messages in a row and the gets reordered by the access layer randomization feature making DFU/SR/FD/BV-43-C test to fail. This fixes DFU/SR/FD/BV-43-C test. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/dfd_srv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/subsys/bluetooth/mesh/dfd_srv.c b/subsys/bluetooth/mesh/dfd_srv.c index 54184acd9b8..e765f2d5d7b 100644 --- a/subsys/bluetooth/mesh/dfd_srv.c +++ b/subsys/bluetooth/mesh/dfd_srv.c @@ -1148,6 +1148,14 @@ enum bt_mesh_dfd_status bt_mesh_dfd_srv_cancel(struct bt_mesh_dfd_srv *srv, return BT_MESH_DFD_ERR_INTERNAL; } + if (prev_phase == BT_MESH_DFD_PHASE_APPLYING_UPDATE && ctx) { + /* Disable randomization for the Firmware Distribution State message to avoid + * reordering when Firmware Distribution Server sends 2 messages in a row when + * cancelling the update (see section 6.2.3.10 of MshDFUv1.0). + */ + ctx->rnd_delay = false; + } + if (ctx != NULL) { status_rsp(srv, ctx, BT_MESH_DFD_SUCCESS); }