Fix compilation error with BR/EDR is enabled but the feature
CONFIG_BT_KEYS_OVERWRITE_OLDEST is disabled.
This caused compilation error because the field aging_counter is not
defined in the keys struct.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor out the advertiser roles handling from hci_core.c to its own
source file in adv.c.
Advertising roles consists of legacy and extended advertiser, and
periodic advertiser.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor out the scan roles handling from hci_core.c to its own source
file in scan.c.
Scan roles consists of regular scanning and synchronization to
periodic advertiser.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Don't include checks for advertiser is enabled when the broadcaster role
is not enabled. This makes it possible to have bt_le_ext_adv_foreach
be excluded from the compilation.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor out the identity handling from hci_core to its own source file
in id.c
Identity consistes of managing the identities of the device, the privacy
feature which hides the identities. And handling of the identity
resolving list in the controller, needed to support privacy-enabled
remote devices.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor the code so that bt_adv_lookup_legacy is always called after
the IS_ENABLED(CONFIG_BT_BROADCASTER) configuration has been checked and
the code path will be excluded.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor command state state handling to one function.
When setting state outside of hci_core the cmd macro is not available,
so in order to assign the buf pointer to state the function is needed.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
There was no close method implemented for AF_PACKET type
sockets. This meant that calling close() on packet socket
caused NULL pointer access.
This will allow #32949 issue to work properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
OpenThread UART tx callback has been processed even if it was not
triggered by OpenThread otPlatUartSend function.
Signed-off-by: Lukasz Maciejonczyk <lukasz.maciejonczyk@nordicsemi.no>
This new subsystem can be used to supervise individual threads. It
is based on a regularly updated kernel timer, whose ISR is never
actually called in regular system operation.
An existing hardware watchdog can be used as an optional fallback if
the task watchdog itself gets stuck.
Signed-off-by: Martin Jäger <martin@libre.solar>
Some devices may use different reference than cpu clock. Add
support for using swo-ref-frequency property when present.
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Change fixes an issue related to data access out of array bounds and
suppresses compiler warning.
Signed-off-by: Marek Pieta <Marek.Pieta@nordicsemi.no>
Implement MSG_WAITALL flag for stream sockets. Setting this flag on
`recv()` call will make it wait until the requested amount of data is
received.
In case both, MSG_WAITALL all is set and SO_RCVTIMEO option configured
on a socket, follow the Linux behavior, i. e. when the requested amount
of data is not received until the timeout expires, return the data
received so far w/o an error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add the option CONFIG_BT_HCI_ACL_DATA_SIZE which allows the user
to configure the max HCI ACL data payload. This is needed for platorms
where the BLE LL, HCI uart and host run on three different cores.
Fixes: #30441
Signed-off-by: Johan Stridkvist <johan.stridkvist@nordicsemi.no>
Overwrite the existing bond when the IRK of the existing bond could not
resolve the RPA of the peer. This would happen if the peer has deleted
the bond and replaced the IRK that was used.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor update_keys_check helper function to operate on input keys
input. This allows the function to be re-used on a keys structure that
is not the current connection keys.
This also avoids the helper function changing the connection state.
The conn->le.keys pointer should at this point always have been
assigned, as central when sending the pairing request, and as peripheral
when receiving the pairing request at the very latest.
Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
The Health Fast Period Divisor is stored within
the model publish parameters on the access layer.
The opposite part for divisor restoring has been missed.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
Adds the const qualifier to the internal api for adding and removing
virtual addresses, to allow them to accept const hardcoded values in
tests.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Moves the debug log printing the transport packet metadata to after the
keys are resolved, so that the subnet pointer is valid.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
Adds a "polled" function to the friend callback structure, that gets
called every time the friend receives a poll message. The polled
callback is called before the establish callback, to match the LPN
behavior.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
If there is no timeout, the connect will timeout immediately
and the connection is not established.
Fixes#33185
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Add execution time for testing result of each ztest testcase as:
START - test_sem_multi_take_timeout_diff_sem
PASS - test_sem_multi_take_timeout_diff_sem in 2.54 seconds
Fix#32137.
Signed-off-by: Enjia Mai <enjiax.mai@intel.com>
The SCA (sca) field of bt_iso_chan_qos did not give much
information about the expected values or what they meant,
nor any information about what the value perhaps should be.
Updated the description and the ISO shell.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
To prevent the transport layer from accepting duplicate or out of order
segmented messages, add an RPL-like check for the SeqAuth of the
segmented messages when their context is allocated. This prevents
duplicate receives of the same segmented messages in the case where a
single source address sends two segmented messages in parallel (to two
different addresses):
Previously, when receiving two segmented messages, the first message
would go through to the access layer, then the second. Then, if the
transport layer received any repeated segments for the first message, it
would fail to identify the SeqAuth as old, as all its segments were of
new sequence numbers, and the "already complete SDU" check would only
look at the second message. Thus, the segmented message got processed
again and passed to the access layer, even though it was a duplicate.
To solve this, we need a mechanism like RPL, but only for the segmented
messages' SeqAuth. We cannot re-use the actual RPL mechanism, as it
can't support the scenario provoked by the "blocking tx" mechanism in
transport. This mechanism allocates the SeqAuth when the message is
first passed to the transport layer. The ongoing message that caused the
block would keep sending segments with higher sequence numbers than
the blocked message got, which will cause the blocked message to fail
the RPL check.
This patch adds a parallel SeqAuth mechanism to the RPL module, which
only deals with the SeqAuth of the segmented messages. This list gets
checked when the segmented message is first allocated, in the same
manner as the general RPL mechanism. The storage gets hooked into the
RPL mechanism, by adding a separate seg field to each RPL entry.
Signed-off-by: Trond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
DHCPv4 client code needs to know information when network
interfaces are going down and up. So make sure that network
management config options are enabled in that case.
Fixes#33137
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
When Extended Advertising terminated due to duration or
maximum number of events, the auxiliary PDU scheduling
is now correctly stopped.
Fixes#31254.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add option to disable validation callback support by setting the
validation buffer size to 0, which allows to save some memory in case
it's not needed.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add a data validation callback to the resource structure, which can be
registered by an application. It allows to verify the data before
actually modifying the resource data.
If the callback is registered for a resource, the data is decoded into a
temporary buffer first, and only copied into the actual resource buffer
if the validation is successfull. If no validation is required (and thus
no callback registered) the resource value is decoded directly into the
resource buffer, as it used to be.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Mention that it's "data offset" in 32-bit words. Helpful when doing
code review and using search for "th_off".
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Replace the legacy delayed work API with the new delayable work API.
Avoid cancelling work and manually notifying when the subscription is
disabled; instead allow the work item to do this.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Replace the legacy delayed work API with the new delayable work API.
Use a zero period as a flag value to ensure that the work handler is a
no-op of the publish operation is disabled.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Switch to new work API, taking advantage of the difference between
schedule and reschedule to force an update if the new deadline is
sooner, and retain any previous deadline (or use the new deadline) if
it isn't. Do not leave a path out that could, due to races, fail to
schedule necessary work.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
A previous check and return for (maxlen <= 0) makes manlen at least 1 so
checks for (maxlen < 1) would never evaluate to true. Remove these
checks and merge those cases into one.
CID: 215392
Fixes: #33092
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
If CONFIG_NET_TCP_ISN_RFC6528 is disabled, then mbedtls include
files are not available so check this.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Switch to new work API. Avoid a racy cancel by allowing the work
handler to deal with an immediate off when the time remaining changes
to zero.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Previously, a racing write to the provided metadata could result
in up to CONFIG_LOG_STRDUP_MAX_STRING-2 bytes after the
end of user-accessible memory being leaked into the strdup pool
or the resulting log.
For now, explicitly copy the metadata string. In an ideal world
this could directly copy from userspace into the strdup buffer, but
this obviously only works if strdup is enabled.
Signed-off-by: James Harris <james.harris@intel.com>
Verify the result of option encoding while forming Deregister message
instead of silently ignoring it.
Coverity ID: 215373
Fixes#33096
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Added initial support for BIS (broadcast ISO stream), which
adds support for creating BISes as both broadcaster and receiver,
as well as managing and creating BIGs.
Extends PA sync to handle BIGInfo adveritising reports.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>