[mle] update router table after adding a new neighbor (#10288)

Use the `Route64 TLV` to update the router table after adding a new
neighbor in `HandleLinkAccept`.

With this change, when a router re-joins the network, it will restore
its nexthop table while processing the `link accept`, rather than
having to wait for an `mle advertisement`.
This commit is contained in:
gytxxsy
2024-05-23 07:41:35 -07:00
committed by GitHub
parent 1b2ad3d837
commit e7535f7183
+8 -2
View File
@@ -886,6 +886,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
RouteTlv routeTlv;
LeaderData leaderData;
uint8_t linkMargin;
bool shouldUpdateRoutes = false;
SuccessOrExit(error = Tlv::Find<SourceAddressTlv>(aRxInfo.mMessage, sourceAddress));
@@ -972,6 +973,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
mLinkRequestAttempts = 0;
mRetrieveNewNetworkData = true;
IgnoreError(SendDataRequest(aRxInfo.mMessageInfo.GetPeerAddr()));
shouldUpdateRoutes = true;
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
Get<TimeSync>().HandleTimeSyncMessage(aRxInfo.mMessage);
@@ -1007,8 +1009,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
router = mRouterTable.FindRouterById(routerId);
OT_ASSERT(router != nullptr);
}
mRouterTable.UpdateRoutes(routeTlv, routerId);
shouldUpdateRoutes = true;
break;
case kErrorNotFound:
@@ -1043,6 +1044,11 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
mNeighborTable.Signal(NeighborTable::kRouterAdded, *router);
if (shouldUpdateRoutes)
{
mRouterTable.UpdateRoutes(routeTlv, routerId);
}
aRxInfo.mClass = RxInfo::kAuthoritativeMessage;
ProcessKeySequence(aRxInfo);