mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[address-resolver] restart address queries when RLOC changes (#4123)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user