mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 19:27:46 +00:00
[mle] echo back "Supervision TLV" in Child ID Response (#9061)
This commit updates the `MleRouter` to echo back the "Supervision TLV" in MLE Child ID Response message when it is included in MLE Child ID Request by a child.
This commit is contained in:
@@ -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<TimeoutTlv>(aRxInfo.mMessage, timeout));
|
||||
|
||||
// Supervision interval
|
||||
needsSupervisionTlv = false;
|
||||
switch (Tlv::Find<SupervisionIntervalTlv>(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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user