mirror of
https://github.com/espressif/openthread.git
synced 2026-06-16 10:24:59 +00:00
[mle] invalidate parent if not child (#4572)
Current Thread certification needs Parent information even after the node already become a router or leader. This commit sets parent state to invalid to indicate information in mParent should not be used in normal cases.
This commit is contained in:
@@ -339,6 +339,12 @@ void Mle::SetRole(otDeviceRole aRole)
|
||||
break;
|
||||
}
|
||||
|
||||
// If the previous state is disabled, the parent can be in kStateRestored.
|
||||
if (mRole != OT_DEVICE_ROLE_CHILD && oldRole != OT_DEVICE_ROLE_DISABLED)
|
||||
{
|
||||
mParent.SetState(Neighbor::kStateInvalid);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE
|
||||
if (IsAttached())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user