Skip to content

Commit

Permalink
Fix max timeout for open commissioning window
Browse files Browse the repository at this point in the history
Commissioning window can be opened using timeout exceeding
the maximum value of 900 s defined by the spec. This can happen
if selected transport is IP, but the device uses BLE extended
announcement feature.

Added checking if device is commissioned to be able to determine
what max timeout should be used for the particular scenario.

Fixes: #35505
  • Loading branch information
kkasperczyk-no committed Sep 11, 2024
1 parent 83d345e commit 870ac49
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/server/CommissioningWindowManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ class CommissioningWindowManager : public Messaging::UnsolicitedMessageHandler,
static constexpr System::Clock::Seconds32 MaxCommissioningTimeout()
{
#if CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING
// Specification section 2.3.1 - Extended Announcement Duration up to 48h
return System::Clock::Seconds32(60 * 60 * 48);
#else
/* Allow for extended announcement only when device is uncomissioned. */
if (GetFabricTable().FabricCount() == 0)
{
// Specification section 2.3.1 - Extended Announcement Duration up to 48h
return System::Clock::Seconds32(60 * 60 * 48);
}
#endif
// Specification section 5.4.2.3. Announcement Duration says 15 minutes.
return System::Clock::Seconds32(15 * 60);
#endif
}

System::Clock::Seconds32 MinCommissioningTimeout() const
Expand Down

0 comments on commit 870ac49

Please sign in to comment.