Commit graph

13144 commits

Author SHA1 Message Date
David Cermak 49e8c09ec2 local-ctrl: fix memory allocation issues found by static analyser 2020-05-13 07:16:45 +02:00
David Cermak 917192725a http-client: fix memory allocation issues found by static analyser 2020-05-13 07:16:45 +02:00
Ivan Grokhotkov 695f075a13 Merge branch 'bugfix/core_dump_data_struct_ovf' into 'master'
Fixes core dump data overwriting

See merge request espressif/esp-idf!8611
2020-05-13 04:03:29 +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
Island b0a096495a Merge branch 'bugfix/ble_mesh_fix_typos' into 'master'
ble_mesh: Fix typos

Closes BLEMESH-199

See merge request espressif/esp-idf!8703
2020-05-12 20:36:30 +08:00
Jiang Jiang Jian 84a410dc4c Merge branch 'bugfix/fix_switch_channel_without_discon_issue' into 'master'
esp_wifi: Fix AP switch to adjacent channel without disconnect

Closes WIFI-2192 and WIFI-2277

See merge request espressif/esp-idf!8657
2020-05-12 20:21:12 +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
Krzysztof Budzynski 08bd8bff7e Merge branch 'docs/mass_mfg_update' into 'master'
Fix a typo according to DOC-158

See merge request espressif/esp-idf!8704
2020-05-12 18:36:35 +08:00
lly 6b9c0dda08 ble_mesh: Fix typos 2020-05-12 16:23:13 +08:00
Wang Ning 5a28cc6ae3 Fix a typo according to DOC-158 2020-05-12 15:56:14 +08:00
Mahavir Jain bd920d22b0 Merge branch 'bugfix/softap_prov_session' into 'master'
protocomm_httpd: Restart security session if request is received on a new session

See merge request espressif/esp-idf!8633
2020-05-12 13:16:20 +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
Jiang Jiang Jian 5f2be35525 Merge branch 'bugfix/supplicant_general_fixes' into 'master'
wpa_supplicant: Fix some memleaks and invalid memory access

Closes IDF-1335

See merge request espressif/esp-idf!8201
2020-05-12 11:03:14 +08:00
Piyush Shah 05852bc4aa protocomm_httpd: Restart security session if request is received on a new session
This commit fixes a bug as well as changes a behaviour.

Bugfix: During softap/httpd based provisioning, if a session was closed
midway and a new one started, it would never proceed if the http server
assigns same socket number to the new session (which happens almost always).
Now, if a session is closed, using the http callbacks, the older session
data is cleared so that a new one can be created.

Behavioural change: If a client (mobile app particularly) does not use
persistent http session i.e. all provisioning communication on the same
socket, the provisioning may fail. Earlier, since the session context was
not getting cleared, even if the client closed a session and continued
on a new one, it would go through if the socket number assigned was same
(which happens almost always).

Ideally, from a security perspective, all communication related
to secure provisioning must happen on the same socket, and so, this
change is required.
2020-05-11 13:01:13 +00:00
Ivan Grokhotkov 0c0bfe73ec Merge branch 'feature/add_build_sh_to_build_system_test' into 'master'
Add idf_as_lib/build.sh to build_system_test

Closes IDF-1170

See merge request espressif/esp-idf!8540
2020-05-11 19:51:51 +08:00
Krzysztof Budzynski 1ad1791df7 Merge branch 'docs/eclipse_update' into 'master'
Update Build and Flash with Eclipse IDE to make terminology consistent

Closes DOC-112

See merge request espressif/esp-idf!8669
2020-05-11 16:51:31 +08:00
Wang Ning 8b8d03f7bd Update Build and Flash with Eclipse IDE to make terminology consistent 2020-05-11 16:51:30 +08:00
Mahavir Jain 012b111d6d Merge branch 'feature/mbedtls_hkdf' into 'master'
mbedtls_hkdf: Add a config option to enable HKDF

See merge request espressif/esp-idf!8680
2020-05-11 15:29:54 +08:00
Piyush Shah 43b3def711 mbedtls_hkdf: Add a config option to enable HKDF 2020-05-11 11:49:14 +05:30
Island c0c0223747 Merge branch 'bugfix/sync_zephyr_bt_mesh_bugfix' into 'master'
bugfix/sync_zephyr_bt_mesh_bugfix

Closes BLEMESH-178

See merge request espressif/esp-idf!8104
2020-05-11 14:06:12 +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
lly ef8206cdc6 ble_mesh: Segmented TX to groups [Zephyr]
Implements several changes to the transport layer segmented tx to
improve group message performance:
- Moves retransmit counter to tx context instead of per packet. As every
  unacked packet is sent every retransmit, the retransmit counters would
  be the same in each segment. This makes it easier to control progress.
