[mle] kAppendMeshLocalOnly for Child Update Request when detached (#5295)

When the child reboot, only register the mesh local address to avoid
possible large Child Update Response which would be fragmented, thus
avoiding reattach process.
This commit is contained in:
Rongli Sun
2020-07-26 22:16:13 -07:00
committed by GitHub
parent c5e7252fed
commit 2117dae5f8
+10 -8
View File
@@ -2220,9 +2220,10 @@ exit:
otError Mle::SendChildUpdateRequest(void)
{
otError error = OT_ERROR_NONE;
Ip6::Address destination;
Message * message = nullptr;
otError error = OT_ERROR_NONE;
Ip6::Address destination;
Message * message = nullptr;
AddressRegistrationMode mode = kAppendAllAddresses;
if (!mParent.IsStateValidOrRestoring())
{
@@ -2239,16 +2240,12 @@ otError Mle::SendChildUpdateRequest(void)
SuccessOrExit(error = AppendHeader(*message, Header::kCommandChildUpdateRequest));
SuccessOrExit(error = AppendMode(*message, mDeviceMode));
if (!IsFullThreadDevice())
{
SuccessOrExit(error = AppendAddressRegistration(*message));
}
switch (mRole)
{
case kRoleDetached:
mParentRequestChallenge.GenerateRandom();
SuccessOrExit(error = AppendChallenge(*message, mParentRequestChallenge));
mode = kAppendMeshLocalOnly;
break;
case kRoleChild:
@@ -2264,6 +2261,11 @@ otError Mle::SendChildUpdateRequest(void)
OT_UNREACHABLE_CODE(break);
}
if (!IsFullThreadDevice())
{
SuccessOrExit(error = AppendAddressRegistration(*message, mode));
}
destination.SetToLinkLocalAddress(mParent.GetExtAddress());
SuccessOrExit(error = SendMessage(*message, destination));