From c2d2c4d11db1c07259d845d525a45464d186fb6c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 24 Jun 2021 18:19:02 -0400 Subject: [PATCH] Restart operational advertisements when we get a new opcert. (#7885) Per the spec, the commissioning flow goes like this: 1. Various steps. 2. Install a new opcert. 3. Optionally configure and enable a network. 4. Discover each other on the operational network. This means when the commissionnee gets a new opcert it needs to start operational advertisement (if it's able to), because it doesn't know whether the next step on the part of the commissioner will be network config or operational discovery. In particular, adding a new opcert adds a new fabric and node id, so we need to redo our operational advertisements in the case when we are already on the operational network to advertise the new operational identity. --- .../operational-credentials-server.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index aa29c7089ab3a9..fc53d00ea1c853 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -343,6 +344,12 @@ bool emberAfOperationalCredentialsClusterAddOpCertCallback(chip::app::Command * VerifyOrExit(admin->SetOperationalCert(OperationalCert) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); VerifyOrExit(GetGlobalAdminPairingTable().Store(admin->GetAdminId()) == CHIP_NO_ERROR, status = EMBER_ZCL_STATUS_FAILURE); + // We have a new operational identity and should start advertising it. We + // can't just wait until we get network configuration commands, because we + // might be on the operational network already, in which case we are + // expected to be live with our new identity at this point. + chip::app::Mdns::StartServer(); + exit: emberAfSendImmediateDefaultResponse(status); if (status == EMBER_ZCL_STATUS_FAILURE)