Commit graph

180 commits

Author SHA1 Message Date
lly 6ca4ea1a1f ble_mesh: stack: Update some fast prov functions 2020-07-01 13:26:06 +00:00
lly 64e76ee019 ble_mesh: stack: Move fast prov functions to a single file 2020-07-01 13:26:06 +00:00
lly c8112454c3 ble_mesh: stack: Fix compile error when only proxy enabled
Also remove some redundant CONFIG_BLE_MESH_PROXY checks, because
when the following options are satisfied, the CONFIG_BLE_MESH_PROXY
option will be selected mandatorily.
2020-06-28 23:09:47 +00:00
Island 3266511582 Merge branch 'bugfix/ble_mesh_split_tinycrypt' into 'master'
Bugfix/ble mesh split tinycrypt

See merge request espressif/esp-idf!9098
2020-06-23 19:07:31 +08:00
Island 07b15b0d36 Merge branch 'bugfix/ble_mesh_get_node_with_name' into 'master'
ble_mesh: Get node info with pre-configured node name

Closes BMCI-88

See merge request espressif/esp-idf!9089
2020-06-23 19:04:06 +08:00
lly 763f3ace61 ble_mesh: Remove the previously added redundant aes files 2020-06-23 06:19:08 +00:00
lly 4ae7efb4c0 ble_mesh: Get node info with pre-configured node name
Also add a function to get the entry of the nodes table.

Closes https://github.com/espressif/esp-idf/issues/5397
2020-06-20 05:47:19 +00:00
lly 8bfccba598 ble_mesh: Check if subnet exists before updating beacon_sent
- Before updating the "beacon_sent" of a subnet, we need to check
  if the subnet still exists, especially for a Provisioner.
- Fix a bug which will cause Provisioner failed to send Secure
  Network Beacon if no device is provisioned
2020-06-20 05:32:13 +00:00
Island b2a0e63ca8 Merge branch 'bugfix/ble_mesh_remove_relay_dependency' into 'master'
ble_mesh: Remove relay option dependency

See merge request espressif/esp-idf!9024
2020-06-03 15:20:24 +08:00
Island ae2898f12e Merge branch 'bugfix/ble_mesh_rework_prov_pdu_len_check' into 'master'
ble_mesh: Rework prov pdu length check

See merge request espressif/esp-idf!8993
2020-06-03 15:10:14 +08:00
lly 5ced2206b4 ble_mesh: Remove relay option dependency
When the relay functionality of a node is not enabled, this
issue will cause the node failing to send messages to fixed
group.
2020-06-02 19:05:16 +08:00
Island bcbf2f2275 Merge branch 'bugfix/ble_mesh_model_recv_fix' into 'master'
Bugfix/ble mesh model recv fix

See merge request espressif/esp-idf!8988
2020-06-02 11:00:07 +08:00
lly c6e9d789b7 ble_mesh: Rework prov pdu length check 2020-06-01 20:44:52 +08:00
lly e41eae1b07 ble_mesh: correct the return type [Zephyr] 2020-06-01 14:08:21 +08:00
lly 8a8caebf51 ble_mesh: Optimize model recv operations [Zephyr]
Previously the model recv operation is a littl fuzzy.
With the changes, the model recv operation is splitted into:
- find op
- check app_idx
- check dst
- check length
- update info & handle message
2020-06-01 13:57:33 +08:00
lly 47609970db ble_mesh: Optimize some send & recv logs 2020-05-29 21:10:13 +08:00
lly 9aae4d3ba3 ble_mesh: Local model (un)subscribes group address 2020-05-29 09:40:19 +00:00
lly 2190c2c368 ble_mesh: Define a macro for invalid company id 2020-05-29 09:40:19 +00:00
lly 6768c2b7a1 ble_mesh: Check the result of creating timer 2020-05-27 09:30:34 +00:00
Island 3b85d4ef24 Merge branch 'bugfix/ble_mesh_sync_zephyr_fixes' into 'master'
Bugfix/ble mesh sync zephyr fixes

Closes BLEMESH-215

See merge request espressif/esp-idf!8912
2020-05-27 17:26:00 +08:00
Island d82f3372a0 Merge branch 'bugfix/ble_mesh_not_use_same_private_key' into 'master'
ble_mesh: Not using pre-initialized private key

Closes BLEMESH-214

See merge request espressif/esp-idf!8905
2020-05-27 17:25:39 +08:00
lly 0cfb6c138b ble_mesh: Transport tx fields overflow [Zephyr]
The transport segmented TX nack and seg_pending fields must be at least
6 bits to avoid overflow for 32 segment messages. This change rearranges
the seg_tx fields to gather all state flag fields in one byte, while
making the counter fields whole bytes.
2020-05-26 11:42:31 +08:00
lly f863a1b328 ble_mesh: Friend with unknown appkey [Zephyr]
Ensures that friend messages are enqueued, even if the packet is
received with an appkey is unknown to the friend. Previously, sdu_recv
would return EINVAL if the appkey was unknown, which would prevent the
lower transport layer from adding the packet to the friend queue. This
is irrelevant for the logic in lower transport, and should not be
returned as an error.
2020-05-26 11:16:01 +08:00
lly 05c287e05c ble_mesh: Not using pre-initialized private key 2020-05-26 10:46:22 +08:00
lly bbbdbb8699 ble_mesh: Same func for storing/restoring comp data 2020-05-25 13:27:08 +08:00
lly af37aee5bf ble_mesh: Fix Provisioner failed to publish 2020-05-22 15:32:12 +08:00
lly b1f3843ed6 ble_mesh: Clear two more vars during proxy server deinit 2020-05-20 11:35:26 +00:00
lly d5b126667a ble_mesh: Add missing sdkconfig.h 2020-05-20 11:35:26 +00:00
lly 4e60919a66 ble_mesh: Init device name during proxy server init
Device name will be reset when deinit mesh stack. If not
initializing device name during the next mesh stack init,
it will fail to set the device name when using bluedroid.
2020-05-20 11:35:26 +00:00
lly a0ce8c64b0 ble_mesh: Add init flag for friend init/deinit
Since bt_mesh_friend_init() will only be invoked when
a device is provisioned or Provisioner is enabled, so
we add a flag to indicate if the friend functionality
is initialized in case deinit before initialization.
2020-05-20 11:35:26 +00:00
lly 25a6ea9600 ble_mesh: Remove patch for the bug of an App 2020-05-14 10:24:15 +08:00
Island c946ca8b45 Merge branch 'bugfix/ble_mesh_node_old_version_to_new' into 'master'
ble_mesh: Fix mesh node device role restore

