diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index ee927f7b2..ee1a8f025 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -115,6 +115,20 @@ void AddressResolver::Remove(uint16_t aRloc16) } } +void AddressResolver::Remove(const Ip6::Address &aEid) +{ + for (int i = 0; i < kCacheEntries; i++) + { + if (mCache[i].mState == Cache::kStateInvalid || mCache[i].mTarget != aEid) + { + continue; + } + + InvalidateCacheEntry(mCache[i], kReasonRemovingEid); + break; + } +} + AddressResolver::Cache *AddressResolver::NewCacheEntry(void) { Cache *rval = NULL; @@ -174,6 +188,10 @@ const char *AddressResolver::ConvertInvalidationReasonToString(InvalidationReaso case kReasonEvictingForNewEntry: str = "evicting for new entry"; break; + + case kReasonRemovingEid: + str = "removing eid"; + break; } return str; diff --git a/src/core/thread/address_resolver.hpp b/src/core/thread/address_resolver.hpp index b0b0e089a..6c5ae5773 100644 --- a/src/core/thread/address_resolver.hpp +++ b/src/core/thread/address_resolver.hpp @@ -102,6 +102,14 @@ public: */ void Remove(uint8_t aRouterId); + /** + * This method removes the cache entry for the EID. + * + * @param[in] aEid A reference to the EID. + * + */ + void Remove(const Ip6::Address &aEid); + /** * This method updates an existing cache entry for the EID. * @@ -197,6 +205,7 @@ private: kReasonRemovingRloc16, kReasonReceivedIcmpDstUnreachNoRoute, kReasonEvictingForNewEntry, + kReasonRemovingEid, }; static const char *ConvertInvalidationReasonToString(InvalidationReason aReason); diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index 973202833..38a8d34f4 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -2036,6 +2036,9 @@ otError MleRouter::UpdateChildAddresses(const Message &aMessage, uint16_t aOffse IgnoreReturnValue(iter.GetChild()->RemoveIp6Address(GetInstance(), address)); } + + // Clear EID-to-RLOC cache for the unicast address registered by the child. + Get().Remove(address); } if (registeredCount == 0)