Commit graph

1994 commits

Author SHA1 Message Date
Jukka Rissanen
2ac66bc084 tests: net: if: Add tests for operational state change time
Make sure that the operational state change time is updated
correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-20 08:52:06 +02:00
Jukka Rissanen
7799f0c994 net: dns: Allow user to specify max answer length via Kconfig
If the default max. answer length of 512 bytes is not enough,
user can specify it by setting CONFIG_DNS_RESOLVER_MAX_ANSWER_SIZE
to suitable value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-18 09:08:41 -04:00
Jukka Rissanen
2ed2232f17 net: socket: mgmt: Create proper socket options for net_mgmt sockets
We cannot use the network management event number directly as
a socket option value because the management value is uint64_t
and that cannot be mapped directly to 32 bit integer.
So have an intermediate socket option that is mapped to actual
network management request number in getsockopt() and setsockopt().

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-18 10:54:44 +02:00
Jukka Rissanen
5a9a39caf3 net: mgmt: Convert the mgmt API to use 64-bit masks
Instead of using 32 bit enum values for event numbers, convert
the code to use 64 bit long bit fields. This means that the
user API is changed to use 64 bit event values instead of 32
bit event values.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-18 10:54:44 +02:00
Benjamin Cabé
e1d17b4a76 tests: net: lib: coap: test options with large deltas
Ensure encoding of options with large deltas works as expected by using
an "experimental" option 65100.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:40:12 +02:00
Benjamin Cabé
6dedf7dc71 tests: net: lib: coap: test options with large values
Ensure we test encoding of options that require multiple bytes to
encode their value.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:40:12 +02:00
Jukka Rissanen
cb9052459a net: dns: Properly cleanup DNS servers per network interface
Make sure we cleanup only those DNS servers that belong to
certain network interface when the interface goes down.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-06-17 16:08:56 +02:00
Keith Packard
97f96afbd7 linker_script: Remove all SUBALIGN usage for iterable sections
SUBALIGN forces alignment to the specified value, even if the object
requires stricter alignment. This causes mis-aligned access when accessing
the resulting value.

Signed-off-by: Keith Packard <keithp@keithp.com>
2025-06-17 16:06:21 +02:00
Shrek Wang
46ba523ba8 net: tcp: Align TCP seqence validation with Spec
According to RFC 793, the seqnum test includes 4 cases when STATE >
TCP_SYN_SENT:

      Seg-len Recv-win    Test
      ------- --------    ---------------------------------------
        0       0         SEG.SEQ = RCV.NXT
        0      >0         RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
       >0       0         not acceptable
       >0      >0         RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
                       or RCV.NXT =< SEG.SEQ+SEG.LEN-1 <RCV.NXT+RCV.WND

After the seq validation, the 'send duplicated ACK' code in FIN_WAIT1/
2/CLOSING/TIMEWAIT state processing is duplicated, so remove them.

Added TEST_CLIENT_SEQ_VALIDATION ztest case in tests/net/tcp.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-06-13 14:28:50 +02:00
Robert Lubos
35b1fa272d tests: net: offloaded_netdev: Add test for offloaded DNS APIs
Add test case verifying that offloaded DNS APIs are called as expected
and that enabling/disabling DNS offloading at runtime works.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-11 16:20:18 -07:00
Robert Lubos
8b7b2b5e9e tests: net: mqtt: client: Add test case for connect with iface binding
Add test case for verifying that MQTT client works fine if bound to an
interface.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-06-11 16:18:31 -07:00
Fin Maaß
ed4d421ace drivers: ethernet: remove phy related configs from eth config
remove phy related configs from eth config.
phy related configs chould go directly into the phy.
Most ethernet drivers didn't support the now removed
functions yet. Users should instead use `phy_configure_link()`
together with the `net_eth_get_phy()` function.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-06-11 10:17:37 -07:00
Shrek Wang
6e7756a542 net: tcp: Change SYN FIN to use send_data_timer
The send_queue was used as SYN/FIN packet retransmission. Before
the SYN/FIN being ACKed and dequeue-ed, the following packets in
the send_queue cannot be sent out. That's why Zephyr had to send
a FIN+ACK instead of a duplicated ACK-only in FINWAIT1, CLOSING.
In fact, we can take SYN/FIN as kind of data and use the same
send_data_timer for retransmission, like other OSes do. This way,
the send_queue is simply used for local traffics.
Benefits (in theory):
1. The code is easier,
2. TxPkt performance is better after skipping enq/deq send_queue,
3. The struct tcp{} node is a few bytes smaller, saving memory.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-06-02 13:30:19 +02:00
Robert Lubos
17c00ce868 tests: net: http_client: Increase ztest stack size
The ztest stack was too small on some platforms (e.g. nRF52840), so
increase the stack size.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-27 16:49:01 +02:00
Krzysztof Chruściński
5acd29e651 tests: all: Fix remaining issues reported by string validation
Fix issues reported by string validation which was added to strings
used in zassert macros.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-05-27 09:16:08 +02:00
Stefan Schwendeler
b234e86ca6 tests: net: lib: lwm2m: detects no-operation setter and getter functions
Test case `test_set_bulk` and `test_get_set` test the LwM2m getter and
setter function by
- init a buffer with some value
- calling lwm2m_set_... with buffer as parameter
- calling lwm2_get_... by letting `get` write-back into the same
  buffer(!)
- compare the buffer with the init value

That implementation can't recognize a no-operation getter function.

This change adds some C macro magic for both test cases where
an `out` buffer for setter and an `in` buffer for getter functions
exists. The buffers are checked before use for inequality to avoid
any unexpected pass.

Signed-off-by: Stefan Schwendeler <Stefan.Schwendeler@husqvarnagroup.com>
2025-05-23 19:49:54 +02:00
Robert Lubos
00d214c3ae tests: net: http_client: Add new testsuite for HTTP client
And some basic tests.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-23 17:20:24 +02:00
Robert Lubos
6aa8f3fe57 tests: net: socket: tls_ext: Add test case for cert veirfy cb option
Add test case to verify if TLS_CERT_VERIFY_CALLBACK socket option works
as expected.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-22 13:44:43 +02:00
Robert Lubos
0956271bc3 tests: net: socket: tls_ext: Add test case for verify result option
Add test case to verify if TLS_CERT_VERIFY_RESULT socket option works as
expected.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-22 13:44:43 +02:00
Robert Lubos
6be66aac60 tests: net: socket: tls_ext: Extract common code into functions
Extract server configuration, client configuration and test shutdown
into separate functions so that they're reusable in other tests.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-22 13:44:43 +02:00
Jordan Yates
1abe095b8e tests: net: conn_mgr_nsos: added
Add basic tests for the NSOS Connectivity Manager implementation.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-05-22 11:31:54 +02:00
Alberto Escolar Piedras
b2ee13cc12 tests/net/socket/af_packet: Fix typo
Just a typo

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-05-21 12:35:28 +02:00
Jukka Rissanen
75860479cd tests: net: ipv6: Fix deprecated address selection
Make sure the IPv6 address selection works as specified.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-05-21 09:30:22 +02:00
Shrek Wang
20489a1f18 net: tcp: Fix TCP reset issue
According to RFC793 chapter3.5 with the 'Reset Processing' part,
"In the SYN-SENT state (a RST received in response to an initial
SYN), the RST is acceptable if the ACK field acknowledges the SYN."
So, in the net_tcp_reply_rst() we should use 'ack++' if no ACK
flag but have SYN flag.
And, all the RST packet should use net_tcp_reply_rst() instead of
tcp_out().

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-21 08:01:55 +02:00
Anas Nashif
e48c90700d doc: remove more occurances of Nios II
Remove all occurances of Nios II from docs and code.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2025-05-15 20:01:05 -04:00
Robert Lubos
4512cbf509 tests: net: sockets: tls_configurations: Use fixture for openssl
Currently, creating and killing openssl process was part of the test. In
result, if the test case failed for whatever reason, the openssl process
would remain open, causing disruptions in consecutive test executions.

Fix that by defining openssl server instance as a pytest fixture. That
way, openssl process will be terminated regardless of the test
result.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-15 14:10:05 +02:00
Tomi Fontanilles
35f7eda545 modules: mbedtls: make key exchange Kconfigs depend on, not select
Turn the MBEDTLS_RSA_FULL selects into depends on.
This is how the other MBEDTLS_KEY_EXCHANGE_* Kconfig options are defined.

This is done to avoid circular dependencies.

At the same time update uses of the affected MBEDTLS_KEY_EXCHANGE_*
Kconfig options to enable/disable the dependencies which used to be
automatically handled.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2025-05-13 22:22:43 -04:00
Robert Lubos
7e093351d8 tests: net: coap_server: Adjust test filters
Add netif dependency for the test suite, as in other networking tests
and adjust minimal RAM and FLASH values.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-12 13:30:57 +02:00
Robert Lubos
1c46508c54 tests: net: dhcpv4: client: Verify Request xid
According to RFC 2131 Request message Exchange ID should be the same as
the one received in the Offer message from the server. Modify test to
verify that.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 15:55:55 +02:00
Robert Lubos
eabeb84350 tests: net: dhcpv4: client: Verify that Pad option is handled
Add Pad option to the DHCP packets generated by the fake server, to
verify the client processes them correctly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-05-08 15:55:55 +02:00
Shrek Wang
f2ef654155 net: tcp: Replace the FIN only case with FIN+ACK
According to TCP Spec. RFC793, ACK flag should be always set
after sequences of both sides are sync-ed except for RST seg-
ment. It is not necessary to send FIN only packet in the
test case, using FIN | ACK instead.
Similarly, change the tcp_out(conn, FIN | ACK) in CLOSE_WAIT.

Signed-off-by: Shrek Wang <inet_eman@outlook.com>
2025-05-06 10:50:39 +02:00
Pieter De Gendt
b596b13e7c tests: net: lib: coap_server: Add secure test
Add testcase for CoAP secure service support.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-05-01 08:53:32 -04:00
Robert Lubos
bbad01eb91 tests: net: socket: af_packet: Add more tests to verify binding
In case the receiving packet socket is not bound to any specific
interface, or is explicitly bound to "any" interface (at index 0),
it should collect packets from all interfaces. Add test cases which
verify that.

Also, if a packet socket is bound to a specific interface, it should not
receive packets from others. Add a test case to verify that as well.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-30 16:26:16 +02:00
Robert Lubos
6654f78376 tests: net: socket: af_packet: Remove unused param
iface parameter in setup_packet_socket() function was not used, remove
it to avoid confusion.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-30 16:26:16 +02:00
Robert Lubos
cd50608f24 tests: net: sockets: af_packet: Fix recvfrom DGRAM test
The recvfrom test case for DGRAM packet socket specified wrong socket
type, so RAW sockets were tested twice instead. Also, for the DGRAM
variant, the offset was not taken into account for the expected packet
length.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-30 16:26:16 +02:00
Fin Maaß
3a195a08da drivers: net: ethernet: change ETHERNET_LINK_*BASE_T
change ETHERNET_LINK_*BASE_T to ETHERNET_LINK_*BASE.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2025-04-28 09:22:09 +01:00
Jukka Rissanen
0c1dca52f4 tests: net: ipv6: Test deprecated address selection
Make sure deprecated address is selected if no other address
is available.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-25 19:00:59 +02:00
Jordan Yates
3546020178 tests: net: arp: test the packet queuing case
Test the case where the packet provided to `net_arp_prepare` is queued
for later transmission, instead of being replaced with an ARP query
or having ARP information populated.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Jordan Yates
d283130b68 net: l2: ethernet: arp: explicit error codes
Update `net_arp_prepare` to return a return code instead of a pointer,
so that the various results of the function can be differentiated.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-04-24 22:58:51 +02:00
Robert Lubos
95ac568ed0 tests: net: socket: af_packet: Extend the test suite with more tests
Add more tests cases to the AF_PACKET sockets test suite, covering the
summary of the packet socket functionalities prepared from various
sources (mostly man pages).

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
6869668cc9 tests: net: socket: af_packet: Fix test_raw_and_dgram_socket_recv test
The test case did not do what it said, it was supposed to receive data
on both RAW and DGRAM packet sockets, but instead it received on RAW
socket twice.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
9f6ac50566 tests: net: socket: af_packet: Simplify test initialization
Test interface configuration doesn't change throught the test suite
execution, therefore there's no need to reiterate the interfaces to set
the interface pointers in each test case. Do it just once, when test
suite is setup.

Also remove the __test_packet_sockets() function which seemed no longer
useful with all those simplifications.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
0a98a83387 tests: net: socket: af_packet: Switch to blocking sockets with timeout
Packet socket tests used non-blocking sockets so in results the test
code was overly complicated with delays and loops scattered all across
the test code, making it difficult to read.
As packet sockets do support blocking operation with timeout,
reconfigure the sockets to use that and simplify the test code by
getting rid of unnecessary loops and delays.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
ff801c62b1 tests: net: socket: af_packet: Increase IPv4 context instance count
Test suite prints a warning on boot about not enough IPv4 context
instances compared to the number of interfaces, therefore adjust the
config value to get rid of it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Robert Lubos
76605f813a tests: net: socket: af_packet: Make sure sockets are closed on failure
Make sure all sockets used in test are closed even in case of test
failure. Otherwise, a single test failure could derail other tests,
making the results obfuscated.

Remove redundant code related to socket creation.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2025-04-17 17:23:23 +02:00
Chaitanya Tata
7f7965e6db tests: net: wifi: Add a test for Enterprise with run-time certs
This is needed to ensure run-time certs feature builds.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-17 17:22:58 +02:00
Jukka Rissanen
8d0c16ef9c tests: net: npf: Add VLAN tests
Add tests for VLAN matching.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2025-04-16 08:07:34 +02:00
Gerhard Jörges
235a363e63 tests: net: http_server: concurrent connections
update to reflect changes in 3ebecd15615197b81efe79fcde6e4bedc0f6b09d

Signed-off-by: Gerhard Jörges <joerges@metratec.com>
2025-04-09 17:32:50 +02:00
Chaitanya Tata
63cfbadc5b tests: wifi: configs: Fix the test tags
When only changes are in the "hostap" module the wifi build tests should
be run. Add the module tag to fix that.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-09 15:22:32 +02:00
Chaitanya Tata
fea0accb84 tests: net: wifi: Move AP to a separate test
AP mode shouldn't be enabled by default, it should be a separate
category.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
2025-04-09 15:22:32 +02:00