Closes BLEMESH-188

See merge request espressif/esp-idf!8314
2020-05-12 20:36:55 +08:00
Island 1d22f17da3 Merge branch 'bugfix/ble_mesh_not_ignore_msg_in_fast_prov' into 'master'
ble_mesh: Not ignore msg when fast prov is enabled

Closes BLEMESH-196

See merge request espressif/esp-idf!8698
2020-05-12 20:36:41 +08:00
lly f7ef701856 ble_mesh: Fix mesh node device role restore
Old version of BLE Mesh has no device role storage, because
previously we only support storing mesh node info.
If the binary of the node is upgraded from old version to a
new version (support storing provisioner info), the mesh info
of the node will not be restored because mesh role does not
exist in the flash.
2020-05-12 19:25:57 +08:00
lly 6b9c0dda08 ble_mesh: Fix typos 2020-05-12 16:23:13 +08:00
lly d937b415e3 ble_mesh: Not ignore msg when fast prov is enabled
When fast provisioning is enabled, Provisioner shall not
ignore messages from the nodes whose addresses are not in
the provisioning database. Because other nodes which are
not provisioned by the Primary Provisioner will send node
address messages to the Primary Provisioner.
2020-05-12 11:22:07 +08:00
lly c2fd80b8f4 ble_mesh: Fix not update prov addr in fast prov
When using fast provisioning, the Provisioner functionality
will be enabled. Unicast addresses within the pre-allocated
range will be used for provisioning nodes. And during the
address assignment, the allocated unicast address will be
checked that if it's duplicated with other nodes addresses
and the Provisioner's own addresses.
So before starting using fast provisioning, we need to update
the Provisioner address.
2020-05-11 02:29:18 +00:00
lly 97f11600e3 ble_mesh: net_key_status only pull one key idx [Zephyr]
Fixes bug where the config client's net_key_status handler would attempt
to pull two key indexes from a message which only holds one.
2020-05-11 02:29:18 +00:00
lly 9d7adc3e1b ble_mesh: Update client message timeout calculation
Since the behavior of sending segmented messages has been
changed properly, the calculation of timeout value which
will be used when sending an acknowledged message by a
client model also needs to be updated.
2020-05-11 02:29:18 +00:00
lly 5e59233cc0 ble_mesh: Add lock for segmented msg operations
Add mutex to protect some variables of the mesh segmented
messages.
Currently the timeout handler of mesh will be executed in
the btc task, while the received mesh messages will be
handled in the btu task. In case some variables are set to
NULL when handled in the btu task, meanwhile these variables
are also accessed in the timeout handler, so we add mutex to
protect these variables and related operations.
2020-05-11 02:29:18 +00:00
lly 9e5fec73f8 ble_mesh: Fix dereferencing pointer before checking for NULL [Zephyr]
The publication context is checked for NULL in bt_mesh_model_publish()
however it was dereferenced before that. Move the assignment to
ctx.send_rel to the same place where other ctx members are set.
2020-05-11 02:29:18 +00:00
lly d7a671ab7a ble_mesh: Optimize some mesh log output 2020-05-11 02:29:18 +00:00
lly 52493a1644 ble_mesh: Fix restore when revoke keys [Zephyr]
Store keys (NetKey and AppKey) again after revoking.
2020-05-11 02:29:18 +00:00
lly 8ea6714a96 ble_mesh: Spit mesh_util.h into different header files
Split mesh_util.h into mesh_byteorder.h, mesh_compiler.h,
mesh_ffs.h and mesh_util.h based on the classification of
Zephyr, which will make further porting more clear.
2020-05-11 02:29:18 +00:00
lly 52a30c8f4a ble_mesh: Split mesh os related into a separate file 2020-05-11 02:29:18 +00:00
lly 01a8a6c150 ble_mesh: Split mesh mutex into a separate file 2020-05-11 02:29:18 +00:00
lly c493be489f ble_mesh: Rename mesh_kernel.* to mesh_timer.* 2020-05-11 02:29:18 +00:00
lly 25dfee4bdd ble_mesh: Add and use transport macro definitions [Zephyr] 2020-05-11 02:29:18 +00:00
lly df525bf0b3 ble_mesh: Friend SeqAuth cleanup [Zephyr]
The Friend queue uses the message SeqAuth to determine whether the
message is already in the queue. To facilitate this, the SeqAuth is
passed around as a pointer throughout the transport modules. In the
bt_mesh_ctl_send functions, this parameter is also exposed in the API,
but the internal usage is inconsistent and buggy. Also, no one actually
uses this parameter.

- Removes seq_auth param from bt_mesh_ctl_send, instead passing NULL
  directly to the friend module, to enforce its addition to the queue.
- Makes the seq_auth pointer const throughout the friend module.
2020-05-11 02:29:18 +00:00
lly cd58874a9b ble_mesh: Rework msg_cache [Zephyr]
Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.
2020-05-11 02:29:18 +00:00