diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index bade0cb64..417c1c57b 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -2003,6 +2003,7 @@ void MleRouter::HandleChildIdRequest(RxInfo &aRxInfo) MeshCoP::Timestamp timestamp; bool needsActiveDatasetTlv; bool needsPendingDatasetTlv; + bool needsSupervisionTlv; Child *child; Router *router; uint8_t numTlvs; @@ -2046,9 +2047,11 @@ void MleRouter::HandleChildIdRequest(RxInfo &aRxInfo) SuccessOrExit(error = Tlv::Find(aRxInfo.mMessage, timeout)); // Supervision interval + needsSupervisionTlv = false; switch (Tlv::Find(aRxInfo.mMessage, supervisionInterval)) { case kErrorNone: + needsSupervisionTlv = true; break; case kErrorNotFound: supervisionInterval = (version <= kThreadVersion1p3) ? kChildSupervisionDefaultIntervalForOlderVersion : 0; @@ -2100,6 +2103,11 @@ void MleRouter::HandleChildIdRequest(RxInfo &aRxInfo) numTlvs++; } + if (needsSupervisionTlv) + { + numTlvs++; + } + VerifyOrExit(numTlvs <= Child::kMaxRequestTlvs, error = kErrorParse); if (!mode.IsFullThreadDevice()) @@ -2157,6 +2165,11 @@ void MleRouter::HandleChildIdRequest(RxInfo &aRxInfo) child->SetRequestTlv(numTlvs++, Tlv::kPendingDataset); } + if (needsSupervisionTlv) + { + child->SetRequestTlv(numTlvs++, Tlv::kSupervisionInterval); + } + aRxInfo.mClass = RxInfo::kAuthoritativeMessage; switch (mRole) @@ -2924,6 +2937,10 @@ Error MleRouter::SendChildIdResponse(Child &aChild) SuccessOrExit(error = message->AppendPendingDatasetTlv()); break; + case Tlv::kSupervisionInterval: + SuccessOrExit(error = message->AppendSupervisionIntervalTlv(aChild.GetSupervisionInterval())); + break; + default: break; } diff --git a/src/core/thread/topology.hpp b/src/core/thread/topology.hpp index 62824f249..2f89fae4c 100644 --- a/src/core/thread/topology.hpp +++ b/src/core/thread/topology.hpp @@ -873,7 +873,7 @@ class Child : public Neighbor, class AddressIteratorBuilder; public: - static constexpr uint8_t kMaxRequestTlvs = 5; + static constexpr uint8_t kMaxRequestTlvs = 6; /** * This class represents diagnostic information for a Thread Child.