[core] remove children when attached after receiving MLE Announce Messages (#3093)

This commit is contained in:
rongli
2018-09-24 06:57:31 -10:00
committed by Jonathan Hui
parent 06bff96310
commit 55bf9fc2fe
2 changed files with 23 additions and 0 deletions
+8
View File
@@ -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.
+15
View File
@@ -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())
{