[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:
Abtin Keshavarzian
2023-05-16 18:39:18 -07:00
committed by GitHub
parent 7c5dca178f
commit 9ed8a071c1
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -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;
}
+1 -1
View File
@@ -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.