To avoid starvation of a traffic class by another, limit the maximum amount
of packets, that can sit in a single traffic-class-fifo to a fraction of
the maximum amount of available packets. In the tx-case also reserve
packets for direct sending, in the case, where
CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO is enabled.
Signed-off-by: Cla Mattia Galliard <cla-mattia.galliard@zuehlke.com>
The event monitor did not handled IPv4 multicast address
addition or deletion information.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
To simplify debugging what event code is missing from the
events shell module, print also event id for the for unknown
events. This way it is a bit easier to figure out what the
unknown event is.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Print Ethernet carrier on/off and VLAN tag enabled/disabled
status when monitoring events.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When reprinting the shell command buffer with long user inputs, the
reprinted buffer may cross a line boundary, and require a newline to be
printed. For these cases, print the command buffer character by
character, inserting newlines as appropriate.
Fixes#82155
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Cast sector_count and sector_size to uint64_t to prevent potential
integer overflow when calculating total device size in
disk_access_device_size().
Fixes Coverity issue CID-322647
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Switches flash_sync to use stream_flash_erase_to_append
instead of stream_flash_erase_page in preparation of deprecating
the later and reming control on erase from API user.
Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
The recvmsg() function should not modify the buffer configuration
provided in struct msghdr, such behavior is not specified in the POSIX
function description, nor is it consistent with well-known behavior of
this function in Linux.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The usbd_uac2_send function sometimes took ownership of the
provided buffer in error cases, and sometimes not.
The commit modifies the function so that ownership is never
taken in case a non-0 return value.
Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
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>