mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 23:57:47 +00:00
[mle] send Link Request immediately if router id was previously allocated (#7947)
After upgrading to a router, the device will wait until it receives a Route TLV from a neighboring node indicating that the new Router ID has been allocated. In normal cases, this is not an issue since the Leader will disseminate a new Router ID Sequence after allocating a new Router ID. However, in some scenarios, a device may request the same Router ID that was previously allocated and significantly delay establishing links with neighboring routers. With this commit, a device will immediately send a Link Request if the Router ID was previously allocated.
This commit is contained in:
@@ -3800,6 +3800,7 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage,
|
||||
uint8_t routerId;
|
||||
Router * router;
|
||||
Router * leader;
|
||||
bool isRouterIdAllocated;
|
||||
|
||||
mAddressSolicitPending = false;
|
||||
|
||||
@@ -3831,6 +3832,8 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage,
|
||||
SuccessOrExit(Tlv::Find<ThreadRloc16Tlv>(*aMessage, rloc16));
|
||||
routerId = RouterIdFromRloc16(rloc16);
|
||||
|
||||
isRouterIdAllocated = mRouterTable.IsAllocated(routerId);
|
||||
|
||||
SuccessOrExit(Tlv::FindTlv(*aMessage, routerMaskTlv));
|
||||
VerifyOrExit(routerMaskTlv.IsValid());
|
||||
|
||||
@@ -3866,13 +3869,22 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Message * aMessage,
|
||||
leader->SetNextHop(RouterIdFromRloc16(mParent.GetRloc16()));
|
||||
}
|
||||
|
||||
if (isRouterIdAllocated)
|
||||
{
|
||||
// send Link Request immediately if Router ID was previously allocated
|
||||
IgnoreError(SendLinkRequest(nullptr));
|
||||
}
|
||||
else
|
||||
{
|
||||
// wait to send Link Request until new Router ID has been disseminated from the Leader
|
||||
mLinkRequestDelay = kMulticastLinkRequestDelay;
|
||||
}
|
||||
|
||||
for (Child &child : Get<ChildTable>().Iterate(Child::kInStateChildIdRequest))
|
||||
{
|
||||
IgnoreError(SendChildIdResponse(child));
|
||||
}
|
||||
|
||||
mLinkRequestDelay = kMulticastLinkRequestDelay;
|
||||
|
||||
exit:
|
||||
// Send announce after received address solicit reply if needed
|
||||
InformPreviousChannel();
|
||||
|
||||
Reference in New Issue
Block a user