[nexus] clear last parent ID on router/leader role change (#12986)

In `Nexus::Core::HandleStateChanged`, the `lastParentId` was not
cleared when a device transitioned to the Router or Leader role. This
could cause stale parent associations to persist, leading to incorrect
link state reporting in the visualizer during subsequent role
transitions (e.g., when a former Leader merges into a partition and
becomes a Child/REED).

This fix clears `lastParentId` (sets it to `0xffff`) when the device
becomes a Router or Leader, ensuring a fresh state for parent
tracking.
This commit is contained in:
Jonathan Hui
2026-04-27 17:21:17 -05:00
committed by GitHub
parent 0f66392f9c
commit 71d43b5cca
+5
View File
@@ -594,6 +594,11 @@ void Core::HandleStateChanged(otChangedFlags aFlags, void *aContext)
}
break;
}
case Mle::kRoleRouter:
case Mle::kRoleLeader:
node->SetLastParentId(0xffff);
break;
default:
break;
}