From e1fa68f650079e195752152218f9dc9b606750ea Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Fri, 8 Jun 2018 10:13:36 -0700 Subject: [PATCH] [mle] implement MLE Data Request retransmissions (#2766) This commit adds MLE Data Request timeout and retransmissions for rx-off-when-idle devices. rx-on-when-idle devices do not require explicit retransmissions because MLE Advertisements will trigger an rx-on-when-idle device to send the MLE Data Request again. However, if an rx-off-when-idle device fails to receive an MLE Data Response, it will never attempt to request again. --- src/core/thread/mle.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 68bef6f3a..96b497812 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -1971,6 +1971,11 @@ exit: message->Free(); } + if (!IsRxOnWhenIdle()) + { + mChildUpdateRequestTimer.Start(kMaxChildUpdateResponseTimeout); + } + return error; } @@ -2000,7 +2005,21 @@ void Mle::HandleChildUpdateRequestTimer(Timer &aTimer) void Mle::HandleChildUpdateRequestTimer(void) { - SendChildUpdateRequest(); + if (mParent.IsStateRestoring() || IsRxOnWhenIdle()) + { + SendChildUpdateRequest(); + } + else if (mRole == OT_DEVICE_ROLE_CHILD) + { + static const uint8_t tlvs[] = {Tlv::kNetworkData}; + Ip6::Address destination; + + memset(&destination, 0, sizeof(destination)); + destination.mFields.m16[0] = HostSwap16(0xfe80); + destination.SetIid(mParent.GetExtAddress()); + + SendDataRequest(destination, tlvs, sizeof(tlvs), 0); + } } otError Mle::SendChildUpdateRequest(void) @@ -2821,6 +2840,11 @@ otError Mle::HandleLeaderData(const Message &aMessage, const Ip6::MessageInfo &a mRetrieveNewNetworkData = false; + if (!IsRxOnWhenIdle()) + { + mChildUpdateRequestTimer.Stop(); + } + exit: if (dataRequest)