- Delays the scheduling of the retransmit until the completion of the
  last segment by adding a seg_pending counter. This is essentially the
  same as the old behavior, except that the old behavior might retrigger
  the sending before all segments are finished if the advertising is
  slow.
- Allows the group transmits to stop as soon as all retransmits have
  been exhausted, instead of timing out waiting for acks that won't
  come. This allows group tx to finish without error.
- Fixes a bug where a failed TX would block IV update.
- Cancels any pending transmissions of acked segments.
- Reduces log level for several common group tx scenarios that aren't
  erronous.
2020-05-11 02:29:18 +00:00
lly fd9a16805a ble_mesh: Add comment explaining use of byte order [Zephyr]
Add comment that explains why a different byte order is used for the
3-byte opcode on the CID part of the opcode.
2020-05-11 02:29:18 +00:00
lly 4d1d5261cc ble_mesh: Use 24-bit functions [Zephyr]
Use 24-bit functions for byteorder and net_buf in order to make the
byteorder used more readable.
2020-05-11 02:29:18 +00:00
lly da99734ba8 ble_mesh: Optimize net_buf_simple routines [Zephyr]
Use sys_put_xyz() helpers instead of memcpy() whenever possible. This
brings in straight-line inline code for pushes and adds of known,
small sizes.
2020-05-11 02:29:18 +00:00
lly 4fd1b2db0e ble_mesh: Add PRIu64 & PRIx64 in mesh_types.h 2020-05-11 02:29:18 +00:00
lly fb84166cbd ble_mesh: Add push functions for supported bit-variants [Zephyr]
Add push functions for bit-widths supported by add and pull functions.
2020-05-11 02:29:18 +00:00
lly ee1eb994b7 ble_mesh: Add support for 64 bit data type [Zephyr]
This enables pulling and pushing values in 64 bit format.
2020-05-11 02:29:18 +00:00
lly b186be52f0 ble_mesh: Add support for 48 bit data type [Zephyr]
This enables pulling and pushing values in 48 bit format.
2020-05-11 02:29:18 +00:00
lly 23c8bbcbf5 ble_mesh: Add 48 bit variants [Zephyr]
This adds sys_*_*48 functions that operation on a 48 bits values.
2020-05-11 02:29:18 +00:00
lly 4e1d3974fb ble_mesh: Add support for 24 bit data type [Zephyr]
This enables pulling and pushing values in 24 bit format.
2020-05-11 02:29:18 +00:00
lly 26dbfdcb9d ble_mesh: Add 24 bit variants [Zephyr]
This adds sys_*_*24 functions that operation on a 24 bits values.
2020-05-11 02:29:18 +00:00
lly 95440c4d28 ble_mesh: Group resends in proxy nodes [Zephyr]
Resend transport segments for groups on the advertiser interface, even
if a connected proxy node holds the group.
2020-05-11 02:29:18 +00:00
lly 1f47cfff7f ble_mesh: Typo in condition in comp_add_elem of cfg_srv [Zephyr]
Vendor model IDs take up four (not two) bytes in the composition
2020-05-11 02:29:18 +00:00
lly 31b175e372 ble_mesh: GATT Proxy Spec 1.0.1 changes [Zephyr]
Backport of https://github.com/apache/mynewt-nimble/pull/724

Mesh spec 1.0.1 changes proxy disabling behavior to only affect the
relaying from proxy nodes. Previously, disabling proxy would shut down
all proxy and node activity.

Tweaks from the original commit:
- Removed redundant call to bt_mesh_adv_update() in gatt_proxy_set()
- Removed invalid ref to 4.2.11.1 in node_identity_set()

---

According to Mesh Profile Spec 1.0.1, Section 4.2.11:
"If the Proxy feature is disabled, a GATT client device can connect
over GATT to that node for configuration and control. Messages from
the GATT bearer are not relayed to the advertising bearer."

Moreover some notes have been removed from the spec compared to
version 1.0:

Mesh Profile Spec 1.0, Section 4.2.11:

"Upon transition from GATT Proxy state 0x01 to GATT Proxy state 0x00
the GATT Bearer Server shall disconnect all GATT Bearer Clients."

"The Configuration Client should turn off the Proxy state as the last
step in the configuration process."

Mesh Profile Spec 1.0, Section 4.2.11.1:

"When the GATT Proxy state is set to 0x00, the Node Identity state
for all subnets shall be set to 0x00 and shall not be changed."
2020-05-11 02:29:18 +00:00
lly e385197c27 ble_mesh: Support reliable sending when publishing [Zephyr]
Until now the choice of reliable sending (segmented messages with
acks) was implicitly dependent on the size of the payload. Add a new
member to the bt_mesh_model_pub to force using segment acks even when
the payload would fit a single unsegmented message.
2020-05-11 02:29:18 +00:00