diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 60e7ce684..e8948e583 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1472,7 +1472,7 @@ void MeshForwarder::HandleFragment(RxInfo &aRxInfo) uint16_t datagramSize = fragmentHeader.GetDatagramSize(); #if OPENTHREAD_FTD - UpdateRoutes(aRxInfo); + UpdateEidRlocCacheAndStaleChild(aRxInfo); #endif SuccessOrExit(error = FrameToMessage(aRxInfo, datagramSize, message)); @@ -1635,7 +1635,7 @@ void MeshForwarder::HandleLowpanHc(RxInfo &aRxInfo) Message *message = nullptr; #if OPENTHREAD_FTD - UpdateRoutes(aRxInfo); + UpdateEidRlocCacheAndStaleChild(aRxInfo); #endif SuccessOrExit(error = FrameToMessage(aRxInfo, 0, message)); diff --git a/src/core/thread/mesh_forwarder.hpp b/src/core/thread/mesh_forwarder.hpp index 22dd6be10..1dad2b564 100644 --- a/src/core/thread/mesh_forwarder.hpp +++ b/src/core/thread/mesh_forwarder.hpp @@ -489,7 +489,7 @@ private: void SendIcmpErrorIfDstUnreach(const Message &aMessage, const Mac::Addresses &aMacAddrs); Error CheckReachability(RxInfo &aRxInfo); Error CheckReachability(uint16_t aMeshDest, const Ip6::Header &aIp6Header); - void UpdateRoutes(RxInfo &aRxInfo); + void UpdateEidRlocCacheAndStaleChild(RxInfo &aRxInfo); Error FrameToMessage(RxInfo &aRxInfo, uint16_t aDatagramSize, Message *&aMessage); void GetMacSourceAddress(const Ip6::Address &aIp6Addr, Mac::Address &aMacAddr); Message *PrepareNextDirectTransmission(void); diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 841614a27..a022c1849 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -586,7 +586,7 @@ void MeshForwarder::HandleMesh(RxInfo &aRxInfo) aRxInfo.mMacAddrs.mSource.SetShort(meshHeader.GetSource()); aRxInfo.mMacAddrs.mDestination.SetShort(meshHeader.GetDestination()); - UpdateRoutes(aRxInfo); + UpdateEidRlocCacheAndStaleChild(aRxInfo); if (Get().HasRloc16(aRxInfo.GetDstAddr().GetShort()) || Get().HasMinimalChild(aRxInfo.GetDstAddr().GetShort())) @@ -669,7 +669,7 @@ exit: return; } -void MeshForwarder::UpdateRoutes(RxInfo &aRxInfo) +void MeshForwarder::UpdateEidRlocCacheAndStaleChild(RxInfo &aRxInfo) { Neighbor *neighbor; @@ -688,6 +688,9 @@ void MeshForwarder::UpdateRoutes(RxInfo &aRxInfo) aRxInfo.mIp6Headers.GetSourceAddress(), aRxInfo.GetSrcAddr().GetShort(), aRxInfo.GetDstAddr().GetShort()); } + // Detect if a former child has moved to a new parent by + // inspecting the received message. + neighbor = Get().FindNeighbor(aRxInfo.mIp6Headers.GetSourceAddress()); VerifyOrExit(neighbor != nullptr && !neighbor->IsFullThreadDevice());