-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the commissiong mode of "commissioning for on-network" usecases #8763
Conversation
161bb6b
to
231f4ab
Compare
@@ -69,6 +69,9 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ | |||
// connectivity. MDNS still wants to refresh its listening interfaces to include the | |||
// newly selected address. | |||
chip::app::Mdns::StartServer(); | |||
#ifdef RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE | |||
chip::app::Mdns::AdvertiseCommissionableNode(); | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to do this though a CLI or shell command (similar to option present on M5stack through a button) instead of adding it here? Something like:
$ force-wifi-commissioning
@@ -920,6 +920,7 @@ bool GenericConfigurationManagerImpl<ImplClass>::_IsFullyProvisioned() | |||
#if CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING | |||
(!UseManufacturerCredentialsAsOperational() && _OperationalDeviceCredentialsProvisioned()) && | |||
#endif | |||
(mFlags.Has(Flags::kIsServiceProvisioned) && mFlags.Has(Flags::kOperationalDeviceCredentialsProvisioned)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can someone check if this is the correct thing to do and won't break any other platform? cc @cecille @bzbarsky-apple
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change still needed now that #8454 has merged?
In any case, this does not look right because outside of TestConfigurationMgr it looks to me like kIsServiceProvisioned
is never set. And kOperationalDeviceCredentialsProvisioned
looks like it's never set at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bzbarsky-apple , actually this change was added because in the case of On-Network commissioning _IsFullyProvisioned
is returning true after getting credentials of AP, which causes code to break and Node doesn't advertise Commissionable Mode = 1
after it gets connected to AP. _IsFullyProvisioned
should return false as the node is not fully provisioned yet, so to determine if the node is fully provisioned or not, It should check here if operational device credentials are provisioned, is this conclusion right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would pretty much assume that any use of IsFullyProvisioned
is broken.... Whatever code is meant to advertise Commissionable Mode = 1
should presumably just check whether we have operational credentials directly. That's what Mdns::StartServer
ends up doing (by calling the kinda-broken GetCurrentNodeId
; we should have a way to actually ask the boolean "do we have an opcred?" question we really want to ask.
Does kOperationalDeviceCredentialsProvisioned
ever get set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, You are right.. kOperationalDeviceCredentialsProvisioned
is never set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. So fundamentally:
IsFullyProvisioned
in its current form can't really be relied on to ever become true; see Operational advertisement on startup is broken on Linux for on-network pairing (and various other cases) #7911 for another example, where any device with thread or wifi support that is actually connecting via ethernet will always haveIsFullyProvisioned
false.- We should probably not add new conditions to
IsFullyProvisioned
- Whatever code is misbehaving because it uses
IsFullyProvisioned
should probably be changed to test the things it actually cares about.
Size increase report for "esp32-example-build" from 9ca9d47
Full report output
|
Size increase report for "nrfconnect-example-build" from 9ca9d47
Full report output
|
Size increase report for "gn_qpg-example-build" from 9ca9d47
Full report output
|
@@ -920,6 +920,7 @@ bool GenericConfigurationManagerImpl<ImplClass>::_IsFullyProvisioned() | |||
#if CHIP_DEVICE_CONFIG_ENABLE_JUST_IN_TIME_PROVISIONING | |||
(!UseManufacturerCredentialsAsOperational() && _OperationalDeviceCredentialsProvisioned()) && | |||
#endif | |||
(mFlags.Has(Flags::kIsServiceProvisioned) && mFlags.Has(Flags::kOperationalDeviceCredentialsProvisioned)) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change still needed now that #8454 has merged?
In any case, this does not look right because outside of TestConfigurationMgr it looks to me like kIsServiceProvisioned
is never set. And kOperationalDeviceCredentialsProvisioned
looks like it's never set at all.
@@ -69,6 +69,9 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ | |||
// connectivity. MDNS still wants to refresh its listening interfaces to include the | |||
// newly selected address. | |||
chip::app::Mdns::StartServer(); | |||
#ifdef RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE | |||
chip::app::Mdns::AdvertiseCommissionableNode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the actual intent of this change? Why do we want to:
- Advertise being a commissionable node "unconditionally" (i.e. based on compile-time information only)
- But only when
RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE
, which is generally false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bzbarsky-apple Intent of this change was to advertise the device as a commissionable node for On-Network Commissioning where RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE
is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what the code is doing. The question is why we want to advertise the device in that way exactly when that compile-time constant is set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IsServiceProvisioned is legacy from OpenWeave data and the "service" provisioning data should not be touched/used.
RENDEZVOUS_WAIT_FOR_COMMISSIONING_COMPLETE
should not be the gate. It's very clear what should cause commissionable for "already on network": an uncommissioned device but already connected to an IP network (e.g. Thread, Wifi, Ethernet) through non-Matter means, or a device already commissioned after receiving a request to open a commissioning window.
An commissioned device should not be advertising commissionable unless it can be be put into commissioning mode (e.g. some TV usecases).
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This stale pull request has been automatically closed. Thank you for your contributions. |
* Committing the necessary changes before regen_all.py * Updated mode base to include cluster references so that zap_regen_all now works. * Added autogen code * Added new files created as part autogen. Also added missing data_model/clusters/Mode_DeviceEnergyManagement.xml * Fixed misspell * Added to python __init__.py * Restyled by isort * Updates to map into spec PR #8763 * Updated autogen for DEM Modes to include no optimization etc. * Updated data model for EEVSEM * Disabled ember for generating command hooks * Finally working * Restyled by gn * Updated zap files after merge to master. * Added support into Example EnergyManagementApp * Restyled by gn * Resolving merge conflict * Updated copyright to 2024 * Converted to using std::unique_ptr instead of new/delete * Made modes constexpr per review comment * Added Shutdown() to free Mode clusters and avoid VerifyOrDie failure at src/lib/support/IntrusiveList.h:290: Empty() * Copyright update * Copyright update Co-authored-by: Nivi Sarkar <[email protected]> --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Nivi Sarkar <[email protected]>
Change overview
Testing
How was this tested? (at least one bullet point required)