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: Add full virtual addresses support #57878

Merged
merged 6 commits into from Jun 17, 2023

Conversation

PavelVPV
Copy link
Collaborator

This PR adds the following features related to virtual addresses
support:

  • Allows to store Label UUIDs which virtual addresses collide;
  • Allows to decrypt messages encrypted with a virtual address with
    collision;
  • Allows to publish a message to a specific Label UUID to avoid virtual
    addresses collision by adding a pointer to Label UUID to
    struct bt_mesh_msg_ctx and struct bt_mesh_model_pub;
  • Allows to differentiate Label UUIDs in the model's Subscription List
    by storing all subscribed UUIDs in struct bt_mesh_model.uuids field.

This PR adds BabbleSim test to cover new functionality.

This PR also fixes an issue where an LPN will unnecessarily poll Friend when sending a message over loopback.

Copy link
Collaborator

@Andrewpini Andrewpini left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I have a couple of minor comments

@@ -102,6 +105,8 @@ struct bt_mesh_msg_ctx {
/**
* @brief Helper for bt_mesh_msg_ctx structure initialization.
*
* @note If @c dst is a Virtual Address, Label UUID shall initialized separately.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @note If @c dst is a Virtual Address, Label UUID shall initialized separately.
* @note If @c dst is a Virtual Address, Label UUID shall be initialized separately.

*
* @param uuid pointer to momry with Label UUID to be found.
*
* @return Pointer to an valid entry, NULL otherwise.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @return Pointer to an valid entry, NULL otherwise.
* @return Pointer to a valid entry, NULL otherwise.

*
* @c uuid can be a user data.
*
* @param uuid pointer to momry with Label UUID to be found.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @param uuid pointer to momry with Label UUID to be found.
* @param uuid pointer to memory with Label UUID to be found.

*
* @param addr Virtual address to check
*
* @return true if there is collision, false otherwise.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* @return true if there is collision, false otherwise.
* @return True if there is collision, false otherwise.


/** @brief Iterate stored Label UUIDs.
*
* When @c addr is @ref BT_MESH_ADDR_UNASSIGNED, this function iterates all available addresses
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* When @c addr is @ref BT_MESH_ADDR_UNASSIGNED, this function iterates all available addresses
* When @c addr is @ref BT_MESH_ADDR_UNASSIGNED, this function iterates over all available addresses

?

subsys/bluetooth/mesh/transport.c Show resolved Hide resolved
subsys/bluetooth/mesh/transport.c Show resolved Hide resolved
include/zephyr/bluetooth/mesh/access.h Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/access.c Show resolved Hide resolved
subsys/bluetooth/mesh/access.c Show resolved Hide resolved
subsys/bluetooth/mesh/access.c Outdated Show resolved Hide resolved
subsys/bluetooth/mesh/cfg_srv.c Outdated Show resolved Hide resolved
When LPN sends a segmented message to itself, it unnecesseraly polls
Friend. Since Friend doesn't receive this message, the segmented message
transmission will eventually fail (send end callback will return error),
while the message will actually be passed to the access layer.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
@PavelVPV PavelVPV force-pushed the va_collision_support branch 2 times, most recently from 15df358 to 880b321 Compare June 1, 2023 07:28
This commit adds the following features related to virtual addresses
support:
- Allows to store Label UUIDs which virtual addresses collide;
- Allows to decrypt messages encrypted with a virtual address with
collision;
- Allows to publish a message to a specific Label UUID to avoid virtual
addresses collision by adding a pointer to Label UUID to
struct bt_mesh_msg_ctx and struct bt_mesh_model_pub;
- Allows to differentiate Label UUIDs in the model's Subscription List
by storing all subscribed UUIDs in struct bt_mesh_model.uuids field.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Test that:
- virtual addresses in subscription list and publication states are
stored and restored correctly
- virtual addresses with collisions are stored and restored correctly

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Test that transport layer correctly encrypts and decrypts messages to
virtual addresses with collision.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Test that LPN correctly sends Friend Subscription List Add and Remove
messages to Friend when subscribed and unsubscribed to virtual addresses
wirth collision.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
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.

LGTM just needs to clarify the final case with backward compatibility. After this, I'll approve PR.

After adding support for virtual addresses with collision (where two
Label UUIDs have the same virtual address), the format of the data in
the persistent storage with the Label UUIDs which a model is subscribed
to or publishes to has been changed. The recovery code is added and the
Label UUIDs will be recovered by picking first Label UUID matching to
the virtual address in the subscription list or model publication. This
options can disable the recovery code and save some flash if the
recovery is not required (e.g. virtual address support wasn't enabled
before this option was added, or the devices were unprovisioned before
upgrading to the version with this option).

Making this option as deprecated to be able to drop support of this
option and remove the recovery code eventually.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
@nashif nashif merged commit 47e3c53 into zephyrproject-rtos:main Jun 17, 2023
26 checks passed
PavelVPV added a commit to PavelVPV/auto-pts that referenced this pull request Jun 21, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jun 21, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jun 21, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/auto-pts that referenced this pull request Jun 21, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Corresponding PR to zephyrproject-rtos:
zephyrproject-rtos/zephyr#59486

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/auto-pts that referenced this pull request Jun 21, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Corresponding PR to zephyrproject-rtos:
zephyrproject-rtos/zephyr#59486

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/auto-pts that referenced this pull request Jun 27, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Corresponding PR to zephyrproject-rtos:
zephyrproject-rtos/zephyr#59486

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
mkasenberg pushed a commit to auto-pts/auto-pts that referenced this pull request Jun 28, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Corresponding PR to zephyrproject-rtos:
zephyrproject-rtos/zephyr#59486

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jun 28, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jun 28, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jul 3, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
PavelVPV added a commit to PavelVPV/zephyr that referenced this pull request Jul 4, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
carlescufi pushed a commit that referenced this pull request Jul 25, 2023
Virtual address behavior has been changed in this PR:
#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
m-alperen-sener pushed a commit to m-alperen-sener/sdk-zephyr that referenced this pull request Jul 25, 2023
…ual addresses

Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
(cherry picked from commit 4d56a31)
Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
m-alperen-sener pushed a commit to m-alperen-sener/auto-pts that referenced this pull request Jul 26, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it requires label uuid to be added before any message can be sent
and desired uuid should be passed to message context structure before
sending a message to a virtual address.

This change should fix MESH/NODE/NET/BV-02-C and MESH/NODE/TNPT/BV-05-C
failing tests.

For MESH/NODE/NET/BV-02-C the virtual address is added on hdl_wid_21 as
PTS asks the stack to provide known virtual address.

For MESH/NODE/TNPT/BV-05-C PTS gives the label uuid in the message,
therefore we need to add this address first before sending a message to
it.

Corresponding PR to zephyrproject-rtos:
zephyrproject-rtos/zephyr#59486

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
nordicjm pushed a commit to nrfconnect/sdk-zephyr that referenced this pull request Jul 26, 2023
…ual addresses

Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
(cherry picked from commit 4d56a31)
Signed-off-by: Alperen Sener <alperen.sener@nordicsemi.no>
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this pull request Jul 27, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

(cherry picked from commit 4d56a31)

Original-Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
GitOrigin-RevId: 4d56a31
Change-Id: I8d32b5d0bb9a9fa6983c1a3b5a8bab2529a4c2e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4716825
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
DRuffer-tmo pushed a commit to tmobile/DevEdge-IoTDevKit-ZephyrRTOS that referenced this pull request Jul 27, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
kunoh pushed a commit to kunoh/zephyr that referenced this pull request Aug 7, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
DRuffer-tmo pushed a commit to tmobile/DevEdge-IoTDevKit-ZephyrRTOS that referenced this pull request Aug 8, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos/zephyr#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
umarnisar92 pushed a commit to nisarumar/zephyr that referenced this pull request Aug 15, 2023
Virtual address behavior has been changed in this PR:
zephyrproject-rtos#57878

Now it is required to register virtual address before using it.

Corresponding PR to auto-pts:
auto-pts/auto-pts#961

Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants