mirror of
https://github.com/espressif/openthread.git
synced 2026-09-08 10:10:06 +00:00
[mle] invalidate EID-to-RLOC cache entries while removing a neighbor
Signed-off-by: Duda, Lukasz <[email protected]>
This commit is contained in:
committed by
Jonathan Hui
parent
c26f5e3bbe
commit
41e4b3202b
@@ -97,17 +97,28 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void AddressResolver::Remove(uint8_t routerId)
|
||||
void AddressResolver::Remove(uint8_t aRouterId)
|
||||
{
|
||||
for (int i = 0; i < kCacheEntries; i++)
|
||||
{
|
||||
if (Mle::Mle::GetRouterId(mCache[i].mRloc16) == routerId)
|
||||
if (Mle::Mle::GetRouterId(mCache[i].mRloc16) == aRouterId)
|
||||
{
|
||||
InvalidateCacheEntry(mCache[i], kReasonRemovingRouterId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddressResolver::Remove(uint16_t aRloc16)
|
||||
{
|
||||
for (int i = 0; i < kCacheEntries; i++)
|
||||
{
|
||||
if (mCache[i].mRloc16 == aRloc16)
|
||||
{
|
||||
InvalidateCacheEntry(mCache[i], kReasonRemovingRloc16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AddressResolver::Cache *AddressResolver::NewCacheEntry(void)
|
||||
{
|
||||
Cache *rval = NULL;
|
||||
@@ -156,6 +167,10 @@ const char *AddressResolver::ConvertInvalidationReasonToString(InvalidationReaso
|
||||
str = "removing router id";
|
||||
break;
|
||||
|
||||
case kReasonRemovingRloc16:
|
||||
str = "removing rloc16";
|
||||
break;
|
||||
|
||||
case kReasonReceivedIcmpDstUnreachNoRoute:
|
||||
str = "received icmp no route";
|
||||
break;
|
||||
|
||||
@@ -94,7 +94,15 @@ public:
|
||||
otError GetEntry(uint8_t aIndex, otEidCacheEntry &aEntry) const;
|
||||
|
||||
/**
|
||||
* This method removes a Router ID from the EID-to-RLOC cache.
|
||||
* This method removes the EID-to-RLOC cache entries corresponding to an RLOC16.
|
||||
*
|
||||
* @param[in] aRloc16 The RLOC16 address.
|
||||
*
|
||||
*/
|
||||
void Remove(uint16_t aRloc16);
|
||||
|
||||
/**
|
||||
* This method removes all EID-to-RLOC cache entries assossiated with a Router ID.
|
||||
*
|
||||
* @param[in] aRouterId The Router ID.
|
||||
*
|
||||
@@ -169,6 +177,7 @@ private:
|
||||
enum InvalidationReason
|
||||
{
|
||||
kReasonRemovingRouterId,
|
||||
kReasonRemovingRloc16,
|
||||
kReasonReceivedIcmpDstUnreachNoRoute,
|
||||
kReasonEvictingForNewEntry,
|
||||
};
|
||||
|
||||
@@ -3244,6 +3244,13 @@ otError MleRouter::RemoveNeighbor(Neighbor &aNeighbor)
|
||||
aNeighbor.SetState(Neighbor::kStateInvalid);
|
||||
netif.GetMeshForwarder().UpdateIndirectMessages();
|
||||
netif.GetNetworkDataLeader().SendServerDataNotification(aNeighbor.GetRloc16());
|
||||
|
||||
if (aNeighbor.GetDeviceMode() & ModeTlv::kModeFFD)
|
||||
{
|
||||
// Clear all EID-to-RLOC entries assossiated with the child.
|
||||
netif.GetAddressResolver().Remove(aNeighbor.GetRloc16());
|
||||
}
|
||||
|
||||
RemoveStoredChild(aNeighbor.GetRloc16());
|
||||
}
|
||||
else if ((aNeighbor.GetState() == Neighbor::kStateValid) && IsActiveRouter(aNeighbor.GetRloc16()))
|
||||
@@ -3270,6 +3277,9 @@ otError MleRouter::RemoveNeighbor(Neighbor &aNeighbor)
|
||||
if (routerToRemove.GetNextHop() == kInvalidRouterId)
|
||||
{
|
||||
ResetAdvertiseInterval();
|
||||
|
||||
// Clear all EID-to-RLOC entries assossiated with the router.
|
||||
netif.GetAddressResolver().Remove(GetRouterId(aNeighbor.GetRloc16()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user