Commit graph

21541 commits

Author SHA1 Message Date
Joakim Andersson
d9a89fb40b Bluetooth: host: Fix packet reording in ATT under high load
Fix packet reordering in ATT when putting the host under high load.
In certain conditions a packet can be transmitted while there is
elements in the TX queue in bt_att_send. This means that the packet will
skip ahead in the TX queue leading to packet re-ordering.

Fix by always appending to the queue, and then initiate sending of the
HEAD of the queue.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-04-01 13:07:47 +03:00
Anas Nashif
0ec3774bde userspace: rename _is_user_context -> k_is_user_context
This functions is being called across the tree, no reason why it should
not be a public API.

The current usage violates a few MISRA rules.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-04-01 05:34:17 -04:00
David Leach
3f0da93902 subsys/modbus: Fix potential memory overwrite (coverity)
The size of ctx->rx_adu.data is not CONFIG_MODBUS_BUFFER_SIZE. Coverity
flagged the potential overwrite so just use sizeof().

Fixes #33789
Fixes #33792
Fixes #33818

Signed-off-by: David Leach <david.leach@nxp.com>
2021-04-01 04:52:10 -04:00
David Leach
f2d8b4cc94 logging: log_backend_fs: Fix check for error on fs_sync() - coverity
Fixes #33791

Signed-off-by: David Leach <david.leach@nxp.com>
2021-04-01 04:52:10 -04:00
Jani Hirsimäki
bd40cb48d9 net: socket: packet: using pckt sckt for passing the PPP dialup data
With these changes, dial up Zephyr application/driver can use
socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW) for creating
a socket for sending/receiving data to/from ppp net link, i.e.
packet is going to/from PPP L2.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-04-01 09:43:56 +03:00
Jani Hirsimäki
5d76e8aca8 net: ppp: dialup enablers
Introducing PPP dialup features to enable e.g. usage of nrf9160
based board as a dialup modem for transferring ip data over PPP
 (e.g. windows dial up), i.e. usage of Zephyr PPP as a server for
 providing MTU/MRU, IP address and DNS addresses for a PC:
- PPP LCP MRU option (configurable)
- PPP server: IPCP ip and dns address peer options to enable
providing IP and DNS addresses for PPP peer.

Signed-off-by: Jani Hirsimäki <jani.hirsimaki@nordicsemi.no>
2021-04-01 09:43:56 +03:00
Benjamin Lindqvist
e3f8757b70 net: lwm2m: Allow cancel-observe to match path
The specification states that the server can cancel observations "at any
moment, by sendinga GET request with Observe option=1, the LwM2M Server
cancancel an “Observe”operation on a specified Resource, or specified
Object Instance(s)."

It does not mention any token matching requirement, but RFC 7641 does.
The correct interpretation is not obvious. The EMQx LwM2M implementation
uses a new token for instance, which does not work with Zephyrs token
matching cancel-observe.

This commit introduces cancel-observe via path matching as a Kconfig
option. This could hypothetically introduce problems when we are
connected to multiple peers simultaneously, but since that is not likely
to be supported for a long time (if ever), this change should be fairly
uncontroversial since path matching is only used as a fallback.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2021-04-01 09:42:56 +03:00
Flavio Ceolin
98170586e1 power: Fix unbalanced scheduler lock
Commit 58a0ba6dbb removed the call to k_sched_unlock from
pm_system_resume() consequently the scheduler lock in
pm_power_state_force() was left unbalanced. Just fixing it.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-31 12:09:48 -04:00
Carlo Caione
3539c2fbb3 arm/arm64: Make ARM64 a standalone architecture
Split ARM and ARM64 architectures.

Details:

- CONFIG_ARM64 is decoupled from CONFIG_ARM (not a subset anymore)
- Arch and include AArch64 files are in a dedicated directory
  (arch/arm64 and include/arch/arm64)
