Skip to content
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

Bluetooth: Mesh: Fix OOB upload in Fw Distribution server #63739

Merged
merged 6 commits into from
Oct 11, 2023

Conversation

PavelVPV
Copy link
Collaborator

@PavelVPV PavelVPV commented Oct 10, 2023

The PR fixes bugs related to OOB upload.

This PR also adds support for the following PTS test:

  • DFU/SR/FD/BV-06-C
  • DFU/SR/FD/BV-13-C
  • DFU/SR/FD/BV-14-C
  • DFU/SR/FD/BV-15-C
  • DFU/SR/FD/BV-16-C
  • DFU/SR/FD/BV-17-C
  • DFU/SR/FD/BV-18-C
  • DFU/SR/FD/BV-22-C

Fixes #63798

In OOB upload, when Check Firmware OOB procedure completes successfully
and the firmware is already received, we send Firmware Distribution
Upload Status message with update Phase set to Transfer Success. In this
case, we must set Upload Progress to 100%. This can't be done through
the callback as the application layer doesn't yet know that the firmware
is already received. This will happen by the exist from
bt_mesh_dfd_srv_oob_check_complete function, which will return error
code -EEXIST.

Signed-off-by: Pavel Vasilyev <[email protected]>
@@ -21,7 +21,7 @@

#include <zephyr/logging/log.h>
#define LOG_MODULE_NAME bttester_mesh
LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_BTTESTER_LOG_LEVEL);
LOG_MODULE_REGISTER(LOG_MODULE_NAME, 4);//CONFIG_BTTESTER_LOG_LEVEL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be reverted back.


dfd_srv_oob_ctx.progress = MIN(dfd_srv_oob_ctx.progress + 25, 99);

if (dfd_srv_oob_ctx.progress == 99) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be >= or <=, or is it correct with exact 99. dfd_srv_oob_ctx.progress can be less than 99.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASFAIK The image is ready for storing if progress is exactly 99. After storing it will be 100.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, MIN will not let it to be set greater than 99.

Copy link
Collaborator

@alxelax alxelax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems Ok but requires a bit more changes.

subsys/bluetooth/mesh/dfd_srv.c Show resolved Hide resolved
tests/bluetooth/tester/src/btp_mesh.c Show resolved Hide resolved

dfd_srv_oob_ctx.progress = MIN(dfd_srv_oob_ctx.progress + 25, 99);

if (dfd_srv_oob_ctx.progress == 99) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASFAIK The image is ready for storing if progress is exactly 99. After storing it will be 100.

tests/bluetooth/tester/src/btp_mesh.c Show resolved Hide resolved
This message _at least_ 2 bytes long, but can be longer, thus
BT_MESH_LEN_MIN should be used.

Signed-off-by: Pavel Vasilyev <[email protected]>
@PavelVPV PavelVPV requested review from alxelax and Balaklaka October 10, 2023 12:56
@PavelVPV PavelVPV force-pushed the dfd_oob_fixes branch 3 times, most recently from e1808bc to 2d33737 Compare October 10, 2023 13:07
alxelax
alxelax previously approved these changes Oct 10, 2023
If a Fw Distribution Client sends the Upload OOB Start message, but the
application layer didn't call bt_mesh_dfd_srv_oob_check_complete yet,
we have no other option other than ignore the message. The next phase
in this case could be Transfer Active, Transfer Success or Failed and it
will be set only after Check Firmware OOB procedure completes.

Signed-off-by: Pavel Vasilyev <[email protected]>
If the previous upload was in-band and it didn't complete, the slot will
stay reserved. By design we release slot not at the end of the upload
phase, but at the start of a new upload phase.

This fixes DFU/SR/FD/BV-13-C.

Signed-off-by: Pavel Vasilyev <[email protected]>
PavelVPV added a commit to PavelVPV/auto-pts that referenced this pull request Oct 10, 2023
Enable all OOB upload tests except DFU/SR/FD/BV-58-C as we don't support
Firmware Retrieval Over HTTPS procedure.

