diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index f30dc1f2a..a59955f2a 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1578,6 +1578,14 @@ protected: */ void InformPreviousChannel(void); + /** + * This method indicates whether or not in announce attach process. + * + * @retval true if attaching/attached on the announced parameters, false otherwise. + * + */ + bool IsAnnounceAttach(void) const { return mAlternatePanId != Mac::kPanIdBroadcast; } + #if (OPENTHREAD_CONFIG_LOG_LEVEL >= OT_LOG_LEVEL_NOTE) && (OPENTHREAD_CONFIG_LOG_MLE == 1) /** * This method converts an `AttachMode` enumeration value into a human-readable string. diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index addfbf0f7..25f14b138 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -268,6 +268,21 @@ otError MleRouter::HandleChildStart(AttachMode aMode) break; case kAttachAny: + // if attach was started due to receiving MLE Annouce Messageas, all rx-on-when-idle devices would + // start attach immediately when receiving such Announce message as in Thread 1.1 specification, + // Section 4.8.1, + // "If the received value is newer and the channel and/or PAN ID in the Announce message differ + // from those currently in use, the receiving device attempts to attach using the channel and + // PAN ID received from the Announce message." + // + // That is, Parent-child relationship is highly unlikely to be kept in the new partition, so here + // removes all children, leaving whether to become router according to the new partition status. + if (IsAnnounceAttach() && HasChildren()) + { + RemoveChildren(); + } + + // fall through case kAttachBetter: if (HasChildren() && mPreviousPartitionIdRouter != mLeaderData.GetPartitionId()) {