mirror of
https://github.com/espressif/openthread.git
synced 2026-09-27 11:27:36 +00:00
[mle] delay to send announce for FTD (#2521)
This commit is contained in:
+19
-7
@@ -644,13 +644,8 @@ otError Mle::SetStateChild(uint16_t aRloc16)
|
||||
netif.GetIp6().SetForwardingEnabled(false);
|
||||
netif.GetIp6().GetMpl().SetTimerExpirations(kMplChildDataMessageTimerExpirations);
|
||||
|
||||
// Once the Thread device receives the new Active Commissioning Dataset, the device MUST
|
||||
// transmit its own Announce messages on the channel it was on prior to the attachment.
|
||||
if (mPreviousPanId != Mac::kPanIdBroadcast)
|
||||
{
|
||||
mPreviousPanId = Mac::kPanIdBroadcast;
|
||||
netif.GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
|
||||
}
|
||||
// send announce after attached if needed
|
||||
InformPreviousChannel();
|
||||
|
||||
#if OPENTHREAD_CONFIG_ENABLE_PERIODIC_PARENT_SEARCH
|
||||
UpdateParentSearchState();
|
||||
@@ -665,6 +660,23 @@ otError Mle::SetStateChild(uint16_t aRloc16)
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
void Mle::InformPreviousChannel(void)
|
||||
{
|
||||
VerifyOrExit(mPreviousPanId != Mac::kPanIdBroadcast);
|
||||
VerifyOrExit(mRole == OT_DEVICE_ROLE_CHILD || mRole == OT_DEVICE_ROLE_ROUTER);
|
||||
|
||||
if ((mDeviceMode & ModeTlv::kModeFFD) == 0 ||
|
||||
mRole == OT_DEVICE_ROLE_ROUTER ||
|
||||
GetNetif().GetMle().GetRouterSelectionJitterTimeout() == 0)
|
||||
{
|
||||
mPreviousPanId = Mac::kPanIdBroadcast;
|
||||
GetNetif().GetAnnounceBeginServer().SendAnnounce(1 << mPreviousChannel);
|
||||
}
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
otError Mle::SetTimeout(uint32_t aTimeout)
|
||||
{
|
||||
VerifyOrExit(mTimeout != aTimeout);
|
||||
|
||||
@@ -1360,6 +1360,16 @@ protected:
|
||||
*/
|
||||
void LogMleMessage(const char *aLogMessage, const Ip6::Address &aAddress, uint16_t aRloc) const;
|
||||
|
||||
/**
|
||||
* This method triggers MLE Announce on previous channel after the Thread device successfully
|
||||
* attaches and receives the new Active Commissioning Dataset if needed.
|
||||
*
|
||||
* MTD would send Announce immediately after attached.
|
||||
* FTD would delay to send Announce after tried to become Router or decided to stay in REED role.
|
||||
*
|
||||
*/
|
||||
void InformPreviousChannel(void);
|
||||
|
||||
LeaderDataTlv mLeaderData; ///< Last received Leader Data TLV.
|
||||
bool mRetrieveNewNetworkData; ///< Indicating new Network Data is needed if set.
|
||||
|
||||
|
||||
@@ -1871,6 +1871,11 @@ void MleRouter::HandleStateUpdateTimer(void)
|
||||
// upgrade to Router
|
||||
BecomeRouter(ThreadStatusTlv::kTooFewRouters);
|
||||
}
|
||||
else
|
||||
{
|
||||
// send announce after decided to stay in REED if needed
|
||||
InformPreviousChannel();
|
||||
}
|
||||
|
||||
if (!mAdvertiseTimer.IsRunning())
|
||||
{
|
||||
@@ -4360,6 +4365,10 @@ void MleRouter::HandleAddressSolicitResponse(Coap::Header *aHeader, Message *aMe
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
// send announce after received address solicit reply if needed
|
||||
InformPreviousChannel();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +301,14 @@ public:
|
||||
*/
|
||||
otError SetRouterSelectionJitter(uint8_t aRouterJitter);
|
||||
|
||||
/**
|
||||
* This method returns the current router selection jitter timeout value.
|
||||
*
|
||||
* @returns The current router selection jitter timeout value.
|
||||
*
|
||||
*/
|
||||
uint8_t GetRouterSelectionJitterTimeout(void) { return mRouterSelectionJitterTimeout; }
|
||||
|
||||
/**
|
||||
* This method returns the current Router ID Sequence value.
|
||||
*
|
||||
|
||||
@@ -59,6 +59,7 @@ public:
|
||||
|
||||
uint8_t GetActiveRouterCount(void) const { return 0; }
|
||||
uint8_t GetActiveNeighborRouterCount(void) const { return 0; }
|
||||
uint8_t GetRouterSelectionJitterTimeout(void) { return 0; }
|
||||
|
||||
uint32_t GetLeaderAge(void) const { return 0; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user