- AArch64 boards and SoC are moved to soc/arm64 and boards/arm64
- AArch64-specific DTS files are moved to dts/arm64
- The A72 support for the bcm_vk/viper board is moved in the
  boards/bcm_vk/viper directory

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2021-03-31 10:34:33 -05:00
Robert Lubos
bed1dc26f1 net: sockets: tls: Fix poll() handling during the handshake
Current implementation of poll prepare/update could end up busy looping
if `poll()` function was called before/during DTLS client handshake
(i. e. `poll()` called before an initial `send()`).

Fix this, by monitoring the handshake semaphore, already available in
the tls_context structure for DTLS client instead of underlying socket.
After the handshake is complete, switch to monitoring the underlying
socket instead.

For DTLS server this is not needed, since the handshake is initiated in
the `recv()` function, therefore any incoming data should trigger the
handshake.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-31 08:06:30 -04:00
Vinayak Kariappa Chettimada
6d78016858 Bluetooth: controller: Fix event abort on delayed start
Fix the calculation of event delay when starting a radio
event. The calculation and check was incorrect causing
event abort when radio event was setup before the preempt
timeout by the lll_done when the next prepare was already
in the pipeline.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-31 11:18:42 +02:00
Morten Priess
7a79f1a73c Bluetooth: controller: Support for multiple CISes in a CIG
When a CIS indication is received and CIG ticker is already started,
calculate the absolute time of the first subevent of the new CIS,
and validate the handle. This will allow the LLL prepare to see a new
valid CIS, and calculate the offset within the CIG event, where the new
CIS should start. This offset is then valid for all following events for
the duration of the CIS.

Signed-off-by: Morten Priess <mtpr@oticon.com>
2021-03-31 11:18:27 +02:00
Piotr Pryga
060d34d4a7 Bluetooth: controller: ULL: Fix DF build error if CTE Tx is disabled
Add missing #if defined(CONFIG_BT_CTLR_DF_ADV_CTE_TX) statements
to fix build errors of Direction Finding code when
the CONFIG_BT_CTLR_DF_ADV_CTE_TX Kconfig entry is not set.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-03-31 11:18:13 +02:00
Piotr Pryga
b4e188653e Bluetooth: controller: Enable GPIO debug pins for nrf52833 DK
Enable possiblity to use debug pins for controller debugging
purposes with nrf52833dk_nrf52833 board.

Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
2021-03-31 11:17:58 +02:00
Rubin Gerritsen
1cd97a8a74 bluetooth: controller: radio: Fail if PPI/DPPI header not present
The hal requires one of these to be present.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
2021-03-31 11:15:14 +02:00
Aurora Sletnes Bjørlo
4600fadf2b bluetooth: controller: radio: Split radio_nrf5_ppi.h
Splits the file into radio_nrf5_ppi.h and radio_nrf5_dppi.h
and moves the nRF53 DPPI to radio_nrf5_dppi.h.

Signed-off-by: Aurora Sletnes Bjørlo <aurora.sletnes@nordicsemi.no>
2021-03-31 11:15:14 +02:00
Aurora Sletnes Bjørlo
dfe8d32aec bluetooth: controller: radio: Use HAL API in radio_nrf5_ppi
Rewrite to use subscribe and publish functions for the
different peripherals. This will make it possible to test
the controller in a simulator.

