[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:
Jonathan Hui
2022-07-28 07:27:57 -07:00
committed by GitHub
parent b6ac79f61a
commit 0b1e922a1d
+14 -2
View File
@@ -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();