mirror of
https://github.com/espressif/openthread.git
synced 2026-10-09 01:07:39 +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;
|
RouteTlv routeTlv;
|
||||||
LeaderData leaderData;
|
LeaderData leaderData;
|
||||||
uint8_t linkMargin;
|
uint8_t linkMargin;
|
||||||
|
bool shouldUpdateRoutes = false;
|
||||||
|
|
||||||
SuccessOrExit(error = Tlv::Find<SourceAddressTlv>(aRxInfo.mMessage, sourceAddress));
|
SuccessOrExit(error = Tlv::Find<SourceAddressTlv>(aRxInfo.mMessage, sourceAddress));
|
||||||
|
|
||||||
@@ -972,6 +973,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
|
|||||||
mLinkRequestAttempts = 0;
|
mLinkRequestAttempts = 0;
|
||||||
mRetrieveNewNetworkData = true;
|
mRetrieveNewNetworkData = true;
|
||||||
IgnoreError(SendDataRequest(aRxInfo.mMessageInfo.GetPeerAddr()));
|
IgnoreError(SendDataRequest(aRxInfo.mMessageInfo.GetPeerAddr()));
|
||||||
|
shouldUpdateRoutes = true;
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
#if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE
|
||||||
Get<TimeSync>().HandleTimeSyncMessage(aRxInfo.mMessage);
|
Get<TimeSync>().HandleTimeSyncMessage(aRxInfo.mMessage);
|
||||||
@@ -1007,8 +1009,7 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
|
|||||||
router = mRouterTable.FindRouterById(routerId);
|
router = mRouterTable.FindRouterById(routerId);
|
||||||
OT_ASSERT(router != nullptr);
|
OT_ASSERT(router != nullptr);
|
||||||
}
|
}
|
||||||
|
shouldUpdateRoutes = true;
|
||||||
mRouterTable.UpdateRoutes(routeTlv, routerId);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kErrorNotFound:
|
case kErrorNotFound:
|
||||||
@@ -1043,6 +1044,11 @@ Error MleRouter::HandleLinkAccept(RxInfo &aRxInfo, bool aRequest)
|
|||||||
|
|
||||||
mNeighborTable.Signal(NeighborTable::kRouterAdded, *router);
|
mNeighborTable.Signal(NeighborTable::kRouterAdded, *router);
|
||||||
|
|
||||||
|
if (shouldUpdateRoutes)
|
||||||
|
{
|
||||||
|
mRouterTable.UpdateRoutes(routeTlv, routerId);
|
||||||
|
}
|
||||||
|
|
||||||
aRxInfo.mClass = RxInfo::kAuthoritativeMessage;
|
aRxInfo.mClass = RxInfo::kAuthoritativeMessage;
|
||||||
ProcessKeySequence(aRxInfo);
|
ProcessKeySequence(aRxInfo);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user