Commit graph

1994 commits

Author SHA1 Message Date
Jukka Rissanen
94361d5964 tests: net: vlan: Support case where VLAN count is 0
Make sure the tests work if VLAN count is set to 0. This means
that only priority tagged (tag 0) VLAN frames can be received.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-31 16:12:50 +01:00
Robert Lubos
571d773d24 tests: net: socket: udp: Verify recvmsg buffer lengths
Make sure that buffer configuration and buffer lengths provided in
struct msghdr are left intact after being processed by recvmsg().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-30 14:09:35 +01:00
Robert Lubos
fcc8d7288f tests: net: socket: tcp: Verify recvmsg buffer lengths
Make sure that buffer configuration and buffer lengths provided in
struct msghdr are left intact after being processed by recvmsg().

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-30 14:09:35 +01:00
Jukka Rissanen
d243bc1fdb net: Fix inet_pton IPv4 implementation
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>
2025-01-29 17:56:09 +01:00
Jukka Rissanen
4c24124654 tests: net: vlan: Increase stack size for header reserve test
Increasing the stack size for header_reserved test.
This avoids stack overflow in various boards.

Fixes #84620

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-28 18:15:39 +01:00
Matt Rodgers
ea6ca4e8b7 net: http_server: allow specifying a fallback resource
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>
2025-01-28 18:14:36 +01:00
Robert Lubos
5db74f23bc test: net: lib: http_server: core: Add min_flash requirement
As the test coverage keeps growing, the test suite no longer fits into
smaller devices, hence add min_flash requirement for the test suite to
filter them out.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-28 14:13:41 +01:00
Jukka Rissanen
475ccbb983 tests: net: ipv6: Increase stack size for variable buf test
Increasing the stack size for variable_buf_size test. This avoids
stack overflow in various boards.

Fixes #84489

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-28 14:13:21 +01:00
Hake Huang
11ddf11f3b test: vlan: fix run exception for mimxrt1060_evk
add extra size for test

fixes: #84424

Signed-off-by: Hake Huang <hake.huang@oss.nxp.com>
2025-01-27 13:25:17 +01:00
Matt Rodgers
d1d85fa40b net: http_server: fix URL matching with '?' character in resource
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>
2025-01-22 13:44:01 +01:00
Jukka Rissanen
748881066f tests: net: vlan: Add VLAN tag 0 test
Make sure we are able to receive VLAN tag 0 packet, and
verify that reply packet is sent correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-22 10:47:52 +01:00
Jukka Rissanen
18cd2d83be net: pkt: Alloc headroom also for variable size data buffers
The headroom was not taken into account for variable size data
buffers when CONFIG_NET_L2_ETHERNET_RESERVE_HEADER was enabled.

Add a test case for it to make sure the reserve allocation works
properly.

Fixes #84053

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-22 10:39:23 +01:00
Robert Lubos
3e1efedac1 tests: net: coap: Add test case for matching pending replies
Add test case for matching pending replies with received responses.
Cover corner cases that are failing with the current implementation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-21 19:30:06 +01:00
Jukka Rissanen
81938f4c82 tests: net: arp: Remove the ARP cache clear from the tests
It was incorrectly introduced earlier and not really needed
because the test will pass without it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-21 19:29:55 +01:00
Samuel Chee
8d6d4de79d boards: arm: mps2: Add support for mps2/an383
Added new mps2 board an383 to enable testing with ARM FVP.
Qualifier to build/run is mps2/an383

Signed-off-by: Samuel Chee <samche01@arm.com>
2025-01-20 11:15:32 +01:00
Piotr Radecki
65f767f0e5 net: lib http: Added tests for Content-Range to http parser.
Three tests has been added for Content-Range functionality in http
parser:
- test_content_range_supplied: Checks if parser handles range correctly.
- test_content_range_asterisk_total: Checks if parser interprets
astersk as no total size supplied.
- test_double_content_range_error: Checks if parser rejects header with
repeated Content-Range field.

