Commit graph

21541 commits

Author SHA1 Message Date
Joakim Andersson
becd9cadfe Bluetooth: host: Fix option USE_IDENTITY for bt_le_ext_adv_* API
Fix option USE_IDENTITY for bt_le_ext_adv_* API.
The random static identity address that was set in bt_le_ext_adv_create
was overwritten in bt_le_ext_adv_start in the call to
le_adv_set_private_addr.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-09-01 13:28:56 +02:00
Peter Bigot
9024669a67 testsuite: fix unittest cross-language flags
Unit tests may include C++ code, so ensure the compiler flags are
consistent to avoid link errors.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-31 11:02:35 -04:00
Andrzej Głąbek
8e5afef6da bluetooth: controller: nrf5: Add support for nRF52805
Add the nRF52805-specific file with radio related defintions.
Use also specific configurations for certain PPI channels used by
the controller, as this SoC has limited number of programmable PPI
channels.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Andrzej Głąbek
89c7588917 bluetooth: controller: nrf5: Refactor a bit radio_nrf5_ppi.h
Change hard-coded (D)PPI channel bitfield values to the BIT() macro
calls with the corresponding channel base value supplied as parameter,
to make it possible to actually change this base value if needed.
Remove unused *_EXCLUDE macros.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2020-08-31 15:40:19 +02:00
Vinayak Kariappa Chettimada
293aa54ef3 Bluetooth: controller: Revert back to using EGU in nRF5340PDK
Refer to nRF5340 Engineering A Errata 29.
[29] SWI: SWIRQ is not functional.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:35 +02:00
Vinayak Kariappa Chettimada
5a40aa073d Bluetooth: controller: nRF53: Use SWI instead of EGU
nRF5340 does have SWI peripheral, hence use it instead of
the single available EGU peripheral. Use of SWI will allow
controller's LLL, ULL_HIGH and ULL_LOW execution context to
be independently configured to different interrupt priority
levels.

When ULL_HIGH priority equals ULL_LOW priority, only SWI2
is used by controller. Otherwise, SWI3 is used for ULL_LOW.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:35 +02:00
Vinayak Kariappa Chettimada
13bbfc8172 Bluetooth: controller: Handle AD data set race condition
Detect and handle AD data set race condition between thread
and ISR context.

Fixes #27637.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada
530c090cba Bluetooth: controller: Add cpu_dsb hal interface
Add cpu_dsb() hal interface so that data synchronization
barrier be used in ARM Cortex M4 and M33 architecture
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada
c0950dc35d Bluetooth: controller: Add volatile to AD data double buffer index
Set the AD data double buffer first index as volatile
because it is modified in LLL ISR context.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada
8b2024e26c Bluetooth: controller: Add code to detect AD data set race
Added code to detect AD data set race condition.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:49:13 +02:00
Vinayak Kariappa Chettimada
58620ec5a7 Bluetooth: controller: Review rework use HCI defines
Use HCI error and command parameter defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
139fbb0f4d Bluetooth: controller: Add sync info structure fill function
Refactor out into function the filling of sync info
structure in the common extended advertising payload format
header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
c85786ff6f Bluetooth: controller: Add aux ptr fill function
Refactor out into function the filling of aux ptr structure
in the common extended advertising payload format header.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
4a2300d2da Bluetooth: controller: Add common header len get/fill function
Refactor out into functions the calculation of common
extended advertising payload format header length.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
3abe58e7f1 Bluetooth: controller: Refactor to allow code reuse
Moved the assignment of PDU length out side of a conditional
so that code to calculate PDU length can be reused.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
3120cddb47 Bluetooth: controller: Refactor out AD data population
Refactor out AD data population to use the common function
ull_adv_aux_hdr_set_clear.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Vinayak Kariappa Chettimada
f69d9ed515 Bluetooth: controller: Refactor sync info population
Refactor out sync info field population into a utility
function with set and clear interface to add or remove
the common extended advertising header format fields.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-31 13:47:36 +02:00
Gerson Fernando Budke
9974a2a76a mgmt: updatehub: Fix possible deref an uninitialized ptr
There are several references to objects[1] at updatehub_probe function.
The structures are decoded from json, and have a maximum length of 2.
However, if the returned json only has a single element in this array,
this objects[1] value will be uninitialized. Because the structure
contains pointers, these will be uninitialized, causing the code to
reference uninitialized memory as pointers.

Add zeroing memory before passing it to the JSON API and do check if
objects_len field is two.

Fixes #27718.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
2020-08-31 13:04:36 +02:00
Trond Einar Snekvik
3c8e5b0e1c Bluetooth: Mesh: Network loopback
Changes the local network interface to exclusively handle packets for
the local interface, duplicating the buffers in the process.

