-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
net: lwm2m: Correctly Support Bootstrap-Delete Operation #29964
Comments
@broglep-work Thanks for reporting. Indeed the current implementation oversimplified a lot. I've pushed a PR with proposed changes: #30200 I've verified that DELETE During the rework I've also realized that bootstrap DISCOVER operation is totally broken, but that's a story for a separate PR. |
Rework the bootstrap DELETE operation, to support deletion of multiple resources. Current implementation had several oversimplifications, making it not spec-compliant: * DELETE `/` removed only Security object instances (!= 0) * DELETE `/x` was handled as DELETE `/x/0`, therefore not removing all of the object instances. Since the above is only supported during bootstrap and not regular Device management, this functionality was implemented in the `bootstrap_delete` function, which now will be called for all DELETE operations initiated during bootstrap. The regular LwM2M DELETE handler will only be called during regular Device management, as it has more strict limitations on what can be deleted. Additionally, handle empty URI Path option as `/`, therefore indicating deletion of all resources. Fixes zephyrproject-rtos#29964 Signed-off-by: Robert Lubos <[email protected]>
Rework the bootstrap DELETE operation, to support deletion of multiple resources. Current implementation had several oversimplifications, making it not spec-compliant: * DELETE `/` removed only Security object instances (!= 0) * DELETE `/x` was handled as DELETE `/x/0`, therefore not removing all of the object instances. Since the above is only supported during bootstrap and not regular Device management, this functionality was implemented in the `bootstrap_delete` function, which now will be called for all DELETE operations initiated during bootstrap. The regular LwM2M DELETE handler will only be called during regular Device management, as it has more strict limitations on what can be deleted. Additionally, handle empty URI Path option as `/`, therefore indicating deletion of all resources. Fixes #29964 Signed-off-by: Robert Lubos <[email protected]>
Summary
DELETE /
is implemented asDELETE /0
DELETE /
andDELETE /x
for x != 0 is not supported/implementedBackground
Zephyr client should support bootstrap-delete according to the specification.
Currently the support is only implementing partially and that part not according to the specification:
Uri-Path
option, then bootstrap_delete will be executed (wm2m_engine.c:3344)bootstrap_delete
deletes SECURITY instances > 0Given
bootstrap_delete
is called when no uri option is set, the assumed contract of that method is that it should correspond to DELETE / whereall Instances of all Objects in the LwM2M Client MUST be removed (except for the two cases mentioned above)
whereThe two exceptions are the LwM2M Bootstrap-Server Account, potentially including an associated Instance of an OSCORE Object ID:21, and the single Instance of the mandatory Device Object (ID:3), which are not affected by any Delete operation.
Proposal
Uri-Path
header and emptyUri-Path
header, and treat them the same waySide Note
Sending a
DELETE /x
request to the client in bootstrap mode is executed asDELETE /x/0
(goes through regular delete request handler that does not check if uri path has length >=2 as it is not allowed by the spec outside of bootstrap, object and instance id must be set)The text was updated successfully, but these errors were encountered: