I'm developing a system using BLE Mesh with the intent of having a "collector" node attached to each network that manages provisioning and received published data from connected devices that is aggregated and forward to the cloud.
With this architecture, it is important the the "collector" remains online and available, so I'm using an acknowledged heartbeat message from the end device to allow it to determine if the collector is still there. If the collector fails to respond, the end device re-enters provisioning with the hope that it can be picked up by a neighboring network (networks are close enough that they overlap).
So far, everything works great, but when it "collector" comes back online I'd like to be able to tell the temporarily relocated end devices to return home. The collector is based on the serial example and is able to construct a data block containing the current network state (unicast addr, netkey, appkey, devkey, seqnum, iv_index, and iv_update), and I'm able to deliver this message to the relocated end device using the secondary network.
Issuing a "dsm_clear()" and setting all the dsm attributes seems to get me back to the home network, but while the sequence number appears to apply correctly while processing the message, it resets to 0 on "mesh_stack_device_reset()".
Simplified code (just the seqnum handling, and verified the problem exists in this example):
void set_seqnum() {
uint32_t seqnum = 154
uint32_t iv_index = 0
uint32_t iv_update = 0
ERROR_CHECK(net_state_iv_index_and_seqnum_block_set(iv_index, iv_update, seqnum));
/* Reset to Apply */
mesh_stack_device_reset();
}
Setting a breakpoint on the mesh_stack_device_reset() line, I can inspect m_net_state and m_status from the net_state.c file and am happy to find:

However, if I move the breakpoint to main.c immediately before entering the sd_app_evt_wait() loop, I find:

Sending a broadcast message asking all devices to clear their stored seqnum for the moving end device is an option, but if there is a way to set the seqnum so the device can come back fully synchronized that would be even more ideal and be making less of a security hole. In addition to 154, I also tried 8192 (block size) and 8193 (block size + 1) and had the same results (working on set, then resetting to 0 on reboot).
Thanks,
Jeremy