Signed-off-by: Piotr Radecki <piotr.radecki@jrdltd.co.uk>
2025-01-16 22:55:51 +01:00
Jukka Rissanen
71911eb041 tests: net: arp: Use documentation IP address space
Use the 192.0.2/24 address space reserved for documentation.
No functional changes by this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-16 22:37:28 +01:00
Jukka Rissanen
2f10d7d816 net: ethernet: Set the ptype by the caller in send
Instead of setting the upper protocol type in ethernet_send()
by checking the protocol type bits, use the ptype that is already
set by the caller. This allows new protocol types to be supported
and makes the system extensible.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-16 22:37:28 +01:00
Robert Lubos
7c50c0231c tests: net: http_server: core: Add tests for Server Error reply
Add tests cases verifying that the server replies with HTTP 500 Internal
Server Error reply in case of processing error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-16 14:52:10 +01:00
Robert Lubos
d32b21381b tests: net: http_server: core: Add tests for Method Not Allowed reply
Add tests cases verifying that the server replies with HTTP 405 Method
Not Allowed reply in case the client tries to access the resource with a
method it does not allow.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-01-16 14:52:10 +01:00
Chaitanya Tata
7532e73b40 tests: wifi: configs: Add a test for disable of advanced features
This feature is handy to free up some memory, so, make sure it always
builds.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-01-15 19:06:22 +01:00
Jukka Rissanen
ee22f5ed63 tests: net: http: server: Add static fs tests
Add tests for serving static files.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-01-13 20:23:18 +01:00
Matt Rodgers
b7091ed439 net: http_server: serve resources only for their defined services
Ensure that HTTP resources can only be served to a client connected on
the specific service(s) that the resource was registered against using
the HTTP_RESOURCE_DEFINE macro.

This allows different resources to be registered to different services,
for example to make some resources only available via an HTTPS service
and not via unencrypted HTTP.

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2025-01-09 14:13:57 +01:00
Seppo Takalo
4a7ef5c010 net: lwm2m: Convert tickeless to use eventfd()
For waking up the poll() use eventfd() instead of socketpair()
so we save some buffer space and one file descriptor.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-24 13:54:39 +01:00
Seppo Takalo
341f78102a net: lwm2m: Need heap for native_sim
When using tickless mode, the socketpair()
seem to use heap by default on native_sim, so
add some space for it.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-12-20 16:09:13 +01:00
Maochen Wang
f6b3a022a9 tests: net: wifi: update DPP extra confis
Remove CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE from DPP build
case.

Signed-off-by: Maochen Wang <maochen.wang@nxp.com>
2024-12-20 10:19:14 +01:00
Gerard Marull-Paretas
b51f998063 tests: fix zephyr/drivers/gpio.h usage
Only include the header if using any of the GPIO API calls/
struct/defines.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2024-12-20 03:17:25 +01:00
Jukka Rissanen
a2a0cc8074 tests: net: vlan: Add testing of link layer header embedding
Create a special Ethernet interface that supports link layer
embedding. Add a test that uses this special Ethernet interface
to verify that the L2 header is embedded to the first net_buf.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:21:28 +01:00
Jukka Rissanen
9fcf424d41 tests: net: igmp: Add re-join multicast group test
Make sure we send IGMP report when re-joining the multicast group
when interface goes up after operative down event.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-19 10:20:56 +01:00
Sylvio Alves
74d4008cc1 drivers: wifi: make WIFI_BUILD_ONLY_MODE global symbol
Convert vendor specific **_WIFI_BUILD_ONLY_MODE symbol as global
in order to provide common build flag to enable CI with no blobs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2024-12-18 18:17:16 +01:00
Robert Lubos
3be01802cf tests: net: lib: http_server: Add tests for PUT/PATCH/DELETE methods
Add additional test cases which verify that the HTTP server code can
handle PUT/PATCH/DELETE request types.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-12-18 18:15:02 +01:00
Valerio Setti
ff8b970b33 tests: tls_configurations: adjust Kconfig in overlay-ec
CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC is promptless so it cannot
be selected. Moreover it's also automatically enabled by
CONFIG_PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE in the same overlay file
so there would be no need to explicitly enable it.

As for the IMPORT, EXPORT, DERIVE they are needed for the TLS connection
to work properly. Previously it was working because at least IMPORT and
EXPORT are internally enabled by Mbed TLS at build time. So here we
are basically doing the same enablements with Kconfigs in clear.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-12-16 22:56:43 +01:00
Chaitanya Tata
6f574704b9 wifi: hostap: Remove CRYPTO default
We have now fully migrated to CRYPTO_ALT which is a superset, so, remove
unused CRYPTO module and it's related files.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2024-12-13 21:51:11 +01:00
Vivekananda Uppunda
fcbf70f44d twister: wifi: Add PSA API Wi-Fi build support to twister
This enables the PSA API support for Wi-Fi in twister test setup
for Wi-Fi.

