diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index 85ec64880..a9c0356ce 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1364,11 +1364,22 @@ void MeshForwarder::HandleLowpanHC(uint8_t * aFrame, const Mac::Address & aMacDest, const otThreadLinkInfo &aLinkInfo) { - ThreadNetif &netif = GetNetif(); - otError error = OT_ERROR_NONE; - Message * message; + ThreadNetif &netif = GetNetif(); + otError error = OT_ERROR_NONE; + Message * message = NULL; int headerLength; +#if OPENTHREAD_FTD + if (!aMacDest.IsBroadcast() && aMacSource.IsShort()) + { + Ip6::Header ip6header; + + VerifyOrExit(netif.GetLowpan().DecompressBaseHeader(ip6header, aMacSource, aMacDest, aFrame, aFrameLength) > 0, + error = OT_ERROR_PARSE); + netif.GetAddressResolver().UpdateCacheEntry(ip6header.GetSource(), aMacSource.GetShort()); + } +#endif + VerifyOrExit((message = GetInstance().GetMessagePool().New(Message::kTypeIp6, 0)) != NULL, error = OT_ERROR_NO_BUFS); message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity); diff --git a/src/core/thread/mesh_forwarder_ftd.cpp b/src/core/thread/mesh_forwarder_ftd.cpp index 725fd5c06..a5829238f 100644 --- a/src/core/thread/mesh_forwarder_ftd.cpp +++ b/src/core/thread/mesh_forwarder_ftd.cpp @@ -979,11 +979,11 @@ void MeshForwarder::UpdateRoutes(uint8_t * aFrame, VerifyOrExit(netif.GetLowpan().DecompressBaseHeader(ip6Header, aMeshSource, aMeshDest, aFrame, aFrameLength) > 0); + netif.GetAddressResolver().UpdateCacheEntry(ip6Header.GetSource(), meshHeader.GetSource()); + neighbor = netif.GetMle().GetNeighbor(ip6Header.GetSource()); VerifyOrExit(neighbor != NULL && !neighbor->IsFullThreadDevice()); - netif.GetAddressResolver().UpdateCacheEntry(ip6Header.GetSource(), meshHeader.GetSource()); - if (Mle::Mle::GetRouterId(meshHeader.GetSource()) != Mle::Mle::GetRouterId(GetNetif().GetMac().GetShortAddress())) { netif.GetMle().RemoveNeighbor(*neighbor);