[srp-server] allow disabling "Fast Start Mode" via auto-enable (#11319)

This commit updates the `Srp::Server` so that Fast Start Mode can be
disabled by a call to `otSrpServerSetAutoEnableMode()`, in addition
to the existing method of calling `otSrpServerSetEnabled()`.

The `test_srp_server` unit test is updated to validate this new
behavior.
This commit is contained in:
Abtin Keshavarzian
2025-03-04 15:18:37 -08:00
committed by GitHub
parent eb15a56a91
commit b1ca77aae9
5 changed files with 57 additions and 9 deletions
+16
View File
@@ -1367,6 +1367,22 @@ void TestSrpServerFastStartMode(void)
VerifyOrQuit(srpServer->IsFastStartModeEnabled());
VerifyOrQuit(srpServer->GetState() == Srp::Server::kStateRunning);
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Start auto-enable mode and ensure "fast start mode" is turned
// off and the original AddressMode is restored on the SRP server.
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
srpServer->SetAutoEnableMode(true);
VerifyOrQuit(!srpServer->IsFastStartModeEnabled());
VerifyOrQuit(srpServer->IsAutoEnableMode());
VerifyOrQuit(srpServer->GetState() == Srp::Server::kStateDisabled);
VerifyOrQuit(srpServer->GetAddressMode() == Srp::Server::kAddressModeUnicast);
VerifyOrQuit(srpServer->EnableFastStartMode() == kErrorInvalidState);
#endif
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Finalize OT instance and validate all heap allocations are freed.