Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
native_posix is deprecated, let's switch the
description & comments to refer to native_sim instead.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Convert users of net_buf_put() and net_buf_get() functions to use
non-wrapped putters and getters k_fifo_put() and k_fifo_get().
Special handling of net_bufs in k_fifos is no longer needed after commit
3d306c181f, since these actions are now
atomic regardless of any net_buf fragments.
Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
The nrf7002dk board's wifi chip requires blobs to build wifi driver.
Therefore it can not be built by CI. Exclude the board and its
variants from the wifi test suite.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
The MQTT publisher/subscriber/pubsub tests suites are currently
depending on an external MQTT broker being available. In result, the
test suites cannot be executed in twister and need to be run manually,
which makes them kind of pointless from the CI perspective.
This commit reworks the tests, so that they no longer rely on an
external broker being available, but rather implement minimalistic
broker functionality for test purposes only. This will make the tests
self contained, and thus executable in the CI.
Since it makes not point to duplicate the effort between the test
suites, the test suites have been merged into a single mqtt_client test
suite.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Currently existing tests suites verify MQTT 3.1.1 functionality,
therefore group them together under "mqtt/v3_1_1" directory, so
that the test base can be extended easily in the future with MQTT 5.0
tests without collision.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Fixes: #73831
find_package(Zephyr) should be called before first project() call.
Zephyr package will test and force-set the correct toolchain, especially
the C compiler.
The project() will also set the C compiler, if not set already.
If project() is called first, then conflict arises on the C compiler
selection and thus the following message is seen:
> You have changed variables that require your cache to be deleted.
> Configure will be re-run and you may have to reset some variables.
> The following variables have changed:
> CMAKE_C_COMPILER= /usr/bin/gcc
This cache deletion results in other errors, such as a missing BOARD
setting.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Tweak some Kconfig variables to reduce the overall memory footprint of
the test application. For some reason x86 MMu throws errors when
accessing iterable section entries when the image size is too large.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Beacon frames can be received with association permit bit set or not,
but the correct information should be in the data given to the
application.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
When trying to implement a testcase for the previous commit, an error
occoured, that stopped the test from executing.
As the tests require a full IPv6 stack, the usual router solicitation
(RS) messages will be scheduled by the net stack. To avoid conflict
with RS messages the active scan test must be kept shorter than one
second, otherwise a race condition with additional packages being
reported by the fake driver might occur.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
The HTTP server tests are self-contained, they do not require network
environment to execute, hence should not specify "harness: net".
The consequence of specifying the harness was that HTTP server tests in
the CI were only built, and not executed, which doesn't make much sense.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test cases verifying that request containing header frame with
priority flag set is processed properly.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add tests cases covering interaction with dynamic resources with
POST/GET requests.
Simplify HTTP2 request generation to facilitate adding more tests.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Add test case verifying that the server keeps the connection open if no
Connection: close header is present in the request.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Remove pointless helper functions, the test code can simply be included
in the test case w/o code duplication.
Clarify the naming of existing test cases. Backward compatibility simply
tests HTTP1. The upgrade test wasn't really testing HTTP upgrade, so
rename the test case too. Add a new test case actually verifying HTTP
upgrade.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Do some cleanup regarding naming used in the test suite to prepare it
for adding more test cases.
Extract common setup/teardown into respective before and after ztest
functions to simplify test code. Proper before and after functions also
ensure that individual test case failure does not disrupt other tests
operation.
Split the tests into two separate test suites, one for those which
require pre-setup and second for those which don't.
Finally, enable receive timeout on the client socket to ensure tests
won't stall in case of errors.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
"prototype" is ambiguous in this regard, as it doesn't really tell what
the test suite is testing. As tests in this test suite verify core HTTP
server functionality, rename it to "core".
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The test case for SO_BINDTODEVICE socket option was flaky, the client
socket always sent the datagram to the IP address of the second
interface, so in theory every packet should end up on that interface.
In practice though, due to imperfect loopback packet handling, the test
worked as the packet ended up on the interface it was sent from.
The test should send datagrams to the IP addresses of the interface 1
and 2 alternatively. The server socket binds to ANY address, so w/o
interface binding it should receive all datagrams, so it allows to
verify if SO_BINDTODEVICE filtering works fine.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
The standard does allow for a optional beacon payload, which gets lost
during scan, that could be interesting for the application to access
in the NET_EVENT_IEEE802154_SCAN_RESULT callback.
See section 7.3.1.6 in IEEE Std 802.15.4 for more information about
the beacon payload field. And section 7.3.1 and figure 7-5 about general
beacon frame format.
Signed-off-by: Fabian Pflug <fabian.pflug@grandcentrix.net>
As found in PR #75525, we should not modify the polled fd array
in multiple places. Because of this fix, the async version of
the socket service could start to trigger while it is being handled
by the async handler. This basically means that the async version
cannot work as intended so remove its support.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
CONTINUATION frames are tricky, because individual header fields can be
split between HEADERS frame and CONTINUATION frame, or two CONTINUATION
frames. Therefore, some extra logic is needed when header parsing
returns -EAGAIN, as we may need to remove the CONTINUATION frame header
from the stream before proceeding with headers parsing.
This commit implements the above logic and additionally adds more checks
to detect when CONTINUATION frame is expected. Not receiving a
CONTINUATION frame when expect should be treated as a protocol error.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
For HTTP2-specific structures and enums, use "http2_" prefix to clearly
indicate the distinction from the generic HTTP stuff.
Additionally, some structures/enums describing HTTP2 protocol details
had "server" in the name, while in reality they describe nothing
server-specific. Hence, drop the "server" part where applicable.
Remove unused macros.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
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>
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>
Make sure we at least build test the network socket tracing
support. The tracing tests do not enable networking so do the
socket tracing tests here.
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
For each of the fdtable.h functions listed below, convert the
z_ prefixed semi-private functions to use the zvfs_ prefix.
ZVFS stands for Zephyr Virtual File System and
is intended to be a common library used by the C library,
POSIX API, Networking, Filesystem, and other areas.
There are already a few functions in fdtable.h that use the
zvfs_ prefix, so this change is mostly about unifying them in
a way that uses a suitable prefix ("namespace") so that it can
be considered a public API.
- z_alloc_fd
- z_fdtable_call_ioctl
- z_finalize_fd
- z_finalize_typed_fd
- z_free_fd
- z_get_fd_obj
- z_get_fd_obj_and_vtable
- z_get_obj_lock_and_cond
- z_reserve_fd
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
This test explicity enables the POSIX_API which is
not compatible with native_posix.
Let's exclude this target.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add tests suite covering HTTP2 HPACK header compression and Huffman
encoding.
Note - many HPACK encoding/decoding cases in tests look similar, but
there are subtle differences in HPACK header used. For decoding, we
should be able to decode all of them. For encoding, we only test what
we support (no dynamic indexing).
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Printing event name during event processing caused unexpected delays on
slower platforms, making the tests fail. As according to the tests
author those prints were unintentional leftovers, just remove them.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
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>