From 464ddcb9e64e57a2b863b0d0d7cbb53dc5a091c8 Mon Sep 17 00:00:00 2001 From: Jesse Thompson Date: Thu, 5 Mar 2026 11:40:23 -0500 Subject: [PATCH] [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. --- src/core/thread/mle_ftd.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/thread/mle_ftd.cpp b/src/core/thread/mle_ftd.cpp index d4f028e5c..4f49bdbe8 100644 --- a/src/core/thread/mle_ftd.cpp +++ b/src/core/thread/mle_ftd.cpp @@ -422,6 +422,9 @@ void Mle::SetStateRouterOrLeader(DeviceRole aRole, uint16_t aRloc16, LeaderStart Get().SetBeaconEnabled(true); Get().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().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: