Skip to content

Commit

Permalink
Update DNS-SD advertisements on fail-safe timeout (#23199)
Browse files Browse the repository at this point in the history
When we remove a fabric during a pending add with fail-safe timeout, we
aren't updating DNS-SD adevertisements.  In addition to the obvious
consequence of continuing to advertise a now-stale identity, this can
also leave the advertisement slots full if the failed fabric addition
was to the Nth slot in an N-fabric device.

This then breaks advertisement when recommissioning to the Nth slot
thereafter for builds that do not set this:

CHIP_CONFIG_MINMDNS_DYNAMIC_OPERATIONAL_RESPONDER_LIST

For those builds, this condition persists until reboot or some other
action triggers DnssdServer::StartServer.

This commit fixes the problem by moving the DnssdServer::StartServer
call from the RemoveFabric invoke handler to the server's
OnFabricRemoved callback.  That will result in server restart both
for RemoveFabric invocations and fail-safe expiry.

Fixes #23169
  • Loading branch information
msandstedt authored and pull[bot] committed Jan 23, 2023
1 parent 92738ad commit 1638060
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,6 @@ const FabricInfo * RetrieveCurrentFabric(CommandHandler * aCommandHandler)
CHIP_ERROR DeleteFabricFromTable(FabricIndex fabricIndex)
{
ReturnErrorOnFailure(Server::GetInstance().GetFabricTable().Delete(fabricIndex));

// We need to withdraw the advertisement for the now-removed fabric, so need
// to restart advertising altogether.
app::DnssdServer::Instance().StartServer();

return CHIP_NO_ERROR;
}

Expand Down Expand Up @@ -362,6 +357,10 @@ class OpCredsFabricTableDelegate : public chip::FabricTable::Delegate
{
ChipLogProgress(Zcl, "OpCreds: Fabric index 0x%x was removed", static_cast<unsigned>(fabricIndex));

// We need to withdraw the advertisement for the now-removed fabric, so need
// to restart advertising altogether.
app::DnssdServer::Instance().StartServer();

EventManagement::GetInstance().FabricRemoved(fabricIndex);

NotifyFabricTableChanged();
Expand Down

0 comments on commit 1638060

Please sign in to comment.