Skip to content

Commit 63d1a0e

Browse files
PavelVPVrlubos
authored andcommitted
[nrf fromtree] Bluetooth: Mesh: Ignore duplicate OOB upload request
If a Fw Distribution Client sends the Upload OOB Start message, but the application layer didn't call bt_mesh_dfd_srv_oob_check_complete yet, we have no other option other than ignore the message. The next phase in this case could be Transfer Active, Transfer Success or Failed and it will be set only after Check Firmware OOB procedure completes. Signed-off-by: Pavel Vasilyev <[email protected]> (cherry picked from commit 7154f35)
1 parent 96d61af commit 63d1a0e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

include/zephyr/bluetooth/mesh/dfd_srv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ struct bt_mesh_dfd_srv {
228228
struct bt_mesh_blob_srv blob;
229229
#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
230230
bool is_oob;
231+
bool is_pending_oob_check;
231232
struct {
232233
uint8_t uri_len;
233234
uint8_t uri[CONFIG_BT_MESH_DFU_URI_MAXLEN];

subsys/bluetooth/mesh/dfd_srv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ static int handle_upload_start_oob(struct bt_mesh_model *mod, struct bt_mesh_msg
586586
#endif
587587
upload_status_rsp(srv, ctx, BT_MESH_DFD_ERR_BUSY_WITH_UPLOAD);
588588
return 0;
589+
#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
590+
} else if (srv->upload.is_oob && srv->upload.is_pending_oob_check) {
591+
/* Ignore the request if we didn't confirm the previous one. */
592+
return 0;
593+
#endif
589594
}
590595

591596
#ifdef CONFIG_BT_MESH_DFD_SRV_OOB_UPLOAD
@@ -618,6 +623,8 @@ static int handle_upload_start_oob(struct bt_mesh_model *mod, struct bt_mesh_msg
618623
if (status != BT_MESH_DFD_SUCCESS) {
619624
upload_status_rsp(srv, ctx, status);
620625
bt_mesh_dfu_slot_release(srv->upload.slot);
626+
} else {
627+
srv->upload.is_pending_oob_check = true;
621628
}
622629
#else
623630
upload_status_rsp(srv, ctx, BT_MESH_DFD_ERR_URI_NOT_SUPPORTED);
@@ -1211,13 +1218,16 @@ int bt_mesh_dfd_srv_oob_check_complete(struct bt_mesh_dfd_srv *srv,
12111218
int err;
12121219

12131220
if (slot != srv->upload.slot || !srv->upload.is_oob ||
1214-
srv->upload.phase == BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE) {
1221+
srv->upload.phase == BT_MESH_DFD_UPLOAD_PHASE_TRANSFER_ACTIVE ||
1222+
!srv->upload.is_pending_oob_check) {
12151223
/* This should not happen, unless the application calls the function with a
12161224
* "wrong" pointer or at a wrong time.
12171225
*/
12181226
return -EINVAL;
12191227
}
12201228

1229+
srv->upload.is_pending_oob_check = false;
1230+
12211231
if (status != BT_MESH_DFD_SUCCESS) {
12221232
bt_mesh_dfu_slot_release(srv->upload.slot);
12231233
upload_status_rsp(srv, &srv->upload.oob.ctx, status);

0 commit comments

Comments
 (0)