mirror of
https://github.com/espressif/openthread.git
synced 2026-10-16 20:57:41 +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 Mac::Address & aMacDest,
|
||||||
const otThreadLinkInfo &aLinkInfo)
|
const otThreadLinkInfo &aLinkInfo)
|
||||||
{
|
{
|
||||||
ThreadNetif &netif = GetNetif();
|
ThreadNetif &netif = GetNetif();
|
||||||
otError error = OT_ERROR_NONE;
|
otError error = OT_ERROR_NONE;
|
||||||
Message * message;
|
Message * message = NULL;
|
||||||
int headerLength;
|
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,
|
VerifyOrExit((message = GetInstance().GetMessagePool().New(Message::kTypeIp6, 0)) != NULL,
|
||||||
error = OT_ERROR_NO_BUFS);
|
error = OT_ERROR_NO_BUFS);
|
||||||
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
|
message->SetLinkSecurityEnabled(aLinkInfo.mLinkSecurity);
|
||||||
|
|||||||
@@ -979,11 +979,11 @@ void MeshForwarder::UpdateRoutes(uint8_t * aFrame,
|
|||||||
|
|
||||||
VerifyOrExit(netif.GetLowpan().DecompressBaseHeader(ip6Header, aMeshSource, aMeshDest, aFrame, aFrameLength) > 0);
|
VerifyOrExit(netif.GetLowpan().DecompressBaseHeader(ip6Header, aMeshSource, aMeshDest, aFrame, aFrameLength) > 0);
|
||||||
|
|
||||||
|
netif.GetAddressResolver().UpdateCacheEntry(ip6Header.GetSource(), meshHeader.GetSource());
|
||||||
|
|
||||||
neighbor = netif.GetMle().GetNeighbor(ip6Header.GetSource());
|
neighbor = netif.GetMle().GetNeighbor(ip6Header.GetSource());
|
||||||
VerifyOrExit(neighbor != NULL && !neighbor->IsFullThreadDevice());
|
VerifyOrExit(neighbor != NULL && !neighbor->IsFullThreadDevice());
|
||||||
|
|
||||||
netif.GetAddressResolver().UpdateCacheEntry(ip6Header.GetSource(), meshHeader.GetSource());
|
|
||||||
|
|
||||||
if (Mle::Mle::GetRouterId(meshHeader.GetSource()) != Mle::Mle::GetRouterId(GetNetif().GetMac().GetShortAddress()))
|
if (Mle::Mle::GetRouterId(meshHeader.GetSource()) != Mle::Mle::GetRouterId(GetNetif().GetMac().GetShortAddress()))
|
||||||
{
|
{
|
||||||
netif.GetMle().RemoveNeighbor(*neighbor);
|
netif.GetMle().RemoveNeighbor(*neighbor);
|
||||||
|
|||||||
Reference in New Issue
Block a user