[address-resolver] fix bug in updating address cache by snooping (#2598)

This commit is contained in:
Jonathan Hui
2018-03-01 18:41:32 +00:00
committed by GitHub
parent 15f4e0129e
commit ca791f1ae8
2 changed files with 16 additions and 5 deletions
+14 -3
View File
@@ -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);
+2 -2
View File
@@ -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);