Moving the key check after checking that no pairing or encryption
procedure is started fixes a race condition that is seen in some PTS
tests:
GATT/CL/GAR/BI-04-C
GATT/CL/GAR/BI-16-C
GATT/CL/GAR/BI-21-C
GATT/CL/GAW/BI-05-C
GATT/CL/GAW/BI-12-C
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The ieee802154_frame_retry will be set by the OpenThread integration
layer in the event of frame retransmission.
Signed-off-by: Rafał Kuźnia <rafal.kuznia@nordicsemi.no>
Some centrals deal poorly with receiving a security request immediately
after reconnection whenever reconnecting with characteristics that are
notifiable or indicatable and requiring security. In particular,
Android 9 and earlier devices may lose bond information when this
happens, some Microsoft Surface devices will enter an invalid state
and, on top of that, Apple's Bluetooth Low Energy guidelines explicitly
discourage this behavior.
In order to allow interoperability with those devices, make the GATT
automatic security request sending as a peripheral optional by
introducing a new Kconfig option, BT_GATT_AUTO_SEC_REQ.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add the option to send logs to fs backend using new dictionary
formatting
This can result in much better use of filesystem space
Signed-off-by: Elliot Revell-Nash <elliot.revell-nash@wdtl.com>
When the Bluetooth stack is configured for CONFIG_BT_MAX_CONN > 1
the oldest key might currently be in use. Fix the logic to ensure the
oldest key overwritten is from the set of keys currently not in use.
Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/35999
Signed-off-by: Faisal Saleem <faisal.saleem@setec.com.au>
Signed-off-by: Nick Ward <nick.ward@setec.com.au>
This commit makes C++ exception handling feature depend on the full
version of newlib (i.e. `CONFIG_NEWLIB_LIBC_NANO=n`).
The `nano.specs`, which selects the nano variant of newlib, libstdc++,
and libsupc++, does not support C++ exception handling because its
lib*c++ is compiled with `-fno-exceptions`.
For more details, refer to the issue #35972.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Fill the ACK timestamp field in nRF5 driver. This is required by
OpenThread for the proper CSL transmitter functioning.
Signed-off-by: Eduardo Montoya <eduardo.montoya@nordicsemi.no>
Fixed mutli-IP DNS resolution as previously the same IP address was
used to populate all AI entries and added DNS_RESOLVER_AI_MAX_ENTRIES
config entry to define max number of IP addresses per DNS name to be
handled.
Signed-off-by: Ievgen Glinchuk <john.iceblink@gmail.com>
This commit address Erratum E10395 and Errata Correction E16350
to ensure that public keys exchanged between Provisioner and
a device aren't identical.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Unmask events related with CTE report for Direction Finding
working in connected mode.
The feature is enabled conditionally, depending on KConfig
configuration provided.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Add Kconfig option that will enable support for CTE reception
in connected mode. Thanks to that it will be possible to
conditionally enable or disable support of the feature and
decrease code size if the feature is not required.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Remove the bt_conn pointer from the VOCS API, as the
instance pointer is enough to determine if it is a client
and perform client operations on the cached connection pointer.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Modify vocs.c to use the bt_vocs struct instead of the
bt_vocs_server struct. This is done so that there is less
difference between the internal struct usage and the struct
type used in the API.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Added an API to the HCI header that can be used to retrieve
advertising handle information from a given advertising set.
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
Remove unneccesary limit of host to controller packets by the host ISO
buffers and host pending buffers with TX callback.
The host always allocates the buffer before taking the semaphore so this
is already handled by the size of the host buffer pool and the
functionality of the buffer pools to wait for buffers.
In addition the ACL max limit is using the wrong define, as
CONFIG_BT_CONN_TX_MAX is the maximum amount of callback contexts for
transmitting. So the host can have more pending packets than this value.
This is also inconsistent with how the host would handle the V1 reply.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit implements the microphone input control service
(MICS) and client, The implementation supports and uses the
Audio Input Control Service (AICS) secondary service.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Adds a new callback structure to `<gatt.h>` for receiving notifications
of ATT MTU updates. This callback is called regardless of whether the
MTU update was initiated locally or remotely.
Fixes#32035.
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
Use IE variable of ieee802154 MAC frame instead of Thread specific
configuration call for configuring injection of vendor specific
data into enh ack.
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
this has a number of advantages:
- allows to only create notifications for each client if there are no
messages already waiting to be send, in practice prioritizing the
memory for messages for answers, thus staying more "responsive".
- saves a fair bit of memory by eliminationg now redundant client_ctx
pointer per observer.
- fixes a potential subtle bug: previously, an observer reset would've
stopped the first observation found with a matching token, which
might've belonged to a differen client.
Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
This restructures the lwm2m_engine to use a non-blocking socket access
instead of the previously used blocking style, and eliminates any
socket-access from outside of the main work loop.
The main motivation behind this is an issue within nordics
nrf_modem_lib/modem-fw on nrf9160, that leads to socket send() calls to
block indefinitely when the shared memory used for
rpc-communication with the modem is already exhausted because of
incoming data.
This lead to the lwm2m_engine locking up on send calls when there is
also a large amount of incoming data.
This works around this issue, by only issuing send calls when poll
reports the socket to be ready for sending, and (more importantly) by
always receiving all buffered incoming data before sending anything.
There might still be a (perhaps academic) possibility where this
situation might be triggered, when the scheduler interrupts the lwm2m
thread in-between receiving and sending, but for now we have not yet
observed this.
Besides working around the aforementioned issue, this also simplifies
the way resends are handled as they are no longer send from the main
system-workqueue, and limits all interaction with the sockets to a
single thread.
Signed-off-by: Henning Fleddermann <henning.fleddermann@grandcentrix.net>
Keys management API for IEEE 802.15.4 drivers was specific for Thread
protocol. With this change API is more generic and aligned with Thread
needs.
Signed-off-by: Hubert Miś <hubert.mis@nordicsemi.no>
Zephyr has introduced secure random generator API after the TLS sockets
were implemented. Use this new API in TLS sockets implementation,
instead of implementing secure RNG with mbedTLS in the module itself.
This facilitates integration of the HW RNG accelerators with the TLS
sockets module.
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Variable "level" in function z_vrfy_log_filter_set() has type unsigned.
But it is been checked if "level >=LOG_LEVEL_NONE" and
LOG_LEVEL_NONE is 0. It means check if unsigned is ">= 0" in Z_OOPS().
That is logically wrong, because unsigned is ">=0" by default.
Remove that check, to avoid static analysis tool raise
violation
Found as a coding guideline violation (MISRA R14.3) by static
coding scanning tool.
Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
If radio driver supports transmission security we need an option
to disable transmission security which by default is done by OT stack
for Thread v1.2
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
The tabulator handler creates a single structure if it is handling
dynamic commands. If the currently processed dynamic command has a
dynamic subcommand they both share the same structure.
As a result tabulation operation may result in undefined behaviour.
As a solution, a new structure was introduced to keep subcommand
information.
Fixes#35926.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
Fix incorrect and redundant use of ticker user id ULL_LOW
instead of ULL_HIGH when setting up a connection using a
mayfly to disable LLL context. Also, the LLL context pointer
is invalid, where node rx is passed instead of LLL context.
Use the ULL disabled callback when done event has not yet
been processed, or a direct connection setup in ULL_HIGH
context when ULL is already disabled (reference count is
zero) is sufficient.
Regression introduced in commit 30f260dfaa ("Bluetooth:
controller: Fix adv/scan context access post release").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Shell log backend depends on logging being enabled. Lack of this
dependency leads to compilation failure when logging is disabled.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
The final else {} in the if...else if is missing required
comment (non-empty, ';' is not sufficient). This adds a comment
to comply with CG 15.7.
Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
The final else {} in the if...else if is missing required
comment (non-empty, ';' is not sufficient). This adds a comment
to comply with CG 15.7.
Signed-off-by: Jennifer Williams <jennifer.m.williams@intel.com>
Fix CCC store on write feature for multiple connections. CCCs are only
enqueued for storing when going from no connections subscribed to any
connection subscribed.
The CCC should be stored when its value is changed for the specific
connection.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Fix Extended Advertising PDU population from incorrectly
populating new PDU when there is no common extended header
flags being set in the previous PDU and or the new PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Periodic Advertising PDU population from incorrectly
populating new PDU when there is no common extended header
flags being set in the previous PDU and or the new PDU.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix Periodic Advertising data population from corrupting
the PDU by populating fields when there is no flags in the
common extended advertising header.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add a status check for the BIG sync established and
BIG sync created events such that we don't log a warning
of invalid BIS count when it is an error event.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Fix a regression for cleaning up BIGs added by
80c824f18ee80caa5bd162b9d2957dde1639add6 where the way
ISO connections were unref'ed was changed.
bt_iso_cleanup has been changed to only effect CIS
(as the unref from that has been removed), so instead
of calling bt_iso_cleanup we just call
bt_conn_unref directly.
This also removes some unref's from the BIG complete
and BIG Sync complete event handlers as the BIS bt_conns as
they don't increase the ref counter before anymore.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
BT_L2CAP_LE_ERR_INVALID_PARAMS shall be returned instead of
BT_L2CAP_LE_ERR_UNACCEPT_PARAMS.
This was affecting test case L2CAP/ECFC/BV-26-C
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
For more than one requested channels in le_ecred_conn_req only result is
overwritten in every iteration. This causes an issues if after failed
l2cap_chan_accept occures successful one: returned result will be
BT_L2CAP_LE_SUCCESS, where in reality should be returned error
and non-zero Destination CIDs will signal "Some connections refused".
Now, overwrite error only if the last one failed. If no errors occur,
result will remain BT_L2CAP_LE_SUCCESS.
This was affecting test cases L2CAP/ECFC/BV-20-C
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Fix missing 0x0000 CIDs in response for ecred_conn_req. Previously,
when one of "All connections refused" error i variable was set to 0,
thus no CIDs were copied to response.
Signed-off-by: Krzysztof Kopyściński <krzysztof.kopyscinski@codecoup.pl>
Check correctness of returned sync_handle value while requesting
HCI_LE_Set_Connectionless_IQ_Sampling_Enable in controller.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Fix bug of missing sync_handle parameter in return data in
HCI_LE_Set_Connectionless_IQ_Sampling_Enable commnad
handling function.
Signed-off-by: Piotr Pryga <piotr.pryga@nordicsemi.no>
Log failure to initiatet security for bonded peer when GATT wants to
initiate security for CCCs for the remote.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Notify application about prepare write error when continueing the write
procedure fails when RX thread is processing responses. It is possible
that this operation fails, either because of disconnection or ATT
timeout on the ATT bearer. Notify the application in case it needs to
clear up resources, e.g. the write parameters.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
When a device is defined a new pointer to a device will be created in
the "z_pm_device_slots" region, effectively creating a device array with
the same size as the number of system devices. This array is then used
by the device PM subsystem to keep track of suspended devices during
power transitions.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>