Fix system workqueue block caused by mgmt_event_work_handler
when CONFIG_NET_MGMT_EVENT_SYSTEM_WORKQUEUE is enabled.
Signed-off-by: Benjamin Bigler <benjamin.bigler@securiton.ch>
Make sure that the ATE metadata does not overflow the sector size.
Take into account the data length and also the mandatory reserved ATEs
in each sector.
Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
When using an encrypted broadcast, the previous value is no
longer enough and caused a stack overflow.
Slightly increased the value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Some public API functions do not modify the net_buf instances and can
declare these arguments as const.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
When syncing to a PA using PAST then the sync_info.recv_enabled
was always just set to true, regardless of what mode was set
during the subscribe parameters.
The mode(s) are now stored in an array (with the default value
as well) so that we can retrieve that information when the PA
has synced via PAST.
It was considered to put the `mode` value into the `bt_conn`
struct, but that would require an API change as the `bt_conn`
parameter for the subcribe function uses `const`.
This commit also modifies the guard for PAST to be the more
correct value CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER instead
of just CONFIG_BT_CONN.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The checks for callbacks in bt_ots_init did not correctly take the
ots_init->features.oacp into account for all callbacks, which
caused some issues.
Slightly optimized the check for ots->cb->obj_read by moving the check
and reducing the number of places the code calls oacp_read_proc_cb.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
In case underlying TCP/TLS connection is already down, the
websocket_disconnect() call is expected to fail, as it involves
communication. Therefore, mqtt_client_websocket_disconnect() should not
quit early in such cases, as it could lead to an underlying socket leak.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Several log statements were using the regualar LOG_DBG,
but when ISO is actually used, those were called every TX
which at 10ms SDU intervals would fill up the log really fast
and not provided much value outside of some specific debugging.
Modified those logs to use BT_ISO_DATA_DBG which is another
log level for ISO data.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
The rationale behind that change is that the Application can use the
`bt_conn_le_param_update()` API to signal the controller to reschedule
the link.
Even if the new connection params are within the old ones, the
controller would be free to choose an e.g. smaller interval. The host
API should not prevent this usage.
Fixes https://github.com/zephyrproject-rtos/zephyr/issues/74292
Co-authored-by: Knut Eldhuset <knut.eldhuset@nordicsemi.no>
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
The first page frame index was reserved for head and tail ^pointers.
However there are cases where the first frame is actually made
evictable and would trigger the assertion guarding against that.
Fix this by applying an offset to actual frame indexes.
Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This reverts commit 93973e2ead.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This reverts commit 49ac1912b2.
PR #73978 introduced a regression.
Unfortunately this PR cannot be reverted without reverting also
Let's revert both PRs to stabilize main again towards the 3.7 release.
For more details on the issue see
https://github.com/zephyrproject-rtos/zephyr/issues/75205
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The existing state checks for both the broadcast sink
and broadcast source only ever checked the first BIS.
This sort of made sense, since they are all linked by HCI
(i.e. they share the same state), but there is a race condition
in the ISO and BAP callbacks that could allow applications
to delete sinks and sources before all the ISO callbacks
had been handled.
By treating the sink and source states as the highest value
of the BIS, then we better treat all BIS the same.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Make sure to check return values of mbedtls hmac APIs so that
the digest is calculated properly.
Fixes#75259Fixes#75260Fixes#75261
Coverity-CID: 366271
Coverity-CID: 366277
Coverify-CID: 366279
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This is a bug-fix:
When upper layers want to send something, they add a `conn` object to a
list. They do so by adding a node on `struct conn` rather than the object
itself.
We forgot to increase the reference count of the connection object when
doing so. This means that there can be a scenario where the conn object is
destroyed and re-used while still being on the TX list/queue.
This is bad for obvious reasons.
This patch fixes that by:
- increasing the refcount when putting on the TX list
- decreasing the refcount *only* when popping off the TX list
- passing a new reference from `get_conn_ready` into `bt_conn_tx_processor`
Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
If we have configured the DNS dispatcher to be only as a
responder but receive a query response, or if we are only
as a resolver but receive a query, then the dispatcher just
ignores the packet and returns -ENOENT.
Unfortunately we print an error message in this case
[00:10:18.818,000] <err> net_dns_dispatcher: DNS recv error (-2)
which is totally unnecessary and causes confusion so do not
print an error message in this case.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
If the metadata length is 0 in the mod source operation,
we set the length to 0 and memset the stored value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Add cast to NSEC_PER_SEC macro to correctly check offset.
Prior to this commit, the would eval to true incorrectly.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The sscanf() is not available for minimal libc so it cannot be used.
Use the net_bytes_from_str() that is provided for this purposes.
Fixes#75029
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
In case of thread failure, fix the registrations by properly managing
the synchronization i.e. use conditional wait only if thread is being
initialized or will be initialized, else check for success or failure
without waiting for conditional variables.
Fixes#73523.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
If logging packages need to be created at runtime, the format
strings need to be in memory for the packaging code to know
what to be packed. So prevent stripping the logging string
section if CONFIG_LOG_ALWAYS_RUNTIME is enabled.
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Move information about device power state constraints from device
to policy.
It slows down the constraints lookup since we now have to find the
constraints for a device in a global array, but it saves resources
because we don't need to add a reference to constraints in all devices
instances.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Set the UNALIGNED_ACCESS_SUPPORTED only for MCU with cortex M
that are neither M0 nor M0plus
Cortex M0 or M0plus mcus do not support un-aligned address access
Signed-off-by: Francois Ramu <francois.ramu@st.com>
I broke the rendering of the CFB_FONT_MSB_FIRST font in
the previously committed #53796.
I will correct the entire font rendering process to make it
easier to remove the restriction that the vertical size of
the font must be a multiple of 8.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
Add validation of the number of ASEs in control point
write requests.
This validates that the number of ASEs
in the control point is not greater than the total number
of ASEs we support.
This also validates that the GATT MTU is large enough to
hold all the responses from the write since those can only be
sent as notifications and never be truncated.
Finally this validates and updates the size of the buffer used to
hold the responses, which may be an optimization for some builds.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Removed the declaration and assignment of `eth_ctx` variable from
`net_if_get_wifi_sta` and `net_if_get_wifi_sap` functions since
it was not being used.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
Delay an ACK in case no PSH flag is present in the data packet. as
described in RFC 813. This allows to reduce the number of ACK packets
we send and thus improve the TCP download throughput.
The results achieved on `nucleo_h723zg` board and the zperf sample
are as follows:
Before: 77.14 Mbps
After: 93.14 Mbps
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The `type` parameter of `struct bt_le_scan_param` is documented as
taking a `BT_LE_SCAN_TYPE_*` value, not a `BT_HCI_LE_SCAN_*` value.
In practice this makes no difference as the values are defined as the
same integer, but does result in `<zephyr/bluetooth/hci.h>` not needing
to be included.
Signed-off-by: Jordan Yates <jordan@embeint.com>
Check if the calculated package length exceeds the maximum possible
value.
Fixes#75015
Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
Move the implementation of zsock_select() to zvfs_select(). This
allows other types of file descriptors to also make use of
select() functionality even when the network subsystem is not
enabled.
Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Move the implementation of zsock_poll to zvfs_poll. This allows
other types of file descriptors to also make use of poll()
functionality even when the network subsystem is not enabled.
Additionally, it partially removes a dependency cycle between
posix and networking by moving functionality into a mutual
dependency.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The nvs_calc_free_space() function does not return 0 when the NVS
is considered full, because some special ATEs are not taken into account.
This commit takes into account the ATE that is reserved for deletion in
each sector, in addition of the 'GC done' ATE when present.
Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
When `buf->len` is 0, the function of the while-loop
will be returned with error code `-ENOTSUP`.
The code block after while-loop cannot be reached
event though it is a correct command.
Use `buf->len` as the end condition of the while-loop.
Fixes#74730.
Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>