The loopback mechanism now operates its own packet pool for the local
interface queue. The loopback is moved ahead of encryption, allowing the
local interface packets to go back up the stack without network crypto,
saving a full round of encrypt/decrypt for self-send.

Packets for group addresses the local node subscribes to are now
duplicated, with one unencrypted variant going into the network
queue, and the network bound packets following the regular path to the
advertiser.

Introduces one new configuration for setting the number of loopback
buffers.

Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
2020-08-30 17:09:59 +03:00
chao an
00d1408a14 Bluetooth: host: fix build break if enable oob legacy pair only
enable CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY:

In function `bt_le_oob_get_local':
subsys/bluetooth/host/hci_core.c:8878:
		undefined reference to `bt_smp_le_oob_generate_sc_data'

Signed-off-by: chao an <anchao@xiaomi.com>
2020-08-28 12:23:56 +03:00
Jukka Rissanen
6493af2714 tests: net: dns: Add tests for catching malformed packets
Add more tests to verify that we discard malformed packets.
In order to simplify the testing, separate message validation to
dns_validate_msg() function in resolve.c. Allow that function to
be called from unit test. This way we can construct invalid DNS
messages in unit test and verify that they are discarded when
needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Jukka Rissanen
50def60b4e net: dns: Verify that DNS id and flags can be read
The DNS message must be long enough for id and flags fields.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Jukka Rissanen
1dad77f41c net: dns: Parse individual labels in CNAME properly
The ANCOUNT has nothing to do with label count so remove the
original while loop and just go through all the labels until
we have read all of them.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Jukka Rissanen
214da19b27 net: dns: Fix next answer position when parsing packet
As the answer might not be compressed, calculate next answer
position correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Jukka Rissanen
c7441c9d0b net: dns: Verify that response is not too short
Make sure that IP address information is found in the received
message.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Jukka Rissanen
f4f340e9f1 net: dns: Check that we do not access data past msg size
This is not possible with valid DNS messages but is possible if
we receive malformed DNS packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 08:05:52 -04:00
Flavio Ceolin
9337b782d1 bluetooth: Fix a fallthrough warning
It fixes:

../../../../include/toolchain/gcc.h:169:30: warning: statement will
never be executed [-Wswitch-unreachable]

  169 | #define __fallthrough        __attribute__((fallthrough))

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-27 07:02:40 -04:00
Ryan Erickson
2ce87da252 net: lib: lwm2m: add new sensor objects
Add generic, humidity and pressure sensor objects.

Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
2020-08-27 11:01:09 +03:00
Jukka Rissanen
2ba4d5c2f0 net: socket: packet: Add support to SOCK_DGRAM packet sockets
Allow user to create SOCK_DGRAM type AF_PACKET socket. This
allows user to send raw IP packets without specifying
L2 (like Ethernet) headers.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 10:56:06 +03:00
Jukka Rissanen
3d8bae814e net: gptp: Fix field ordering in gptp_priority_vector struct
The steps_removed field must be placed right after root_system_id
so that priority vector comparision can be done in one memcmp()
call. This fixes the best master clock selection algorithm (BMCA).

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-08-27 10:53:57 +03:00
Andrew Boie
d650b4e800 ztest: remove ztest_mem_domain
Just add ztest's partition to the default domain, as well as the
malloc partition if it exists.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2020-08-26 20:35:02 -04:00
Jingru Wang
dae250472f gcov: Add coverage support for arc qemu platform
* add toolchain abstraction for coverage
* add select HAS_COVERAGE_SUPPORT to kconfig
* port gcov linker code to CKake for arc

Signed-off-by: Jingru Wang <jingru@synopsys.com>
2020-08-26 12:32:39 +02:00
Emil Gydesen
c5636508d4 Bluetooth: host: Deleting PA sync before term callback
The PA sync is now "deleted" (i.e. flags reset) before
the terminated callback is called, so that is
possible to create PA sync in the callback. One flag
was already cleared before for this reason, but one
other flag is also required, so we just clear
everything now.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-26 12:31:59 +02:00
Emil Gydesen
4ee327461f Bluetooth: host: PA sync while explicitely scanning
Removed the check for explicit scanning, such that
an application may create a PA sync while explicitely
scanning.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-26 12:31:59 +02:00
Eug Krashtan
bb378c7201 net: coap: Use MQTT style wildcard in path description:
In 'struct coap_resource' path description:
- the plus symbol represents a single-level wild card in the path;
- the hash symbol represents the multi-level wild card in the path.

This change keeps compatibility with RFC 7252 but allows handling
multiple requests in single function.

