[address-resolver] restart address queries when RLOC changes (#4123)

This commit is contained in:
Jonathan Hui
2019-08-26 10:21:10 -07:00
committed by GitHub
parent f71d88983e
commit 6334107e19
3 changed files with 33 additions and 3 deletions
+19
View File
@@ -247,6 +247,25 @@ exit:
return;
}
void AddressResolver::RestartAddressQueries(void)
{
for (int i = 0; i < kCacheEntries; i++)
{
Cache &entry = mCache[i];
if (entry.mState != Cache::kStateQuery)
{
continue;
}
SendAddressQuery(entry.mTarget);
entry.mTimeout = kAddressQueryTimeout;
entry.mFailures = 0;
entry.mRetryTimeout = kAddressQueryInitialRetryDelay;
}
}
otError AddressResolver::Resolve(const Ip6::Address &aEid, uint16_t &aRloc16)
{
otError error = OT_ERROR_NONE;
+8
View File
@@ -125,6 +125,14 @@ public:
*/
otError Resolve(const Ip6::Address &aEid, Mac::ShortAddress &aRloc16);
/**
* This method restarts any ongoing address queries.
*
* Any existing address queries will be restarted as if they are being sent for the first time.
*
*/
void RestartAddressQueries(void);
private:
enum
{
+6 -3
View File
@@ -968,15 +968,18 @@ void Mle::SetRloc16(uint16_t aRloc16)
{
Get<ThreadNetif>().RemoveUnicastAddress(mMeshLocal16);
Get<Mac::Mac>().SetShortAddress(aRloc16);
Get<Ip6::Mpl>().SetSeedId(aRloc16);
if (aRloc16 != Mac::kShortAddrInvalid)
{
// mesh-local 16
mMeshLocal16.GetAddress().mFields.m16[7] = HostSwap16(aRloc16);
Get<ThreadNetif>().AddUnicastAddress(mMeshLocal16);
#ifdef OPENTHREAD_FTD
Get<AddressResolver>().RestartAddressQueries();
#endif
}
Get<Mac::Mac>().SetShortAddress(aRloc16);
Get<Ip6::Mpl>().SetSeedId(aRloc16);
}
void Mle::SetLeaderData(uint32_t aPartitionId, uint8_t aWeighting, uint8_t aLeaderRouterId)