Skip to content

Commit

Permalink
Increment lifetime counter on advertisement (project-chip#13598)
Browse files Browse the repository at this point in the history
* RotatingId: version0

* RotatingId: version1

* RotatingId: version0

* RotatingId: version1

* Fix Darwin host build (project-chip#3990)

#### Problem

Some conversions to use PacketBufferHandle (project-chip#3909) broke Darwin builds,
which aren't currently run in CI.

#### Summary of Changes

Fix src/platform/Darwin/BleConnectionDelegateImpl.mm to match the API
change in project-chip#3909.

* Add '-Wextra' to compiler flags (project-chip#3902)

* Implement Level Control Cluster (project-chip#3806)

* New seekbar in Android CHIPTool
* Sample usage in lighting-app/nrfconnect

Signed-off-by: Markus Becker <markus.becker@tridonic.com>

* Fix Rendezvous over BLE after recent changes (project-chip#4012)

PR project-chip#3704 introduced a change that the BLE transport in
RendezvousSession is only initialized when PeerAddress
in RendezvousParams is of type BLE. However, PeerAddress
isn't initialized anywhere. As a result Rendezvous over BLE
stopped working between Android CHIPTool and accessories.

Btw, remove an assert related to the storage delegate
as it seems an optional member of the device controller.

* [thread] fix invalid configuration of active dataset (project-chip#4008)

* Fix data loss or crash in TCPEndPoint with LwIP (project-chip#4022)

* Fix data loss or crash in TCPEndPoint with LwIP

#### Problem

Under the configuration CHIP_SYSTEM_CONFIG_USE_LWIP, in some cases where
the data size exceeds the TCP window size, TCPEndPoint can either die or
lose data when accounting of un-acked data falls out of sync.

#### Summary of Changes

Imported fix from Weave:

* This change removes separate accounting of the unsent
  data position and replaces it with simple counting of
  sent-but-not-acked data and a skip-loop at the start
  of DriveSending().

Fixes project-chip#4013 - Data loss or crash in TCPEndPoint with LwIP

* Restyled by clang-format

Co-authored-by: Restyled.io <commits@restyled.io>

* Update lighting-app gen/ folder with ZAP generated content (project-chip#4010)

* Fix segmentation fault error in response echo message (project-chip#3984)

* Add back Android default build coverage & fix the build (project-chip#3966)

mDNS doesn't build with no device layer. Remove it from the build and
add back the coverage that would catch this that was lost in project-chip#3340.

* Update all-clusters-app gen/ folder with ZAP generated content (project-chip#3963)

* Move src/inet/tests to auto-test-driver generation (project-chip#3997)

* Rename TestUtils to UnitTestRegistration. (project-chip#4021)

Looking to remove usage of 'Utils' unless we have really no choice.
'UnitTestRegistration' seems clearer in what it does compared to
'TestUtils'.

* Update src/lib/core/tests to auto-test-driver generation (project-chip#3991)

* Cleanup zap chip-helper.js (project-chip#3973)

* Cleanup zap chip-helper.js

* Restyled by clang-format

Co-authored-by: Restyled.io <commits@restyled.io>

* Move src/transport/tests to auto-test-driver generation (project-chip#3999)

* Move src/transport/tests to auto-test-driver generation

* Add relevant libraries (and more test-capable libs) to nrf.

* Refactor inet test helpers (to not include actual inet tests), try to make qemu allow better linkage but still failed for transport tests so disabled for now

* Added more tests on esp32 qemu

* Restyle fixes

* Fix cast errors in InetCommon

* Disable raw tests from zephyr: somehow they fail running out of endpoints

* Disable DNS test on zephyr

* Remove inet endpoint test from zephyr

* Remove inet endpoint test from zephyr - fix again

* Modify gitignore

* Restyle fixes

* Use CHIPDeviceController instead of CHIPDeviceController_deprecated (project-chip#3979)

* Implement the missing part of Exchange Header in Transport layer (project-chip#4017)

* Implement the missing part of Exchange Header in Transport layer

* Revert comment 'if' back to 'iff'("if and only if")

* Remove duplicated send flag defines and put ExchangeMgr/ExchangeConte… (project-chip#3994)

* Remove duplicated send flag defines and put ExchangeMgr/ExchangeContext under the same namespace as CRMP

* Rename kSendFlag_Default to kSendFlag_None

* Move src/lib/asn1/tests and src/ble/tests to auto-test-driver generation (project-chip#3998)

* Move src/lib/asn1/tests and src/ble/tests to auto-test-driver generation

* Remove one more unused file

* Attempt to enable asn1 and ble tests in esp32 - see if they pass or not

* Fix merge error

* Update include header for ASN1 test

* Include  ASN1 in libCHIP

* Some conversions to use PacketBufferHandle (project-chip#4011)

* Some conversions to use PacketBufferHandle

#### Problem

Code should use `PacketBufferHandle` rather than `PacketBuffer *`.

#### Summary of Changes

- Converts remaining receive path in //src/inet and //src/transport.
- Converts most of //src/ble.
- Introduces Handle versions of the `AddToEnd`/`DetachTail` pair.

Part of issue project-chip#2707 - Figure out a way to express PacketBuffer ownership in the type system

* Restyled by clang-format

* review

* revive BtpEngine::Clear[TR]xPacket()
* simplify conditional
* (void) message.DetachTail() → message.FreeHead()
* remove ExchangeContext::kSendFlag_RetainBuffer
* missed pBuf.IsNull()
* DetachHead() → PopTail()
* typos

Co-authored-by: Restyled.io <commits@restyled.io>

* Move src/system/tests to auto-test-driver generation (project-chip#4000)

* Move src/system/tests to auto-test-driver generation

* Remove a TCP/IP init call that was killing qemu

* Remove explicit "all" target from root build file (project-chip#3967)

The "all" target exists implicitly and contains everything. We don't
need to specify one, and it's misleading to do so specifying deps has no
effect.

* Make src/setup_payload compile with -Werror=conversion (project-chip#4032)

* Add SSID and password to chip-tool pairing (project-chip#4054)

* Get temperature-measurement and all-clusters-app to use examples/common/chip-app-server (project-chip#4039)

#### Problem

PR project-chip#3704 introduced a change where a `PeerAddress` is now required in order to start `RendezvousSession`.
Sadly the multiple code paths bootstrapping `RendezvousSession` has not been updated.

PR project-chip#4012 add a fix for some of the `examples/` but not for the `all-clusters-app` nor the `temperature-measurement-app`.

To avoid such situation, this PR merge `examples/common/chip-app-server` and the custom code from `all-clusters-app` and `temperature-measurement-app`.

One of the more discutable change of this PR (imo) is the code that moves the custom `Echo` mechanism from the `all-clusters-app` to `chip-app-server`. I was hoping to get rid of it before doing this change but the `all-clusters-app` and the `temperature-measurement-app` are broken since project-chip#3704 and this PR should fix that.
Also I have a PR (mostly) ready once project-chip#3979 lands to get rid of this `Echo` specific code and replace it by a manufacturer specific `ping` command.

 #### Summary of Changes
 * Remove `EchoServer.cpp`, `RendezvousDeviceDelegate.cpp` and `include/RendezvousDeviceDelegate.h` from `all-clusters-app`
 * Remove `ResponseServer.cpp`, `RendezvousDeviceDelegate.cpp` and `include/RendezvousDeviceDelegate.h` from `temperature-measurement-app`
 * Introduce `chip-app-server/include/AppDelegate.h` in order to keep the behavior the `all-clusters-app` that turns on/off leds on different events. Maybe it should be converted to some types of `ChipDeviceEvent` or `CHIPCallback` at some point.
 * Fix `chip-app-server` to accomodate for the specifics of `all-clusters-app`

* Add all Thread ULA addresses to the lwip interface (project-chip#4053)

ULA prefixes will used for CHIP network so we need to add all these
addresses to the interface.

* Remove src/lib/message. (project-chip#4055)

* Remove src/lib/message.

Updated messaging implementation lives in src/messaging and the
src/lib/message is not currently compiled or linked in.

This saves us from looking at this code when some refactoring is needed
(e.g. the SystemPacketBuffer changes).

* Remove one more unused file

* [ChipTool] Add Payload Parse Command (project-chip#3696)

* [ChipTool] Add Payload Parse Command

* [ChipTool] Add Payload Parse Command

* [ChipTool] Restyle issues resolved

* Restyled by whitespace

* Resolve build errors caused by Command.h schema change

Co-authored-by: lijayaku <lijayaku@amazon.com>
Co-authored-by: Restyled.io <commits@restyled.io>

* rename ParseCommand to QRCodeParseCommand

* adding AdditionalDataParseCommand version 0

* Adding parsing logic + logging

* adding another parsing method

* Basic Parsing is DONE

* fixing memory issue

* removing some logs

* removing more logs

* minor update

* Add RotatingDeviceId to DNS-SD

* Revert "Merge pull request #4 from hnnajh/rotating-id-test"

This reverts commit 0235d05, reversing
changes made to 3e1a4b9.

* increment lifetime counter

* Incrementing lifetime counter at each BLE/MDNS advertisement

* address comments

* Update src/include/platform/ConfigurationManager.h

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

* removing unnecessary lines

* nit

* Update src/app/server/Dnssd.cpp

Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com>

* restyling

* Update src/app/server/Dnssd.cpp

Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com>

* Update src/app/server/Dnssd.cpp

Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com>

* fix comments

* incrementing lifetimecounter once

* remove unnecessary include

Co-authored-by: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com>
Co-authored-by: Vivien Nicolas <vnicolas@apple.com>
Co-authored-by: Markus Becker <Markus.Becker@tridonic.com>
Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com>
Co-authored-by: Łukasz Duda <lukasz.duda@nordicsemi.no>
Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Yufeng Wang <44623591+yufengwangca@users.noreply.github.com>
Co-authored-by: Michael Spang <spang@google.com>
Co-authored-by: Andrei Litvin <andrei@andy314.com>
Co-authored-by: jepenven-silabs <67962328+jepenven-silabs@users.noreply.github.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
Co-authored-by: Jiacheng Guo <gjc@google.com>
Co-authored-by: Liju Jayakumar <26148162+lijujayakumar@users.noreply.github.com>
Co-authored-by: lijayaku <lijayaku@amazon.com>
Co-authored-by: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com>
  • Loading branch information
16 people authored Jan 20, 2022
1 parent a3409d6 commit 786fdfa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/app/server/CommissioningWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ void CommissioningWindowManager::CloseCommissioningWindow()

CHIP_ERROR CommissioningWindowManager::StartAdvertisement()
{
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
// notify device layer that advertisement is beginning (to do work such as increment rotating id)
DeviceLayer::ConfigurationMgr().NotifyOfAdvertisementStart();
#endif

if (mIsBLE)
{
ReturnErrorOnFailure(chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(true));
Expand Down
7 changes: 7 additions & 0 deletions src/include/platform/ConfigurationManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ class ConfigurationManager
virtual bool IsFullyProvisioned() = 0;
virtual void InitiateFactoryReset() = 0;

// Gets called when starting BLE/DNS-SD advertisement
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
virtual void NotifyOfAdvertisementStart() {}
#else
void NotifyOfAdvertisementStart() {}
#endif

virtual void LogDeviceConfig() = 0;

virtual bool IsCommissionableDeviceTypeEnabled() = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,16 @@ CHIP_ERROR GenericConfigurationManagerImpl<ConfigClass>::StoreManufacturingDate(

template <class ConfigClass>
void GenericConfigurationManagerImpl<ConfigClass>::InitiateFactoryReset()
{}

template <class ImplClass>
void GenericConfigurationManagerImpl<ImplClass>::NotifyOfAdvertisementStart()
{
#if CHIP_ENABLE_ROTATING_DEVICE_ID
// Increment life time counter to protect against long-term tracking of rotating device ID.
IncrementLifetimeCounter();
#endif
// Inheriting classes should call this method so the lifetime counter is updated if necessary.
#endif
}

template <class ConfigClass>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class GenericConfigurationManagerImpl : public ConfigurationManager
CHIP_ERROR RunUnitTests(void) override;
bool IsFullyProvisioned() override;
void InitiateFactoryReset() override;
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
void NotifyOfAdvertisementStart() override;
#else
void NotifyOfAdvertisementStart();
#endif
void LogDeviceConfig() override;

virtual ~GenericConfigurationManagerImpl() = default;
Expand Down
5 changes: 0 additions & 5 deletions src/platform/Zephyr/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,6 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)

ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped");

#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
// Increment life time counter to protect against long-term tracking of rotating device ID.
ReturnErrorOnFailure(ConfigurationMgr().IncrementLifetimeCounter());
#endif

// Post a CHIPoBLEAdvertisingChange(Stopped) event.
{
ChipDeviceEvent advChange;
Expand Down

0 comments on commit 786fdfa

Please sign in to comment.