Commit Graph

94813 Commits

Author SHA1 Message Date
Jukka Rissanen 8d077ca66d net: if: Print warning if there are no network interfaces
When calling net_if_get_default(), print a warning if no
network interfaces are found. This helps debugging mysterious
crashes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 17f852f3cf net: if: ipv6: Do not crash if there are no network interfaces
When trying to get IPv6 prefix, if there are no network interfaces
then the net_if_get_default() will return NULL but we should not
crash at that point but return gracefully.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c0b7d8f252 tests: net: coap: Enable loopback interface
There needs to be at least one network interface in order
to avoid this error.

E: There is no network interface to work with!

So enable loopback support which creates a loopback interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 2711e12039 net: ipv6: Tailor PE values for Zephyr
Making default preferred time much closer to default valid time
so that the served addresses are much shorter time in deprecated
state where they cannot be utilized. This is important in Zephyr
as there are limited number of IPv6 addresses that can be allocated
to the network interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 39ab0bb002 net: sockets: Fix getsockname() for TCP
The local address used for established TCP socket needs to be
dig out from TCP internals and not from context->local.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c6c021b1f8 net: context: Add helpers for figuring out local endpoint address
We usually cannot use context->local for established TCP connections
because the local address is not updated for TCP if we are bound to
any address. So create helper that try to figure out the end point
addresses.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen b26b0e7d10 samples: net: echo-server: Prefer public IPv6 addresses
As a server it makes sense to prefer public IPv6 addresses
so mark the socket so.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen fb16600689 samples: net: echo-client: Avoid flooding output
Do not print progress report so that makes debugging things
a lot harder. It is still possible to enable printouts if needed
by setting PRINT_PROGRESS symbol.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 3046e95d85 samples: net: echo-client: Check IPv6 address deprecation
If the IPv6 address that our socket is bound to deprecates, then
re-create the socket so that we avoid using deprecated IPv6 address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen e2792c6509 samples: net: echo-client: Prefer temporary IPv6 addresses
As a client it makes sense to prefer temporary IPv6 addresses
so mark the socket so.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen d9c985ec67 tests: net: ipv6: Add address selection tests
Make sure the IPv6 source address selection works as expected
when using the IPV6_ADDR_PREFERENCES socket option.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen d47e0dd93e net: Add IPv6 source address selection support
Add support for IPv6 Source Address Selection defined in RFC 5014.
This commit does not add any address selection support to getaddrinfo()
as described in the RFC. The AI_EXTFLAGS symbol and also the ai_eflags
to hints is added but they are not used by the code.
The public/temporary address selection is only done internally by
the net_if_ipv6_select_src_addr_hint() according to flags set by
setsockopt().

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen bd496541d7 net: shell: Print ref count information for IPv4 and IPv6 addresses
When printing IPv4 and IPv6 address information in "net ipv4" and
"net ipv6" commands, print also reference count of the IP address.
This is useful for debugging purposes.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 06e9832f63 tests: net: udp: Add address reference counting tests
Make sure that address reference counting works as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen f96087e257 net: Add ref counting to net_if_addr struct
Add reference counting to network interface address (for both
IPv4 and IPv6) so that the address is not removed if there are
sockets using it. If the interface address is removed while there
are sockets using it, the connectivity will fail for the said
socket.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c69357a8b4 net: if: Remove IPv6 address when it expires
No need to keep the expired addresses around, just remove it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen a7e332dc18 net: ipv6: Add Privacy Extension events to net_mgmt
Add events to be generated when privacy extension is enabled
or disabled, or when allow/deny filter is added or deleted.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen c741c524ae net: shell: Add information about IPv6 privacy extension
When executing "net iface" command, print current status of
IPv6 privacy extension if it is enabled in config file.

The "net ipv6 ..." command prints IPv6 privacy extension
information, and can add or delete IPv6 prefix filters.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen f95c62803f tests: net: ipv6: Add privacy extension tests
Add tests that will make sure IPv6 privacy extension code works
as expected.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen 0d085d74c4 net: ipv6: Select proper IPv6 source address for privacy extension
If IPv6 privacy extension is enabled, then we need to select
proper public or temporary IPv6 source address when sending the
packet.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen ed9a983837 net: ipv6: Initial support for privacy extension
This creates support for IPv6 privacy extensions which is described
in RFC 8981. This will also add API that can be used to add IPv6
prefixes to a allow or deny list privacy extension filter.

The code will create temporary IPv6 addresses from prefixes that
are advertised by Router Advertisement messages. The temporary
IPv6 addresses are then expired according to lifetime and removed.

Fixes #9349

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Jukka Rissanen ce4a13ae79 net: ipv6: Generate an event for deprecated address
If IPv6 address expires and moves to deprecated state, then
send a mgmt event so that listeners can act on it.
One such action is to close a socket bound to that source address
so that the address can be released.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 22:50:18 +01:00
Konrad Derda d60ea3efee tests: net: mld: add tests for multicast routes in MLDv2 reports
This commit introduces a new test case for veryfing that addition and
deletion of multicast routing entries emit MLDv2 reports when needed
and if multicast routing entries are appended to MLDv2 records properly.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Konrad Derda 5c0d7390f1 net: ipv6: mcast_routing: send MLDv2 reports on changes
This commit adds transmission of MLDv2 reports whenever a multicast
routing entry is added or removed when suitable (it checks if the
given interface itself has joined the group).

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Konrad Derda 356a42587c net: ipv6: mld: add option to include multicast routes in MLDv2 reports
This commit introduces a new option CONFIG_NET_MCAST_ROUTE_MLD_REPORTS
which appends multiacst routes to MLDv2 reports. These records are
intended to inform reports' recipients about potential listeners on
the other interfaces.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Konrad Derda 486f895a54 net: ipv6: mld: allow to send unsolicited MLDv2 reports on demand
This commit exposes net_ipv6_mld_send_single() function to be used
by other modules.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-06 22:50:01 +01:00
Fabio Baltieri aa72e8178c boards: croxel_cx1825: disable CDC-ACM logging by default
Disable this explicitly as done for other boards using a USB console by
default, prevents a build warning:

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2024-05-06 20:12:57 +01:00
Ioannis Karachalios 58b9facbd1 drivers: mipi dbi: smartbond: Add support for PM
This commit should add all the functionality needed for the MIPI DBI
driver to work when PM is enabled.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-06 21:55:03 +03:00
Marcin Szymczyk 8742e24760 tests: kernel: interrupt: nested_irq: support nRF54L15 FLPR CLIC
Add support for VPR CLIC to `nested_irq` kernel test.
Verified on nRF54L15 FLPR for now.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-05-06 19:06:19 +02:00
Marcin Szymczyk fd79676c16 tests: kernel: interrupt: account for custom RISCV IRQ offset
`CONFIG_RISCV_RESERVED_IRQ_ISR_TABLES_OFFSET` offsets IRQ in
vector table, align test to this functionality.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-05-06 19:06:19 +02:00
Marcin Szymczyk 671bf6619e testsuite: interrupt_util: add `trigger_irq` for VPR CLIC
Enable triggering IRQs in tests for VPR CLIC.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-05-06 19:06:19 +02:00
Louis Feller 0c6baa5854 dts: stm32wba: Fix RNG base address
Set RNG address to its non-secure alias.
See RM0493 STM32WBA5 Reference manual for details.
Using the secure alias (0x5..)instead of the non-secure alias (0x4..)
for this peripheral results in a SecureFault during kernel init if
TrustZone is activated, Zephyr is running as NSPE and RNG is
enabled.

Signed-off-by: Louis Feller <louis.feller@st.com>
2024-05-06 17:32:25 +01:00
Patryk Duda 60d03c53e1 libc: minimal: Add 'noreturn' attribute to abort() and exit()
This aligns abort() and exit() definitions with other libc.

Without 'noreturn' attribute, compilers have to assume that we will
return from these functions which can lead to surprising errors like
'error: non-void function does not return a value'.

Signed-off-by: Patryk Duda <patrykd@google.com>
2024-05-06 17:32:17 +01:00
Juliane Schulze 26a8a20542 drivers: tmag5273 add missing ifdef around CRC support
Fixes an error causing build issues if CRC support is not set to active.

Signed-off-by: Juliane Schulze <juliane.schulze@deveritec.com>
2024-05-06 17:31:57 +01:00
Dong Wang 6a962fb50a pm: re-program timer HW only when the exit latency is not zero
Avoid re-programming timer unnecessarily.

Signed-off-by: Dong Wang <dong.d.wang@intel.com>
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2024-05-06 17:31:40 +01:00
Benjamin Lindqvist 0d14143926 net: coap_client: handle observe requests as intended
The coap_client lib only handled "one-shot" requests properly. This
patch allows it to keep listening for additional responses to a request,
if the request was made with the CoAP OBSERVE option appended.

An API for canceling such requests is also added.

Signed-off-by: Benjamin Lindqvist <benjamin@eub.se>
2024-05-06 17:31:19 +01:00
Jukka Rissanen aecac68179 net: Do not directly use net_buf size field
The size field in net_buf should not be used directly as then
the optional headroom will not be taken into account.
There is the net_buf_max_len() API that should be used instead.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 17:31:09 +01:00
Jukka Rissanen 24284601d9 tests: net: reuseaddr_reuseport: Fix zassert statements
One should not call a function directly from within zassert()
as it can cause the value of errno to be lost as seen by this
failed test output

Assertion failed at tests/net/socket/reuseaddr_reuseport/src/main.c:151:
  test_bind_success: (zsock_bind(sock, addr, addrlen) not equal to 0)
  bind() failed with error 0
FAIL - test_ipv4_udp_bad_both_not_set in 0.000 seconds

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-05-06 17:30:45 +01:00
Hess Nathan 1486259139 coding guidelines: comply with MISRA Rule 20.9
- avoid to use undefined macros in #if expressions

Signed-off-by: Hess Nathan <nhess@baumer.com>
2024-05-06 17:30:26 +01:00
Aurelien Jarno 3da656388d drivers: hwinfo: shell: fix error message when no hardware support
When there is no implementation for a particular hardware information
device, the API return -ENOSYS, while the hardware information shell
checks for -ENOTSUP. This returns a non-user friendly message:

  uart:~$ hwinfo devid
  Error: -88

The API can't be changed easily without breaking things, so let's change
the shell instead. This gives:

  uart:~$ hwinfo devid
  Not supported by hardware

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-06 17:30:14 +01:00
Ping Wang 1188305c1e Bluetooth: Audio: Shell: adds support for BIS index parameter
When calling bap_broadcast_assistant add_pa_sync, it should only
set the BIS index field as optional parameters and not to whatever
is in the BASE.

If setting BIS index which the BASE does not support, then the
command should be rejected.

This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/70835

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Ping Wang 6a027634cd Bluetooth: Audio: Shell: adds support for BIS index parameter
When calling bap_broadcast_assistant add_pa_sync, it should only
set the BIS index field as optional parameters and not to whatever
is in the BASE.

If setting BIS index which the BASE does not support, then the
command should be rejected.

This PR fixes https://github.com/zephyrproject-rtos/zephyr/issues/70835

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Ping Wang 291b81bc38 Bluetooth: Audio: Shell: adds support for LESC in the host
The commit adds support for LESC in the host if the controller
does not support the public key generation for ECDH.

Signed-off-by: Ping Wang <pinw@demant.com>
2024-05-06 17:30:04 +01:00
Peter Ujfalusi 5f81652b2d drivers: dai: intel: ssp: Only setup mclk/bclk when it is needed by role
When SSP is consumer for FS and BCLK then it does not needs MCLK as the
shifting and rate is derived form the I2S bus directly.
When SSP provides FS only then the BCLK setup is not needed.
When SSP provides BCLK only then both MCLK and BCLK setup is needed.

In hardware multiple SSPs share the same MCLK source, in case of one
SSP port is used as clock provider while other is used as clock consumer
then the consumer SSP should not need to depend on the provider SSP
configuration, the ports can run in different clock rates.

In this example the consumer SSP should not try to configure and lock the
MCLK frequency to some arbitrary rate (as it does not need MCLK at all)
which might be different than the frequency needed by the provider port.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
2024-05-06 17:29:41 +01:00
Glenn Andrews e55e85386a Boards: QEMU: Replace -no-acpi with -machine acpi=off on x86 emulation.
QEMU 9.0 removes the `-no-acpi` option, which breaks emulation on x86
platforms when CONFIG_ACPI is not set. See:
https://github.com/zephyrproject-rtos/zephyr/issues/72191

This PR replaces `-no-acpi` with `-machine acpi=off`, as specified by
the QEMU documentation. It works on QEMU 8, but not been tested on
earlier versions.

Signed-off-by: Glenn Andrews <glenn.andrews.42@gmail.com>
2024-05-06 18:14:55 +02:00
Abderrahmane Jarmouni d3c9a986ec soc: st: stm32: stm32f1x: remove hwmv1 stuff
Remove forgotten "config SOC..." stuff.

Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
2024-05-06 15:04:06 +01:00
Troels Nilsson 5d44e36779 Bluetooth: Controller: Fix BIS target_event truncated to 8 bits
The target_event value is up to 39-bits but was put into a uint8_t

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-05-06 15:03:56 +01:00
Brandon Allen 5e0a21c54c samples: Bluetooth: broadcast_audio_sink: rm nrf52820 from sample.yaml
nrf52833dk/nrf52820 does not compile so remove it from platform_allow list

Signed-off-by: Brandon Allen <bwallen1997@outlook.com>
2024-05-06 14:59:52 +01:00
Aurelien Jarno d68e8cbfe8 drivers: clock_control: add support for MSI clock on STM32WL
Add support for the MSI clock on the STM32WL family. This is needed for
instance to set the RNG clock domain to MSI in the device tree when not
using the PLL.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-06 14:59:44 +01:00
Aurelien Jarno 7fff27329d dts/arm/st: wl: decrease Sub-GHz SPI frequency to 8MHz
Commit 246ea739bb ("dts/arm/st: wl: increase Sub-GHz SPI frequency to
12MHz") increased the Sub-GHz to 12 MHz. This matches the SX126x
datasheet, but there is no information about the maximum speed in the
STM32WL datasheet or reference.

This works fine when not using DMA. However with DMA activated (adding
entries to the device-tree and enabling CONFIG_SPI_STM32_DMA), I have
encountered some rare corruption. When it happens, the read from the
Sub-GHz device gets an extra 0x00 byte prepended, which confuses the
LoRaMac-node library and causes reception failures. Decreasing the
frequency to the next round number, that is 8 MHz (i.e. increasing the
prescaler from 4 to 6) fixes all the issues I encountered.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2024-05-06 14:59:16 +01:00