Many releases ago, specifying to block indefinitely in the log
processing thread would do just that.
However, a subtle bug was introduced such that specifying -1
for `CONFIG_LOG_BLOCK_IN_THREAD_TIMEOUT_MS` would have the
exact opposite effect than what was intended.
As per Kconfig, a value of -1 should translate to a timeout of
`K_FOREVER`. However, conversion via `K_MSEC(-1)` results in
a `k_timeout_t` that is equal to `K_NO_WAIT` rather than the
intent which is `K_FOREVER`.
Add a dedicated check to to ensure that a value of -1 is
correctly interpreted as `K_FOREVER` in `log_core.c`.
For reference, the blocking feature was described in #15196,
added in #16194, and it would appear that the regression
happened in c5f2cdef09.
Signed-off-by: Christopher Friedt <cfriedt@meta.com>
Improve it so that:
- it mentions the important fact that it redirects `printk` messages
to the logging subsystem
- it is consistent with the help messages of the other options in this
file (i.e. it starts with "If enabled")
Signed-off-by: Ladislav Podivin <ladislav.podivin@tietoevry.com>
When relocating section symbol addresses the value where the
relocation is to be written is an offset into the section to load.
Simply rewriting it with the section address is not enough, we need
to write the address of the section with the offset into it.
Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
Added a condition to check if the size of the copied
memory is a positive number.
Fixes#58700Fixes#58703
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
Oneline fix to smp_bt.c smp transport register.
smp_client_transport_register() is a void function and
has no return value, so it should be ignored.
Signed-off-by: Alexander Stark <alexander.t.stark@gmail.com>
Add a build option to allow changing the initial state used
in the timer based random generator and by the kernel in the
early random number generator.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Check whether peer is subscribed for ASE state notification before
calling bt_gatt_notify. This handles an assert thrown when the
notification failed to be sent.
Fixes: #63728
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
If the PA gets terminated, we clear the pa_sync field of the
corresponding broadcast sink object.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
For some reason the state_change variable was static, which
does not make any sense. Changed it to a regular local
bool in bt_bap_scan_delegator_mod_src.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Commit makes workable proxy solicitation functionality
only server part without dependencies on client part.
Only on demand proxy server is required.
Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
The `upload_status_rsp_with_progress` function uses the currently set
slot pointer to set firmware id field in the message. If another
upload starts but the firmware is already received, the slot API won't
let us to set the fwid and will return an error code. In this case, the
slot pointer stays invalid as fwid wasn't set, and
`upload_status_rsp_with_progress` will not add fwid as the lenght is
zero.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
Handles return values from settings handlers which were missing
and would return "Unknown error" to clients instead of the read
error
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes the error code being returned when trying to perform a
hash/checksum on an empty file to show it is because the file is
empty, not because a paramter (which was not provided) was too
large.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fixes an issue which would cause a fault if someone attempted
to write to the (non-writable) blinfo keys
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
Fix hung Controller when establishing CIS on an encrypted
ACL connection with Controller built with direction finding
support enabled.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
When the bt_bap_broadcast_source_reconfig was supplied with a subset
of the streams, it would only update the codec cfg and qos for the
streams provided in the parameters.
This commit changes that, so all streams are properly updated,
as they share some common values.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When calling bt_bap_broadcast_sink_delete, the broadcast sink
should not attempt to terminate the PA Sync. The PA sync can live
on without the broadcast sink, just as the broadcast sink can live
on without the PA sync (which is why the PA sync check was completely
removed).
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
When updating the Scan Delegator receive state, we shall only
set the BIS indexes in bis_sync that we are actually synced to.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit increases the buffer used for commands
in the control channel within an instance of the
modem_cmux module. The buffer was not large enough to
store an MSC command if the optional break signals
where included. This commit fixes the issue and
updates the test suite to use the max size MSC message.
Signed-off-by: Bjarki Arge Andreasen <baa@trackunit.com>
If the previous upload was in-band and it didn't complete, the slot will
stay reserved. By design we release slot not at the end of the upload
phase, but at the start of a new upload phase.
This fixes DFU/SR/FD/BV-13-C.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
If a Fw Distribution Client sends the Upload OOB Start message, but the
application layer didn't call bt_mesh_dfd_srv_oob_check_complete yet,
we have no other option other than ignore the message. The next phase
in this case could be Transfer Active, Transfer Success or Failed and it
will be set only after Check Firmware OOB procedure completes.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This message _at least_ 2 bytes long, but can be longer, thus
BT_MESH_LEN_MIN should be used.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
In OOB upload, when Check Firmware OOB procedure completes successfully
and the firmware is already received, we send Firmware Distribution
Upload Status message with update Phase set to Transfer Success. In this
case, we must set Upload Progress to 100%. This can't be done through
the callback as the application layer doesn't yet know that the firmware
is already received. This will happen by the exist from
bt_mesh_dfd_srv_oob_check_complete function, which will return error
code -EEXIST.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
According to the ASCS_v1.0 the ASE in Streaming state shall transit to
QoS Configured state when link loss happen.
Relates: ES-24215 (errata)
Fixes: BAP/USR/SCC/BV-168-C
Signed-off-by: Mariusz Skamra <mariusz.skamra@codecoup.pl>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The list of receives in the Firmware Distribution Server model and
and the Firmware Update Client model are 2 different lists.
In the Firmware Update Client model it is called the Update Receives
state and the Active Update Receivers state which is a subset of
receivers from the Update Receivers State. In the Firmware Distribution
Server model it is called the Distribution Receivers List state.
When Distribute Firmware procedure starts, in the Initiate step, the
Receivers List input (which is the input for the Update Receivers
state), is composed of the Distribution Receives List state. During DFU,
the Update Receivers state becomes the Active Update Receivers state
which keeps only active nodes. Timed out or failed nodes dropped out
from this list. The Distribution Receivers List state stays unchanged
and thus don't need to be populated again after every successfull and
failed DFU.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
The task_wdt_add function changes the reload_period of the channel to a
non-null value, which indicates that the channel is used. If the
function is interrupted by a task_wdt_trigger running in ISR context
before adding of the new channel has finished, the next timeout will be
scheduled based on inconsistent channel data.
Using a spinlock avoids such data races.
Fixes#61004
Signed-off-by: Martin Jäger <martin@libre.solar>
Added offset to the model relation register for vendor
models to find correct model index
for Composition Data Page 1. The previous implementation used the
'mod_idx' from the 'bt_mesh_model' struct, which led to issues in the
model relation register due to SIG and vender models having the same
model index.
Modified existing functions related to the model relation
register to take in the offset.
Modified macros for determining if a model is a base- or
extending model.
Added check in 'add_items_to_page' to check whether the model relation
is an extension.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Changed buffer length check in bt_mesh_comp_p1_elem_pull.
The previous threshold would result in the
method not detecting the final element when it consisted of just one
model.
Signed-off-by: Håvard Reierstad <haavard.reierstad@nordicsemi.no>
Fixing kernel crash caused by memory release
while having a scheduled work item pending.
Signed-off-by: Jeroen van Dooren <jeroen.van.dooren@nobleo.nl>
When compiling conn.c using arm-none-eabi-gcc version 11.3.1 20220712
with the -Wmaybe-uninitialized flag a warning is emitted due to
pending_no_cb not being initialized. I'm not sure if initializing it to
NULL is the "correct" fix, but it's certainly not any worse then it being
uninitialized, and it fixes the warning.
Signed-off-by: Dennis Grijalva <dennisgrijalva@meta.com>
Connection states are non-trivial to understand based on their names
only, so add short descriptions in the header file explaining what they
do.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fix errenous return value in pacs_gatt_notify function. The function
would always return zero, and not forward the error correctly.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
Don't reset values set in init callback as it is called only once by
bt_mesh_init call. The reset callback is called on every node reset.
Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
A few of the length checks that deal with HCI packets coming from the
controller were using assert statements. But the recommended practice is
to drop invalid packets and continue execution whenever a malformed
packet arrives from an external source, so replace those assert
statements with branches that will drop the packet and return.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Fixed issue when reprovisioning is done on a device with
both RPR client and server on the same device.
Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
The existing formula for the amount of data that can be filled
in in the current PDU is correct but confusing. Replace it with
a simpler formula.
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
Updates the chaining for advertising.
Instead of unconditionally adding a new PDU when new data
is added we now instead fill the last PDU in the chain with
the incoming data, only adding a new PDU when there is
not enough room.
This reduces the nr. of PDUs used for advertising, and also
fixes some qualification failures
Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
The indexes were reset to 0 for each subgroup, which meant
that if we had a broadcast source with 2 subgroups and
1 BIS in each, both of them would use index 0x01.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
A race condition between ATT RX and the connection teardown can happen, as
the teardown is executed from a workqueue.
For example:
- connection is established
- `connected` cb is called (in BT RX context)
- user calls `bt_conn_disconnect` in that cb
- connection is marked as disconnecting
- ATT teardown & general conn cleanup is scheduled
- BT RX gets an ATT request, tries to handle it
- ATT bearer is still not GC'd, so it tries and fails to send it
-> results in error message "not connected" on log
- ATT teardown & general conn cleanup runs
To avoid that, we not only check the bearer state, but also its ACL conn
state.
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
Fix leak in scheduled ticker node when rescheduling ticker
nodes.
Applications having active Extended Advertising or Observer
role with the use of ticker reschedule in window feature
would experience assertion check failure due to delayed
radio event preparation or stalled controller with no active
roles.
Fix updating of the ticker linked list when handling
rescheduled tickers.
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>