diff --git a/subsys/bluetooth/mesh/net.c b/subsys/bluetooth/mesh/net.c index c5033f9ac72..2c7e9321122 100644 --- a/subsys/bluetooth/mesh/net.c +++ b/subsys/bluetooth/mesh/net.c @@ -722,6 +722,14 @@ u32_t bt_mesh_next_seq(void) bt_mesh_store_seq(); } + if (!atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_IN_PROGRESS) && + bt_mesh.seq > IV_UPDATE_SEQ_LIMIT && + bt_mesh_subnet_get(BT_MESH_KEY_PRIMARY)) { + bt_mesh_beacon_ivu_initiator(true); + bt_mesh_net_iv_update(bt_mesh.iv_index + 1, true); + bt_mesh_net_sec_update(NULL); + } + return seq; } @@ -780,13 +788,6 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf, bt_mesh_adv_send(buf, cb, cb_data); } - if (!atomic_test_bit(bt_mesh.flags, BT_MESH_IVU_IN_PROGRESS) && - bt_mesh.seq > IV_UPDATE_SEQ_LIMIT) { - bt_mesh_beacon_ivu_initiator(true); - bt_mesh_net_iv_update(bt_mesh.iv_index + 1, true); - bt_mesh_net_sec_update(NULL); - } - return 0; }