Signed-off-by: Vivekananda Uppunda <vivekananda.uppunda@nordicsemi.no>
2024-12-13 09:13:27 +01:00
Anas Nashif
821ebc6966 tests: use net prefix for prometheus tests
Prefix prometheus tests with net.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-12-13 09:12:08 +01:00
Jukka Rissanen
d98fe73684 tests: net: dns_dispatcher: Add tests for dispatcher
Make sure that the socket service is properly unregistered when
dispatcher is unregistered.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-12-11 21:29:21 +01:00
Robert Lubos
55ea932f88 tests: net: socket: tcp: Increase system workqueue stack size
The tests overflowed system workqueue stack slightly when running on
nRF52840, increase the stack size globally for the tests to avoid
potential issues on other platforms as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-12-11 15:54:44 +00:00
Matt Rodgers
8f07784e9f tests: http_server: fix failing TLS tests due to moved certificates
Testcase uses certificates from the sample application at
samples/net/sockets/http_server. These were modified and moved into a
different folder by a previous commit, causing a build failure in the
test.

Testcase updated to:
- use new path to certificates
- update available cipher suites, since certificates now use ECDSA
- update expected hostname in certificate

The CA certificate in the sample app is also converted to .der format
for inclusion in the test (the content is exactly the same as the PEM
version, just converted to DER).

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-12-11 06:32:53 -05:00
Gerard Marull-Paretas
d4a67e321b samples, tests: remove usage of space-separated lists
Convert them to native YAML lists. Support for space-separated
lists was deprecated in Twister a long time ago.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2024-12-04 14:14:53 -05:00
Matt Rodgers
ddaeb1379a net: http_server: fix header capture on concurrent http2 streams
Concurrent HTTP POST requests on different HTTP2 concurrent streams
require that the client's header_capture_context is re-used to capture
headers on a second stream before all of the body data has been received
(and sent to the application) on the first stream.

As a result, any captured headers must be sent to the application
callback before any headers can be received on a different stream. In
practice this means that for HTTP2 the application callback is called
for the first time on receiving a headers frame, before any data frames
are received. All subsequent application callbacks will not include the
request header data.

While this mechanism is not necessary for HTTP1, it is also updated to
only send headers in the first application callback for consistency.

Fixes #82273

Signed-off-by: Matt Rodgers <mrodgers@witekio.com>
2024-12-04 14:13:24 -05:00
Pieter De Gendt
d76d7115d5 drivers: ptp_clock: Place API into iterable section
Add wrapper DEVICE_API macro to all ptp_clock_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-02 23:04:22 +01:00
Arkadiusz Balys
6464ea88fe net: openthread: Allow a platform to select a Settings backend.
Removed implying of NVS by the NET_L2_OPENTHREAD, and from now a
platform can choose between ZMS and NVS as a settings backend.
NET_L2_OPENTHREAD still requires NVS or ZMS backend so the config
depends on one of those.

Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
2024-12-02 18:18:20 +01:00
Robert Lubos
6ac2ab70a2 tests: net: misc: Use different subnets on test interfaces
The test interfaces registered addresses within the same subnet. As now
only the subnet part of the address is verified when choosing source
address or interface, it was not deterministic which interface would be
selected. Therefore, make the two interfaces use two different subnets
so that tests that verified which address/interface was used work
reliably as earlier.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-11-29 11:44:39 +01:00
Robert Lubos
0ee17d9aa3 tests: net: ip-addr: Add test case verifying default iface is preferred
Add a test case which validates that if two network interfaces are
equally good wrt net mask for LL IPv4 communication, the default
interface is preferred.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-11-29 11:44:39 +01:00
Robert Lubos
9db7f8d0a0 tests: net: ip-addr: Add test case for an IPv4 LL address selection
Add a test case verifying that a proper source IPv4 address and
interface is selected for a given LL destination address.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-11-29 11:44:39 +01:00
Jukka Rissanen
16669ec4d5 tests: net: dns: Add test for invalid DNS answer parsing
Make sure we catch invalid answer during parsing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-28 20:52:20 +01:00
Jukka Rissanen
6f96915a14 tests: net: dns: Add checking of malformed packet
Make sure we test malformed packet parsing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-28 20:52:20 +01:00
Jukka Rissanen
9332c2813e tests: net: socket: udp: Add min_flash to the test config
Add minimum flash requirement to the tests. This will effectively
exclude nrf5340dk/nrf5340/cpuapp/ns as it does not have
enough flash for the application.

Fixes #81862

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-27 10:38:15 -05:00
Jukka Rissanen
99abfda5ba tests: net: prometheus: Make sure formatter works as expected
Enhance the formatter test to verify that two metrics can be
formatted.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00
Jukka Rissanen
c7989b5747 net: prometheus: Add more parameters to metric macros
Add collector parameter to metric creation macros so that it
is possible to bind the metric to collector already at built
time.

Also add optional user_data to metric macro calls so that user
can add optional data there. This will be used by network statistics
Prometheus support in subsequent commits.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-11-26 15:42:40 -05:00