mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 18:07:47 +00:00
[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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user