[mle] centralize ChildUpdate reject response logic (#12066)

Introduces a new private method `Mle::SendChildUpdateRejectResponse()`
to consolidate the logic for sending a reject response to a
"Child Update Request".

This new method creates a response containing the Source Address TLV,
Status TLV, and (if applicable) Response TLV.

The new method is now used in `Mle::HandleChildUpdateRequestOnChild()`
when the device is not a parent of the sender, and in
`Mle::HandleChildUpdateRequestOnParent()` when a request from an
unknown child is received. This change removes duplicated code from
both locations.
This commit is contained in:
Abtin Keshavarzian
2025-10-27 10:57:47 -07:00
committed by GitHub
parent fc71e69f92
commit ae54e4a133
3 changed files with 24 additions and 18 deletions
+1 -2
View File
@@ -2255,8 +2255,7 @@ void Mle::HandleChildUpdateRequestOnParent(RxInfo &aRxInfo)
// Status TLV (error).
if (mode.IsRxOnWhenIdle())
{
tlvList.Add(Tlv::kStatus);
SendChildUpdateResponseToChild(nullptr, aRxInfo.mMessageInfo, tlvList, challenge);
IgnoreError(SendChildUpdateRejectResponse(challenge, aRxInfo.mMessageInfo.GetPeerAddr()));
}
ExitNow();