[srp] always send Update Lease (UL) option in success response (#13148)

Per RFC 9664, the UL option is always included in a success response (RCODE=0).
Comment in test_srp_server is updated also to avoid suggesting the opposite.
This commit is contained in:
Esko Dijk
2026-05-26 16:37:39 +02:00
committed by GitHub
parent 4de7bc578e
commit cf7e5bb2b3
2 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -727,8 +727,9 @@ void Server::CommitSrpUpdate(Error aError,
exit:
if (aMessageInfo != nullptr)
{
if (aError == kErrorNone && (grantedLease != hostLease || grantedKeyLease != hostKeyLease))
if (aError == kErrorNone)
{
// RFC 9664: server MUST echo the Update Lease option in any successful (RCODE=0) response.
SendResponse(aDnsHeader, grantedLease, grantedKeyLease, useShortLease, *aMessageInfo);
}
else
+5 -5
View File
@@ -967,11 +967,11 @@ void TestUpdateLeaseShortVariant(void)
VerifyOrQuit(service1.GetState() == Srp::Client::kRemoved);
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Register the service again, but this time change it to request
// a lease time that is larger than the `LeaseConfig.mMinLease` of
// 27 hours. This ensures that server needs to include the Lease
// Option in its response (since it need to grant a different
// lease interval).
// Register the service again, but this time request a lease time
// larger than the server's `LeaseConfig.mMaxLease` of 27 hours, so
// the server grants a different (clamped) interval. Validate that
// the client adopts the granted lease from the Update Lease
// Option in the response.
service1.mLease = 100u * 3600; // 100 hours >= 27 hours.
service1.mKeyLease = 110u * 3600;