Signed-off-by: Aurora Sletnes Bjørlo <aurora.sletnes@nordicsemi.no>
2021-03-31 11:15:14 +02:00
Francois Ramu
58a0ba6dbb power: unlock the scheduler in the pm_system_suspend
move k_sched_unlock from the pm_system_resume
to the the pm_system_suspend.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-03-30 15:38:06 -04:00
Vinayak Kariappa Chettimada
ab5d8432d3 Bluetooth: controller: Fix PHY Update procedure checks
Fix PHY update procedure to check transaction violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
03fa38aa7e Bluetooth: controller: Fix ping procedure checks
Fix ping procedure to check transaction violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
f8cec621d2 Bluetooth: controller: Fix data length update procedure checks
Fix data legnth update procedure to check transaction
violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
fa95660b63 Bluetooth: controller: Fix reject extended indication checks
Fix reject extended indication PDU dispatch to check
transaction violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
ef9e429228 Bluetooth: controller: Fix unknown control PDU checks
Fix unknown control procedure handling to check transaction
violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
9cb8b0af89 Bluetooth: controller: Fix Feature Exchange checks
Fix Feature Exchange procedure to check transaction
violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Vinayak Kariappa Chettimada
fb5b5b7069 Bluetooth: controller: Add control procedure lock
Add control procedure lock flag to detection procedure
transaction violations.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 19:42:46 +02:00
Emil Gydesen
929aec19ed Bluetooth: services: Fix ID check for bt_gatt_ots_obj_manager_obj_get
The ID validation check would always fail with IDs less than
OTS_OBJ_ID_START_RANGE, where the intention was that it should
allow the OTS_OBJ_ID_DIR_LIST (0) value as well if
CONFIG_BT_OTS_DIR_LIST_OBJ was enabled.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-03-30 11:01:06 -04:00
Dominik Ermel
f4b6231a9d usb/dfu: Pick DFU target image label from DTS
Instead of defining the string, that will be reported by DFU
as a name for DFU target, in code, pick it from the DTS label that
will be the DFU target.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-30 09:01:20 -05:00
Dominik Ermel
73b29d68e7 usb/dfu: Removed unused NUMOF_ALTERNATE_SETTINGS
Alternative settings are determined by number of flash partitions
available for DFU from DTS.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-30 09:01:20 -05:00
Hubert Miś
a41a3b703d net: ip: select src ip address with valid scope for mcast dst
IPv6 source address selection procedure selected link-local address
for any muticast destination with other scope than mesh-local. It
was a cause of problems for broader multicast scopes like admin-, or
site-local. For such broader scopes source address must be at least
as broad as the scope of multicast destination.

This patch updates IPv6 source address selection procedure. Now
link-local address is selected only for link-local destinations,
including multicast destinations. For broader destination scope,
source address with broader scope is selected.

Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
2021-03-30 15:57:43 +03:00
Enjia Mai
95cddd4df7 testsuite: utils: move the interrupt_util.h into testsuite
The interrupt_util.h provides utils of trigger irq, now move them into
testsuite. All of the needed test cases can make use of them.

Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
2021-03-30 08:18:23 -04:00
Joakim Andersson
b6323abaad Bluetooth: host: Fix missing big_disconnect when invalid number of BIS
Fix missing big_disconnect in hci_le_big_complete when the number of
BIS in the event is invalid.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-30 08:17:22 -04:00
Joakim Andersson
f4477df803 Bluetooth: host: Validate big_handle before using it as an array index
Validate the big_handle before received from the controller before
using it as an array into the bigs array.

Discover by coverity: Insecure data handling  (TAINTED_SCALAR)
  Using tainted variable "big_handle" as an index into an array "bigs".

