As the CoAP library was refactored to handle response
messages as stated by RFC, the LwM2M message handling was
untouched.
LwM2M Notify handling is relying on response callback
to be called, but as per CoAP RFC an empty Ack is not
actually a response and the callback was not called anymore.
Fix the issue by calling the response callback when
we receive an empty ack for any confirmable response
messages.
This should not affect any handling of CoAP requests.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This is a follow-up to commit 12eee61533.
Explicitly enable "PSA_WANT_ALG_ECB_NO_PADDING" to select the AES ECB
mode that it is used in CMAC operation.
This is done because CMAC uses AES-ECB, so both AES and ECB must
be explicitly enabled. Previously it worked because Mbed TLS is
not currently performing any check internally on this and it's
just enabling ECB automatically.
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
The function used to write the value of the GAP Device Name
characteristic now ensure that the string passed to `bt_set_name` is
null terminated.
Also fix a wrong offset calculation.
The function used to write the value of the GAP Device Name
characteristic was returning an error when the offset + the length of
data to write was superior **or equal** to the maximum size of the
device name.
This caused the actual maximum device name size to be reduced by 1 byte.
Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
The conversion from IPv4 string presentation to numeric value
did not check if the individual address value was between 0 and 255
inclusive.
Add also test case for this.
Fixes#84593
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The PACS flags were incorrectly defined without
ATOMIC_DEFINE and then it treated the atomit_t as an
array with the atomic functions.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
test_main can call ztest_run_all multiple times. For example
tests/bluetooth/host/keys/bt_keys_get_addr/src/main.c does so. If the
first call skips some tests and then they run in the second call,
everything is fine. However if they passed or failed in the first run
and skipped in the second run, then the test output (json, xml, and
printed summary) show the test as skipped even though it ran.
The solution is to not clear the test stats.
__ztest_init_unit_test_result_for_suite was added in commit
996c8457d7 by nashif.
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Add a config structure and move few pointers that don't need to change
into it, save few bytes of SRAM.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The scan events are always enabled which means if another software
component requests a scan, then the WiFi shell scan printouts will
also be sent to the shell.
Only enable the network management scan events when a user has
requested a scan.
Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
The new CONFIG_LLEXT_IMPORT_ALL_GLOBALS option allows all global symbols
from extensions to be used by the main application. This is useful to
load basic extensions that have been compiled without the full Zephyr
EDK.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Make sure the buffer used to load the hex file is aligned to a sensible
value; at least word size is assumed by the LLEXT APIs.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
The shell command 'llext list_symbols' currently iterates over the
'sym_tab' table. This is valid only inside 'llext_load' and is freed
before returning, so it will always be empty in shell context.
Fix it to display 'exp_tab', which is the one used at runtime by LLEXT
to provide symbols to the main application.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Change the "c" variable type from char to uint8_t in get_glyph_ptr() and
draw_char_vtmono() to fix issues with the range check of the "c" value.
The easiest way to print localized text with Zephyr is
to ask GCC for compile-time conversion:
INCLUDE(${ZEPHYR_BASE}/cmake/cfb.cmake NO_POLICY_SCOPE)
GENERATE_CFB_FONT_FOR_TARGET(app
"${CMAKE_CURRENT_SOURCE_DIR}/fonts/koi8-u.png"
"${ZEPHYR_BINARY_DIR}/include/generated/cfb_font_dice.h"
8 16 --first 0 --last 255)
TARGET_COMPILE_OPTIONS(app PRIVATE
-finput-charset=UTF-8
-fexec-charset=KOI8-U)
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Check if NET_DHCPV4_SERVER_OPTION_DNS_ADDRESS is set before using it to
set the DNS option in DHCP responses. This avoids sending a client a DNS
server of 0.0.0.0.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add a Kconfig option to skip the router DHCP server option. This can be
useful to avoid having the client trying to forward all its traffic to
the embedded device.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Modifying MAC address is allowed only when the interface is not
administratively UP, as it typically involves conveying the MAC address
to the chip firmware, and accepting the MAC address when interface is
administratively UP will not reflect in the actual usage.
So, modify the check to reject MAC address change if the interface is
administratively UP.
Fixes#81486.
Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This allows us to use the testusb Linux kernel tool again. All tests
involving control and bulk transfers should pass. Additionally, add a
shell command that allows the user to manually enqueue bulk transfers.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
If we have received data to the accepted socket, then release
those before removing the accepted socket. This is a rare event
as it requires that we get multiple simultaneous connections
and there is a failure before the socket accept is called by
the application.
For example one such scenario is when HTTP server receives multiple
connection attempts at the same time, and the server poll fails
before socket accept is called. This leads to buffer leak as the
socket close is not called for the accepted socket because the
accepted is not yet created from application point of view.
The solution is to flush the received queue of the accepted socket
before removing the actual accepted socket.
Fixes#84538
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
A _res_fallback parameter to HTTP_SERVICE_DEFINE is added to optionally
specify a fallback resource detail, which will be served if no other
resource matches the URL.
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
Currently, `CONFIG_OPENTHREAD_LOG_LEVEL` is used to set log level
in OT and register log modules in Zephyr. OpenThread allows 5
levels, causing issues when `OPENTHREAD_LOG_LEVEL_DEBG` is
selected ad we are trying to register modules with unknown lvl.
This commit adds `CONFIG_OPENTHREAD_MODULE_LOG_LEVEL` which is
aligned for Zephyr's log levels.
Signed-off-by: Maciej Baczmanski <maciej.baczmanski@nordicsemi.no>
Do not free the slot when cred buf is NULL.
If the TLS credential storage backend does not have a buffer pointer
to the TLS credential, then the buffer pointer can be NULL.
This may happen with an out-of-tree TLS credential storage backend.
In this case where credential buffer is NULL find_ref_slot retrieves
a new slot, and then tries to free it, causing a crash.
Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Added initial CCP client implementation that simply
does discovery of TBS on a remote CCP server.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
Jump straight to the exit portion of the function in the case that
psa_destroy_key() failed and we set err to a non-zero value. This also
fixes Coverity CID 487701 "Code maintainability issues (UNUSED_VALUE)".
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
-Adding explicit include for mbedtls/platform_util.h to get acces
to mbedtls_platform_zeroize in ITS. Somehow not visibile in Zephyr but
it caused build issues in nRF Connect SDK.
Signed-off-by: Frank Audun Kvamtrø <frank.kvamtro@nordicsemi.no>
The code shouldn't be checking for HCI command support anymore, rather in
the case of debug keys we can just start immediately using them.
Fixes commit 09e86f3b69.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
The BT Host module also uses import/export PSA functions alongside the
generate one, so these PSA_WANT should be added as well.
Previously it happened to work only because Mbed TLS is enabling
IMPORT/EXPORT internally whenever GENERATE/DERIVE is set. However the
same might not be true for all PSA Crypto providers.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
The ELF format allows for multiple string and symbol tables with
complex references between them. This is especially evident when
debugging information is included.
This patch fixes the issues that have been identified with multiple
string tables to allow LLEXT to properly parse those files:
* The symbol table used by LLEXT (LLEXT_MEM_SYMTAB) is now chosen
depending on the loaded file type, and other tables are ignored.
This change is also applied to the SLID injection script.
* The LLEXT string table (LLEXT_MEM_SYMTAB) is now correctly identified
by the symbol table reference, instead of picking the first one.
* VMA range checks only make sense for allocated sections.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This patch adds a debug log message to display the addresses of the
sections in a format that can be used with the gdb 'add-symbol-file'
command to properly inform the debugger about the final addresses for
the loaded sections.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
When building an ELF file with debugging information, the compiler
places this data in sections that do not need to be loaded in memory for
the program to run. These sections are marked as "not allocated" in the
ELF section header, and can be safely ignored when loading the file.
This patch adds a check to the relocation processing code to skip
relocations acting on those non-allocated sections, allowing to load ELF
files with debugging information.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Macro was missing a break when single argument with non 32 bit
word argument was detect. Because of that, there were two
logging messages created for a single log entry.
Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
Some time ago three Kconfigs dedicated for the child timeouts
configuration were added, but changing them does not apply when
using OpenThread libraries. Added setting these values using
openthread API on openthread start.
Signed-off-by: Kamil Kasperczyk <kamil.kasperczyk@nordicsemi.no>
Add a interface-name string for the CDC-ACM node, this allow setting a
string that is then set as iInterface, which can then be used downstream
in an udev rule such as:
SUBSYSTEM=="tty", ACTION=="add",
ATTRS{interface}=="my interface descriptor",
SYMLINK+="tty-my-device"
To create known aliases for these ports.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The commit fixes issue where flash_area_flatten has been used where
code was only supposed to erase devices by hardware requirement prior
to write, by replacing the call with flash_area_erase and supporting
logic to select proper path.
There have been following Kconfig options added:
- CONFIG_BT_MESH_BLOB_IO_FLASH_WITHOUT_ERASE
- CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
that are available for user depending on devices in the system and allow
to turn off paths that are not used by BLOB IO; for example if user
never writes to device with erase CONFIG_BT_MESH_BLOB_IO_FLASH_WITH_ERASE
will disable the path.
Both Kconfig options are y by default and enable all paths.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The exception stack frame type `z_arch_esf_t` had been deprecated
since #73593 for 2 releases, it is not used in the kernel since, and
applications/drivers should have been updated to use the
`struct arch_esf` now, remove it.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
It seems that this change was solely added to address issues with old
TCP stack, which blindly queued packets intended for TX for potential
further retransmission, expecting that the packet would remain intact
during transmission.
I think this assumption was wrong, as it's natural that lower layers
append respective headers to the packet, and this "header stripping"
behavior was specific for Ethernet L2 only. If an upper layer expects
that the packet would need to be retransmitted at some point, it should
clone it instead.
Therefore, remove the L2 header stripping from the Ethernet L2 to avoid
any potential issues in zero-copy case.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add new Ethernet driver config option,
ETHERNET_CONFIG_TYPE_EXTRA_TX_PKT_HEADROOM, which allows Ethernet
drivers to inform L2 about the extra net_pkt headroom they need to be
allocated.
This is only supported when CONFIG_NET_L2_ETHERNET_RESERVE_HEADER is
enabled, so that it's possible to fit entire packet into a single
net_buf, which is needed for zero-copy transmission.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The size calculation for the first buffer, in case extra headroom is
requested, had a bug which could result in a size variable underflow
followed by net_buf exhaustion.
In case the net_buf size was larger than requested size, but smaller
than requested size + headroom, the whole buffer size was subtracted
from the requested size. This however did not take the extra headroom
into account and in effect could result in underflow.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fixes an issue where the shell API could block indefinitely when called
from threads other than the shell's processing thread, especially when
the transport (e.g. USB CDC ACM) was unavailable or inactive.
Replaced `k_mutex_lock` calls with an indefinite timeout (`K_FOREVER`)
by using a fixed timeout (`K_MSEC(SHELL_TX_MTX_TIMEOUT_MS)`) in shell
API functions to prevent indefinite blocking.
Link: https://github.com/zephyrproject-rtos/zephyr/issues/84274
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
Introduced a new Kconfig option `SHELL_PRINTF_AUTOFLUSH` to allow
configuring the autoflush behavior of shell printing functions.
Updated `Z_SHELL_FPRINTF_DEFINE` to use the
`CONFIG_SHELL_PRINTF_AUTOFLUSH` setting instead of hardcoding
the autoflush behavior to `true`.
Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@verkada.com>
This option only exposes internal APIs, so there should be no need to allow
applications to set an explicit value. Instead, users of the API should
select it through Kconfig.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Remove the HCI command & event emulation layer for ECDH commands and
events. This means that we always do the necessary operations in the host.
The existing BT_ECC Kconfig option stays, but now gets automatically
enabled when necessary (e.g. based on the BT_SMP option), which is why this
commit removes so many explicit assignments in prj.conf files.
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Fix regression in Coded PHY S2 reception to any other PHY Tx
in the s/w switch implementation.
Regression in commit 55b7dba8ec ("Bluetooth: Controller:
Refactor sw_switch hal interface use").
Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
For usbser.sys driver, which is the default USB host driver for CDC
devices in windows, it is expected that USB device always indicate
completion of transmission by short packet. In case where the last
packet length is multiple of max packet size of the BULK IN endpoint,
the USB device shall indicate completion of transmission by sending a
zero length packet. This commit adds the sending of the short packet
termination mentioned above, ensuring condition of short packet
terminate is fulfilled.
Signed-off-by: Chew Zeh Yang <zeon.chew@ambiq.com>
Use the new entropy driver for 54L devices and therefore
claim BT_CTLR_ENTROPY_SUPPORT is always supported
(note 54H remains unsuported)
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Let's default to this new driver.
And therefore change the conditions in the BT controller kconfig
which were selecting the native_posix fake entropy driver
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Added option to set the PACS Characteristics through the bap API,
making PACS configuration runtime available. Source and Sink PAC, as
well as Source/Sink PAC Location is can be set through a register
function in the PACS api.
Signed-off-by: Fredrik Danebjer <frdn@demant.com>
This new option allows to export devices using identifiers generated
from the hash of the devicetree node path, instead of the device's
ordinal number. Identifiers generated this way are stable across
rebuilds.
Add new test cases to test this new option.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
Fixes#84198.
If a '?' character is used as part of a wildcard resource, do not treat
this as the end of the string when comparing with a path from the HTTP
request. Only the path from the HTTP request may be terminated by '?'
(in the case of a request with query parameters).
Signed-off-by: Matt Rodgers <mrodgers@witekio.com>