Zephyr PR:
zephyrproject-rtos/zephyr#63739

Signed-off-by: Pavel Vasilyev <[email protected]>
@PavelVPV PavelVPV requested a review from alxelax October 10, 2023 14:23
alxelax
alxelax previously approved these changes Oct 10, 2023
@jhedberg jhedberg added the area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests label Oct 10, 2023
@jhedberg
Copy link
Member

@PavelVPV is this something you think should be merged for 3.5? If so, please set the target milestone appropriately.

sjanc pushed a commit to auto-pts/auto-pts that referenced this pull request Oct 11, 2023
Enable all OOB upload tests except DFU/SR/FD/BV-58-C as we don't support
Firmware Retrieval Over HTTPS procedure.

Zephyr PR:
zephyrproject-rtos/zephyr#63739

Signed-off-by: Pavel Vasilyev <[email protected]>
status = BT_MESH_DFD_ERR_URI_NOT_SUPPORTED;
} else if (dfd_srv_oob_ctx.uri_len < 7 || memcmp(dfd_srv_oob_ctx.uri,
SUPPORTED_SCHEME "://",
strlen(SUPPORTED_SCHEME) + 3)) {
Copy link
Collaborator

@ludvigsj ludvigsj Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this passes PTS then I guess it's fine, but I think returning SUCCESS for e.g. "http://?:?" (which this does as far as I can tell) is wrong, and can fail if PTS changes. At the very least, make a comment here about this so that if this fails in the future when PTS becomes more diligent then we easily can find where to fix it?

This was wrong, http://?:? is actually valid I think. My second comment still stands

Forget this entire comment, I'm not understanding the RFC I think

Copy link
Collaborator

@ludvigsj ludvigsj Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also returns URI_MALFORMED for "https://example.com/" which is definitely wrong, can easilly be fixed by checking the entire SUPPORTED_SCHEME ":" also when checking for supported URI. It also returns MALFORMED for "http:something" which is correct according to the RFC (even though I think it's invalid in the HTTP spec but that's not what we should check here)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

This allow to run the following PTS test:
- DFU/SR/FD/BV-06-C
- DFU/SR/FD/BV-13-C
- DFU/SR/FD/BV-14-C
- DFU/SR/FD/BV-15-C
- DFU/SR/FD/BV-16-C
- DFU/SR/FD/BV-17-C
- DFU/SR/FD/BV-18-C
- DFU/SR/FD/BV-22-C

Signed-off-by: Pavel Vasilyev <[email protected]>
this is useful for debugging.

Signed-off-by: Pavel Vasilyev <[email protected]>
@PavelVPV
Copy link
Collaborator Author

@PavelVPV is this something you think should be merged for 3.5? If so, please set the target milestone appropriately.

Added milestone (hope it is not too late).

@jhedberg
Copy link
Member

@PavelVPV is this something you think should be merged for 3.5? If so, please set the target milestone appropriately.

Added milestone (hope it is not too late).

Is this fixing any bugs? I don't see any "Fixes: ..." entry.

@PavelVPV
Copy link
Collaborator Author

@PavelVPV is this something you think should be merged for 3.5? If so, please set the target milestone appropriately.

Added milestone (hope it is not too late).

Is this fixing any bugs? I don't see any "Fixes: ..." entry.

Sorry, added now.

@PavelVPV PavelVPV changed the title tests: bluetooth: tester Add support for OOB upload tests in Fw Distribution server Bluetooth: Mesh: Fix OOB upload in Fw Distribution server Oct 11, 2023
@jhedberg jhedberg merged commit 2c9fc04 into zephyrproject-rtos:main Oct 11, 2023
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Mesh area: Bluetooth Qualification Bluetooth Qualification -related issues and pull requests area: Bluetooth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bluetooth: Mesh: Fw Distribution Server issues with OOB upload
7 participants