Cleanup state of BIG in pending or syncing state if it exists.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-30 08:17:22 -04:00
Joakim Andersson
c9aa26efe2 Bluetooth: host: Fix parsing BIG handle as a two byte field
Fix parsing BIG handle which is just one octet as a two octet field,
which could have caused problems on big-endian systems.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-30 08:17:22 -04:00
Joakim Andersson
1f1c6c097e Bluetooth: host: Refactor BIG initialized handling to use bit flags
Refactor the BIG initialized atomic handling to use bits instead of a
single atomic.
This allows for more bit flags to be added.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-03-30 08:17:22 -04:00
Vinayak Kariappa Chettimada
77cfd3cf52 Bluetooth: controller: Fix race in create connection cancel
Fix race conditional when create connection cancel is called
and actually a connection did get setup while initiator is
being stopped.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 14:04:23 +02:00
Vinayak Kariappa Chettimada
34451a9970 Bluetooth: controller: Conditional compile adv addr used by initiator
Conditional compile adv_addr which is only used by
controller when supporting initiator/central role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 14:04:23 +02:00
Vinayak Kariappa Chettimada
b2e802b018 Bluetooth: controller: Move initiated flag into role specific union
Move the initiated bit flag into role specific union, so that
other role specific bit flags can share bit space in the LLL
context structure.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 14:04:23 +02:00
Vinayak Kariappa Chettimada
cd798202cb Bluetooth: controller: Fix flash driver sync regression
Fix flash driver sync regression introduced due to changed
default ULL_HIGH in the commit 30634334a8 ("Bluetooth:
controller: Fix ULL_HIGH priority to be lower than LLL").

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 10:55:36 +02:00
Vinayak Kariappa Chettimada
433fad53bf Bluetooth: controller: Remove duplicate radio_isr_set call
Remove the redundant radio_isr_set function call.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 10:54:51 +02:00
Vinayak Kariappa Chettimada
0df70608a7 Bluetooth: controller: Fix SyncInfo with correct event counter
Fix Periodic Advertising SyncInfo structure to be filled
with correct event counter value considering accumulated
latency and ticker lazy value.

Fixes #32860.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 10:54:23 +02:00
Vinayak Kariappa Chettimada
f708f861bc Bluetooth: controller: Ticker next slot get to return lazy value
Updated ticker implementation to return lazy value for a
ticker when enumerating active tickers with time
reservations.

This is required to find offsets and to use the lazy value
to correctly calculate event and payload counter values that
needs to be filled into SyncInfo and BigInfo structures.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2021-03-30 10:54:23 +02:00
James Harris
59a3def756 net: utils: fix strlen issue in net_addr_pton
Previously, a non null-terminated "string" could
be passed to z_impl_net_addr_pton if the string was
exactly `INET6_ADDRSTRLEN` long.

Signed-off-by: James Harris <james.harris@intel.com>
2021-03-29 16:22:58 -05:00
Dominik Ermel
f47334aa15 mgmt/mcumgr: Fixing use of k_fifo function on net buf
Fixing problem where k_fifo functions have been used to get/put
data from/info net buf, where documentation has been strictly
forbidding so.

Found, reported and solution suggested by jrhees-cae.

Fixes: #32579

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-03-29 16:13:38 -05:00
Andrzej Puzdrowski
45449c7b84 storage: remove flash_write_protection_set() usage
This patch removes scenario which was testing deprecated
API behaviors. Needed as As flash_write_protection_set() was
deprecated and became no-operation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
1a6492d8b3 fs/nvs: removed unneeded if statements
Removed two unneeded `if` statements. These statements had not
effect in function results.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Andrzej Puzdrowski
9ea02a39ee fs/nvs: remove flash_write_protect_set() usage
flash_write_protection_set() was deprecated.
This patch removes usage of it and the test case which was
testing deprecated API behaviors.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2021-03-29 13:43:55 -04:00
Robert Lubos
539e4edcc6 net: lwm2m: Remove obsolete LWM2M_IPSO_TIMESTAMP_EXTENSIONS option
All IPSO objects that utilized the non-standard timestamp extension now
implement their model in version 1.1, which contains the Timestamp
resource. As it's no longer needed to add timestamp in a non-standard
way, simply remove LWM2M_IPSO_TIMESTAMP_EXTENSIONS option.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-29 13:42:11 -04:00
Robert Lubos
1efc8e7353 net: lwm2m: Add IPSO Buzzer object in version 1.1
Update IPSO Buzzer object implementation to support object model
version 1.1.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-29 13:42:11 -04:00
Robert Lubos
885dd5ff1f net: lwm2m: Add IPSO Push Button object in version 1.1
Update IPSO Push Button object implementation to support object model
version 1.1.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-29 13:42:11 -04:00
Robert Lubos
8853730dec net: lwm2m: Add IPSO On/Off Switch object in version 1.1
Update IPSO On/Off Switch object implementation to support object model
version 1.1.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2021-03-29 13:42:11 -04:00