[srp-client] exclude sub-type PTR when service is being removed (#7883)

This commit updates the SRP client to not include sub-types PTR
records when the base service is being removed.
This commit is contained in:
Abtin Keshavarzian
2022-07-08 12:13:04 -07:00
committed by GitHub
parent 742b4e8cc3
commit 8aca0655e7
+2 -2
View File
@@ -1001,7 +1001,7 @@ Error Client::AppendServiceInstructions(Service &aService, Message &aMessage, In
UpdateRecordLengthInMessage(rr, offset, aMessage);
aInfo.mRecordCount++;
if (aService.HasSubType())
if (aService.HasSubType() && !removing)
{
const char *subTypeLabel;
uint16_t subServiceNameOffset = 0;
@@ -1023,7 +1023,7 @@ Error Client::AppendServiceInstructions(Service &aService, Message &aMessage, In
SuccessOrExit(error = Dns::Name::AppendPointerLabel(subServiceNameOffset, aMessage));
}
// `rr` is already initialized as PTR (add or remove).
// `rr` is already initialized as PTR.
offset = aMessage.GetLength();
SuccessOrExit(error = aMessage.Append(rr));