mirror of
https://github.com/espressif/openthread.git
synced 2026-09-21 16:37:37 +00:00
[address-resolver] fix bug in updating address cache by snooping (#2598)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user