[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.
diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp
index 68c78d0..1a6584d 100644
--- a/src/core/thread/mle.cpp
+++ b/src/core/thread/mle.cpp
@@ -2220,9 +2220,10 @@
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 @@
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 @@
OT_UNREACHABLE_CODE(break);
}
+ if (!IsFullThreadDevice())
+ {
+ SuccessOrExit(error = AppendAddressRegistration(*message, mode));
+ }
+
destination.SetToLinkLocalAddress(mParent.GetExtAddress());
SuccessOrExit(error = SendMessage(*message, destination));