[mle] child ID request timeout and state cleanups (#12584)

This commit addresses issues where child entries could remain in the
kStateChildIdRequest indefinitely in the sequence of events during
attachment.  Previously there was a timeout defined and saved for the
kStateChildIdRequest state, but will no longer be excluded from timing
out. This change additionally clears previous parents upon becoming a
router, as it could previously cause unnecessary messages to inform
previous parents.  Finally, this moves the transition to the valid
state to occur after success in queuing the Child ID Response.
This commit is contained in:
Jesse Thompson
2026-03-05 10:40:23 -06:00
committed by GitHub
parent 75c554e9b1
commit 464ddcb9e6
+6 -3
View File
@@ -422,6 +422,9 @@ void Mle::SetStateRouterOrLeader(DeviceRole aRole, uint16_t aRloc16, LeaderStart
Get<Mac::Mac>().SetBeaconEnabled(true);
Get<TimeTicker>().RegisterReceiver(TimeTicker::kMle);
// Avoid informing an old parent when attaching next as a child after becoming an active router
mPreviousParentRloc = kInvalidRloc16;
if (aRole == kRoleLeader)
{
GetLeaderAloc(mLeaderAloc.GetAddress());
@@ -1616,10 +1619,10 @@ void Mle::HandleTimeTick(void)
switch (child.GetState())
{
case Neighbor::kStateInvalid:
case Neighbor::kStateChildIdRequest:
continue;
case Neighbor::kStateParentRequest:
case Neighbor::kStateChildIdRequest:
case Neighbor::kStateValid:
case Neighbor::kStateRestored:
case Neighbor::kStateChildUpdateRequest:
@@ -2904,8 +2907,6 @@ Error Mle::SendChildIdResponse(Child &aChild)
SuccessOrExit(error = message->AppendAddressRegistrationTlv(aChild));
}
SetChildStateToValid(aChild);
if (!aChild.IsRxOnWhenIdle())
{
Get<IndirectSender>().SetChildUseShortAddress(aChild, false);
@@ -2921,6 +2922,8 @@ Error Mle::SendChildIdResponse(Child &aChild)
destination.SetToLinkLocalAddress(aChild.GetExtAddress());
SuccessOrExit(error = message->SendTo(destination));
SetChildStateToValid(aChild);
Log(kMessageSend, kTypeChildIdResponse, destination, aChild.GetRloc16());
exit: