From 3570867d1896f7ec6591bdaaf2af4dbaabdc956f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 21 Jan 2022 00:45:38 -0500 Subject: [PATCH] Stop trying to commission devices that are not in commissioning mode. (#13794) SetUpCodePairer was filtering devices by discriminator, but not checking for a nonzero CM value, so could end up trying to commission a device that's not commissionable and miss a device with a colliding discriminator that is. --- src/controller/SetUpCodePairer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 16e0e04d14900d..75d710308f54bb 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -167,6 +167,11 @@ void SetUpCodePairer::OnDiscoveredDeviceOverBleError(void * appState, CHIP_ERROR bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) { + if (nodeData.commissioningMode == 0) + { + return false; + } + switch (currentFilter.type) { case Dnssd::DiscoveryFilterType::kShortDiscriminator: