Fill-in the mode field of the fd_entry so that the
implementation can be made aware that the specific file
descriptors created are sockets.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This patch file updates the use of assertion macros
comparing strings.
Command line used:
```
./scripts/coccicheck --mode=patch \
--cocci=scripts/coccinelle/ztest_strcmp.cocci tests/
```
Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This is the first commit from the set of patches that brings to the
Zephyr, SO_TIMESTAMPING socket level option. This enables to pass to
the network driver information whether given network packet should
be timestamped or not.
Signed-off-by: Adam Wojasinski <awojasinski@baylibre.com>
The preprocessor gives this error when calling zsock_sendto
in user mode when there is a mismatch with amount of parameters
to the sendto wrapper call.
tests/net/socket/udp/src/main.c: In function ‘comm_sendto_recvfrom’:
tests/net/socket/udp/src/main.c:125:46: error: macro "zsock_sendto" \
requires 6 arguments, but only 5 given
125 | 0, &addr, addrlen);
| ^
In file included from include/zephyr/net/socket.h:1381,
from tests/net/socket/udp/src/main.c:15:
include/generated/zephyr/syscalls/socket.h:266: note: \
macro "zsock_sendto" defined here
266 | #define zsock_sendto(sock, buf, len, flags, dest_addr, addrlen)
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Modify the test cycle routines to verify recently added IPv4- and
IPv6-specific events.
Signed-off-by: Georges Oates_Larsen <georges.larsen@nordicsemi.no>
Allow changing the target server address on interoperability
tests.
This allows running same testcases against public Leshan
instance. It is a first requirement to run same tests
on a real HW.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
Until recently, the posix api was purely a consumer of the
network subsystem. However, a dependency cycle was added as
a stop-gap solution for challenges with the native platform.
Specifically,
1. eventfd symbols conflict with those of the host
2. eventfd was excluded from native libc builds via cmake
If any part of the posix were then to select the network
subsystem (which is a legitimate use case, given that networking
is a part of the posix api), we would get a build error due to
the Kconfig dependency cycle.
As usual, with dependency cycles, the cycle can be broken
via a third, mutual dependency.
What is the third mutual dependency? Naturally, it is ZVFS
which was planned some time ago. ZVFS will be where we
collect file-descriptor and FILE-pointer APIs so that we can
ensure consistency for Zephyr users.
This change deprecates EVENTFD_MAX in favour of
ZVFS_EVENTFD_MAX.
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The POSIX_MAX_FDS option does not correspond to any standard
POSIX option. It was used to define the size of the file
descriptor table, which is by no means exclusively used by
POSIX (also net, fs, ...).
POSIX_MAX_FDS is being deprecated in order to ensure that
Zephyr's POSIX Kconfig variables correspond to those defined in
the specification, as of IEEE 1003.1-2017. Namely,
POSIX_OPEN_MAX. CONFIG_POSIX_MAX_OPEN_FILES is being deprecated
for the same reason.
To mitigate any possible layering violations, that option is
not user selectable. It tracks the newly added
CONFIG_ZVFS_OPEN_MAX option, which is native to Zephyr.
With this deprecation, we introduce the following Kconfig
options that map directly to standard POSIX Option Groups by
simply removing "CONFIG_":
* CONFIG_POSIX_DEVICE_IO
Similarly, with this deprecation, we introduce the following
Kconfig options that map directly to standard POSIX Options by
simply removing "CONFIG":
* CONFIG_POSIX_OPEN_MAX
In order to maintain parity with the current feature set, we
introduce the following Kconfig options.
* CONFIG_POSIX_DEVICE_IO_ALIAS_CLOSE
* CONFIG_POSIX_DEVICE_IO_ALIAS_OPEN
* CONFIG_POSIX_DEVICE_IO_ALIAS_READ
* CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE
Gate open(), close(), read(), and write() via the
CONFIG_POSIX_DEVICE_IO Kconfig option and move
implementations into device_io.c, to be conformant with the
spec.
Lastly, stage function names for upcoming ZVFS work, to be
completed as part of the LTSv3 Roadmap (e.g. zvfs_open(), ..).
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
The number of suitable network IPv6/4 configurations in interfaces
affect the number of pollable sockets. So need to increase the value
from the default value of 3.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
test_packet_sockets_dgram create ETH_P_TSN sockets but
send and recv ETH_P_IP packet.
Fix it by sending ETH_P_TSN packet.
Signed-off-by: Fengming Ye <frank.ye@nxp.com>
In an effort to shave off code size, remove out-of-the-box
enabling of crypto features (except SHA-256).
Configurations are adjusted to enable what they need.
Bonuses:
- When enabled, AES now defaults to using a smaller version
(`CONFIG_MBEDTLS_AES_ROM_TABLES` isn't default enabled anymore,
and if enabled, `CONFIG_MBEDTLS_AES_FEWER_TABLES` defaults to y).
- Conditions around Mbed TLS Kconfig options have been improved
to reflect the reality of the dependencies.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The 'tfm' tag was removed from the samples in in
7c80473e0a but it remained in use in other
parts of the project.
This change brings back consistency through out the project.
Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
In order to be compatible with Linux AF_PACKET socket calls, the
protocol field needs to be in network byte order.
So for example, if user wants to receive all packets, then the
protocol field needs to be set as "htons(ETH_P_ALL)".
See Linux manual page at
https://www.man7.org/linux/man-pages/man7/packet.7.html
for details.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
When tests control the LwM2M client entirely through
shell, we should be able to set the RD client context
from the application without causing RD client to
start registration.
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
This commit fixes#73337.
Before #72243 Mbed TLS was not using
USE_PSA and all PSA features were not enabled. After #72243
if BUILD_WITH_TFM is set:
- USE_PSA in Mbed TLS is enabled by default and
- all PSA features are enabled.
This commits reverts both changes for net.socket.register.tls
test case.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Remove the `_MAC` part because those Kconfig options enable only hash
algorithms, nothing MAC-related, and the `_ENABLED` part to align the
naming to the Mbed TLS defines (plus we don't need such a part).
As a bonus, enabling SHA-256 does not automatically enable SHA-224
anymore.
See the migration guide entries for more details on the practical
changes.
Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
The test needs couple of more socket/file descriptors to work because
CONFIG_POSIX_API creates three more file descriptors namely the
stdin, stdout and stderr descriptors.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The compilation was failing if IPv4 was disabled.
Also fix the IPv6 test so that they pass properly.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The ztest stack was to low to execute tests on some platforms (spotted
on nrf52840dk/nrf52840), hence increase it.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The values set as a min_ram requirement were far from the actual RAM
usage reported during build, make them more realistic.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add tests verifying valid IPv6 ND behaviors on interface state changes,
specifically:
* Verify RS is sent, and upon RA reception prefix and autoconf address
added accordingly.
* DAD is triggered for autoconf, static and LL IPv6 addresses.
* IPv6 address is not used upon DAD conflict.
* IPv6 neighbor discovery works as expected.
* Multicast transmission/reception is functional after interface state
changes.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
One of the test interfaces is defined as Ethernet interface, however it
was missing ethernet_init() call, hence for example interface flags were
uninitialized. This can cause issues with multicast tests, as
NET_L2_MULTICAST flag was missing on the interface.
Additionally, Ethernet-type interfaces should use struct
ethernet_context as a base for their context data, otherwise Ethernet L2
will reach to some rubbish memory locations.
Finally, since the interface now defines correct flags, all-nodes
multicast address is now added to the interface automatically as a part
of ND logic. Therefore, skip adding that address manually from
ipv6_setup().
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Restore the original LL address on the interface after tests, instead of
generating a new one, to avoid dangling link-local IPv6 on the
interface.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add more test cases verifying that MLD events/reports are sent
accordingly when interface state changes.
Introduce separate semaphores for waiting for network events, as having
a single one for transmit and events is ambiguous in tests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A support for RDNSS option should not force DNS subsystem being enabled
in the system, especially that the option is enabled by default. It
should work the other way around - the option is supported only if DNS
was enabled by the user.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The native_posix board does not work well with eventfd so disable
it with tests that use socket service API.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
The LOG_MODULE_REGISTER() was not called anywhere so if one tried
to enable logging, there was a linker error about missing logger
functions.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using net_context API directly, the mDNS responder is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Instead of using net_context API directly, the DNS resolver is
changed to use the socket service API. This allows DNS access
for offloaded sockets and can lower overall memory consumption.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
According to 'man 7 socket' about SO_PRIORITY:
Setting a priority outside the range 0 to 6 requires the CAP_NET_ADMIN
capability.
So use 6 instead of 8, in order to make UDP socket tests pass with native
offloaded sockets on native_sim platform.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
When Block-Wise transfer restarts, the post-write callback should
receive some indication that the block is actually a beginning of new,
instead of part of previous transfer.
Fixes#71351
Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
The test suite assigns LL address to the interface manually, hence need
to reapply it whenever interface goes up.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
A few tests involving TCP were missing TCP teardown delay. Adding these
improves tests stability when testing in a loop for longer periods (i.
e. with CONFIG_ZTEST_SHUFFLE enabled).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Due to recent changes, as simple k_yield() is not enough on some
platforms (nRF platforms for example), as the entropy subsystem is now
used because of PE, which may block, causing context switch before
entire RA message is processed.
Fix this by adding small delay before checking if RA was processed
properly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Remove dependency on netif for net.tls_credentials.trusted_tfm
in order to have the test fully built and executed in at least
1 platform (i.e. mps2/an521/cpu0/ns)
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
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>
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>