Signed-off-by: Eug Krashtan <eug.krashtan@gmail.com>
2020-08-26 12:31:00 +02:00
Vinayak Kariappa Chettimada
b5dba35727 tests: Bluetooth: shell: Fix conditional compilations
Fix conditional compilations that fail when combinations
of Broadcaster, Observer, Peripheral and/or Central are
selected to build an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
2a3e86a2fd Bluetooth: controller: Fix conditional compilations
Fix conditional compilations that fail when combinations
of Broadcaster, Observer, Peripheral and/or Central are
selected to build an application.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
be1b634193 Bluetooth: controller: Fix BT_CTLR_SCAN_REQ_NOTIFY dependency
Fix BT_CTLR_SCAN_REQ_NOTIFY as depends on BT_BROADCASTER.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Vinayak Kariappa Chettimada
e8e7ccb448 Bluetooth: controller: Fix Adv Set Terminated event cond. compile
Fix the conditional compilation of Advertising Set Terminated
event implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2020-08-25 16:38:12 +03:00
Joakim Andersson
5880f3d74f Bluetooth: UUID: Use BT_UUID_16_ENCODE to set UUIDs in adv data
Use BT_UUID_16_ENCODE to set UUIDs in advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-08-25 16:09:22 +03:00
Emil Gydesen
689f3b2bc8 Bluetooth: host: per_adv_sync auto scan fixed for central role
If `CONFIG_BT_CENTRAL` was enabled and the device was not scanning
or connected, then `bt_le_per_adv_sync_create` would not start
scanning for periodic advertisers.

Signed-off-by: Emil Gydesen <emil_gydesen@bose.com>
2020-08-25 15:50:32 +03:00
Lingao Meng
a574d4c840 Bluetooth: Mesh: Enhancement prov segment received
Optimize provisioning segment package received, and
not ignore non-begin segment.

Signed-off-by: Lingao Meng <mengabc1086@gmail.com>
2020-08-25 15:48:56 +03:00
Kim Sekkelund
41842dd174 Bluetooth: host: GATT Lazyloading cleanup at disconnect
Mark the ram version of the ccc_cfg as free after ccc has been
stored when a bonded device disconnects.
If the device use lazy loading of settings then ccc_cfg was not
cleaned up properly when a bonded device disconnects. This
resulted in the ccc system ran out of ccc_cfg resources after
having disconnected CONFIG_BT_MAX_CONN times.

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
2020-08-25 15:40:31 +03:00
Kim Sekkelund
29b42c5a2f Bluetooth: host: GATT Relocate bt_gatt_disconnected
Step1: Move bt_gatt_disconnected() to avoid forward declarations which
otherwise would be needed by a fix to lazy loading cleanup on
disconnect in step 2.

Signed-off-by: Kim Sekkelund <ksek@oticon.com>
2020-08-25 15:40:31 +03:00
Luiz Augusto von Dentz
426fb82bd8 Bluetooth: ATT: Fix not restoring buffer state when send fails
Since bt_l2cap_send_cb can fail returning its error is not enough as
the buffer has been modified to add the headers, so this save the state
before calling bt_conn_send_cb and takes a reference so it can be
restored its original state in case of error.

Fixes #27434

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2020-08-25 15:22:07 +03:00
Henrik Brix Andersen
c64e0ce923 disk: sdhc: spi: leave SPI CS GPIO handling to the SPI controller driver
Leave the SPI CS GPIO handling to the SPI controller driver and make SPI
CS GPIO optional for SDHC disk access via SPI.

The SPI SDHC implementation relies on SPI_HOLD_ON_CS so we need to
explicitly release the SPI controller driver after ending transmissions
to force the CS line to be de-asserted.

Fixes #27444.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-25 10:07:53 +02:00
Flavio Ceolin
0aaae4a039 guideline: Make explicit fallthrough cases
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2020-08-24 20:28:47 -04:00
Daniel Leung
49206a86ff debug/coredump: add a primitive coredump mechanism
This adds a very primitive coredump mechanism under subsys/debug
where during fatal error, register and memory content can be
dumped to coredump backend. One such backend utilizing log
module for output is included. Once the coredump log is converted
to a binary file, it can be used with the ELF output file as
inputs to an overly simplified implementation of a GDB server.
This GDB server can be attached via the target remote command of
GDB and will be serving register and memory content. This allows
using GDB to examine stack and memory where the fatal error
occurred.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-08-24 20:28:24 -04:00
Andrzej Kaczmarek
3006dac9ae Bluetooth: controller: Add privacy handling for LE Scan Request Recv
Scanner address returned in event should be resolved, if possible.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00
Andrzej Kaczmarek
bca3560100 Bluetooth: controller: Use set handle for LE Scan Request Received
Set handle is passed in node_rx header.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
2020-08-24 13:28:31 +02:00