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