Commit graph

1680 commits

Author SHA1 Message Date
Marcin Niestroj 3a9ae1878f tests: socket: udp: reduce SO_PRIORITY from 8 to 6 for NSOS compatbility
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>
2024-05-17 11:12:43 +02:00
Seppo Takalo 6257576ce6 test: lwm2m: Enable DTLS Connection ID
Enable connection ID because it is on by default on the
client example as well.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-05-15 14:58:15 +02:00
Seppo Takalo a9e91af375 test: lwm2m: Add tests for Block-Wise transfers
Block-Wise GET, PUT and SEND

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-05-15 14:58:15 +02:00
Seppo Takalo 01b57b4999 net: lwm2m: Add offset to post-write callback
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>
2024-05-15 14:58:15 +02:00
Robert Lubos fab2f97364 tests: net: dhcpv6: Reapply LL address on iface up
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>
2024-05-14 18:20:56 -04:00
Robert Lubos f63f508c21 tests: net: sockets: tls: Add missing teardown delays
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>
2024-05-13 09:52:29 -05:00
Robert Lubos 8d221a91d0 tests: net: ipv6: Fix RA test
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>
2024-05-13 09:37:32 +02:00
Konrad Derda d397aae027 tests: net: mld: update MLDv2 tests after changes
This commit changes the expectations to checking for state transitions
in MLDv2 reports.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-05-10 11:44:50 +02:00
Valerio Setti 2e2484b9df test: tls_credentials: relax requirements for test execution
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>
2024-05-08 22:14:19 -07:00
Robert Lubos f003087e38 tests: net: all: Make sure gratuitous ARP transmission is enabled
Add you config to the build-all net tests, to make sure everything build
properly.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-05-08 16:09:31 -04:00
Pieter De Gendt db8bb9ef56 cmake: linker: Use kconfig for iterable section subalign
Replace the hard-coded 4 with the Kconfig symbol
CONFIG_LINKER_ITERABLE_SECTION_SUBALIGN .

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-05-07 18:01:37 -04: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 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 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 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
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
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
Tomi Fontanilles e141640b82 tests: net: tls: fix failures
Fix the failures introduced in #72078 by manually enabling all the
hash algorithms as they used to be.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-06 11:09:49 +02:00
Jukka Rissanen 87f45d153f tests: net: http_server: Add tests for the HTTP server
Tests for HTTP server support.

Signed-off-by: Emna Rekik <emna.rekik007@gmail.com>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-30 13:25:22 +02:00
Jukka Rissanen 07599e3a53 net: vlan: Add a function to check if interface is VLAN one
We were missing a helper function that can be used to check
whether the given function is the virtual VLAN interface.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-25 11:06:23 +00:00
Andreas Rudolf f531afbd2c net: lwm2m: Add config to always report obj version
Adds a config that enables sending the object version for all objects.

According to LwM2M specification v1.0 and v1.1, non-core object versions
other than 1.0 'must' be provided, while all other versions 'may' be
provided. With specification v1.2, a client 'can always attach Object
Version Information'. Or in other words, it is OK to always report the
object version with all specifications.

Signed-off-by: Andreas Rudolf <andreas.rudolf@husqvarnagroup.com>
2024-04-23 21:26:39 +00:00
Declan Snyder f0f83d214e drivers: ptp_clock_nxp_enet: misc fixes
1. Correct node label in k64 overlay for ptp test
   - Not sure if this actually matters since it appears
     that actual hardware is no longer tested in net tests

2. Include fsl_enet with <> instead of "".

3. Build the ptp clock driver only if the ethernet driver is built
   - Technically I think the 1588 timer should be able to be used
     even if the ethernet mac is not used, but I would imagine this
     to be an extraordinarily rare, weird, and niche use case, so to fix
     the current CI error caused by net test disabling ethernet drivers,
     couple the ptp clock driver to the ethernet driver in the build
     configuration.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-04-23 15:31:33 +02:00
Peter Mitsis 62db185d5b linker: tests: Use Z_LINK_ITERABLE_SUBALIGN
Updates the linker script fragments under 'tests' to use
Z_LINK_ITERABLE_SUBALIGN for the subalignment instead of
a hardcoded value of 4.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2024-04-20 13:45:25 -04:00
Konrad Derda b26b01bc38 tests: net: mcast_routing: add verification of multiple interfaces
This commit adds a test for veryfing new functionality of storing
mutliple interfaces per single multicast routing entry.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-17 14:39:35 +02:00
Robert Lubos 9a52efb29e tests: net: tcp: Replace test case numbers with enums
So far test cases in TCP test suite were represented by magic numbers.
With the increasing size of this test suite, it started to become
troublesome to follow, which number represents which test case or what
number can a new test case get.

Introduce a new enum for the test suite, which can be used to represent
individual test case. It simplifies adding new test cases (test case ids
are now defined in a single place, so easier to extend), and also
improves code readability.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Robert Lubos b1adbbe0be tests: net: tcp: Add test case verifying FIN with data processing
Verify, that when TCP stack received FIN packet containing data bytes,
the data is provided to the application and respective seq/ack counters
are updated respectively.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-15 12:51:52 +02:00
Seppo Takalo 51d80a9838 net: lwm2m: Allow CoAP block size to be changed
Allow changing the CoAP Block-wise transfers block-size
for subsequent GET requests.

It looks like Leshan switches block size back to its
configured value, if it is smaller.
So even when we send block N=0 with size of 512, Leshan
seem to handle that properly but still asks N=2 with
block size 256(if that is configured).

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-04-12 09:14:36 -04:00
Jukka Rissanen d40abe8c0f net: vlan: Fix net_eth_get_vlan_tag() to check correct interface
The network interface parameter for net_eth_get_vlan_tag() should
be the VLAN interface so use the search loop properly.
Earlier the main interface could be checked.

Add also test cases for this so that we can catch that the func
works properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-04-12 11:54:33 +02:00
Jonathan Rico e3ff993000 Network: L2: remove IPSP
Remove IPSP support from the tree.

It has no maintainers, and is regularly broken. The fact that it's
nontrivial to set-up in linux makes it hard to fix reported issues.

Signed-off-by: Jonathan Rico <jonathan.rico@nordicsemi.no>
2024-04-11 12:48:50 +02:00
Fin Maaß e354927895 tests: use appropriate sys_randX_get()
use the appropriate sys_randX_get() instead
of always sys_rand32_get().

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2024-04-05 10:57:45 -05:00
Konrad Derda d4dc516119 tests: net: mld: fix waiting for MLDv2 report after query
This commit fixes 'test_verify_send_report()' function as it was
not properly waiting for a MLDv2 report after sending a query. The
asserted value was set for the previous report sent after joining a
group.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-04-03 15:30:03 -05:00
Robert Lubos f211cd6345 net: tcp: Deprecate CONFIG_NET_TCP_ACK_TIMEOUT
Deprecate CONFIG_NET_TCP_ACK_TIMEOUT as it is redundant with the
combination of CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT and
CONFIG_NET_TCP_RETRY_COUNT. The total retransmission timeout (i. e.
waiting for ACK) should depend on the individual retransmission timeout
and retry count, having separate config is simply ambiguous and
confusing for users.

Moreover, the config was currently only used during TCP handshake, and
for that purpose we could use the very same timeout that is used for the
FIN timeout. Therefore, repurpose the fin_timeout_ms to be a generic,
maximum timeout at the TCP stack.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-04-03 15:32:45 -04:00
Reto Schneider 3aba7d5bc6 tests: net: buf: Better clone coverage
This commit ensures that user data get copied when cloning a buffer.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-29 16:00:39 -05:00
Robert Lubos 8e2722e1ca net: Provide separate configs for TX/RX memory pool for variable bufs
Instead of having a single config specifying the memory pool size for
variable-sized net buffers, have a separate one for TX and RX for better
configuration granularity when optimizing memory usage of the
application.

Deprecate the old configuration but use its value as a default (for now)
for the new configs. This will need to change when the config is
deleted.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2024-03-29 15:56:07 -05:00
Seppo Takalo c62dd778cd net: lwm2m: Fix socket hints for block transfer
Outgoing block-transfers now set the socket hint
to ONGOING as long as the BLOCK1/BLOCK2 header has
MORE flag set to true.
This means as only the last packet in the block-transfer
set the socket hint to LAST or ONE_RESPONSE.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2024-03-28 16:02:34 -05:00
Jukka Rissanen b06602c3f3 tests: net: vlan: Fix the socket API usage
The tests should use zsock_ APIs after the commit
0512e7ffae

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 14:45:08 +00:00
Jukka Rissanen def4a7ec12 net: gptp: Remove VLAN support
The gPTP is not suppose to be run on top of VLAN and the
earlier support was just for testing purposes. Remove VLAN
support now after the VLAN overhaul.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen c28ca1ce1f tests: net: vlan: Update because of VLAN changes
Update the tests because of the VLAN overhaul.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-28 09:41:38 +00:00
Jukka Rissanen d7c9d67a9c net: Use always zephyr/posix/fcntl.h
Changing remaining users of fcntl.h to use the include from our own
POSIX file so that the values in there are consistent in all parts
of the sources.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 66bc15d89d tests: net: lwm2m: Fix zsock_fcntl impl name
The syscall name has _impl postfix so adjusting the stub
name.

zephyr-sdk-0.16.5-1/x86_64-zephyr-elf/bin/../lib/gcc/
  x86_64-zephyr-elf/12.2.0/../../../../x86_64-zephyr-elf/bin/ld.bfd:
  app/libapp.a(lwm2m_engine.c.obj): in function `zsock_fcntl_impl':
.../syscalls/socket.h:363: undefined reference to `z_impl_zsock_fcntl_impl'

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen 0512e7ffae tests: net: sockets: Remove use of NET_SOCKETS_POSIX_NAMES
The setting is deprecated so change the code to either use the
native zsock_* API or enable POSIX_API to use the BSD socket API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen d67fb8321c tests: net: socket: tls_ext: Use POSIX_API
The test expects to use various POSIX APIs so enable the config.
Enabling POSIX_API requires also increase of max file descriptors.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 13:40:13 -05:00
Jukka Rissanen d1ef9167da net: if: Make sure no other interface has same name
When setting a name to a network interface, verify that no other
interface has the same name as that would make very difficult to
select an interface by a name.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-27 14:32:34 +00:00
Reto Schneider ddb075c398 net: buf: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Reto Schneider 8918247f37 net: buf_simple: Add support for 40 bit data type
This enables pulling and pushing values in 40 bit format.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:32:27 -04:00
Reto Schneider a924c87dc2 tests: net: buf: Test zero-sized clone
This commit ensures that copying a zero-sized buffer works.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-26 19:31:21 -04:00
Jukka Rissanen 4ac3392611 tests: net: virtual: Fix the tests
The tests are now working as expected after the virtual interface
refactoring which required changes to IP tunneling.

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
2024-03-25 17:07:43 +01:00
Reto Schneider 9dd87a7194 net: buf: Support copying of user data
This functionality is useful on the following scenario:

1) The first buffer in a net_pkt contains user data which is relevant
   for the (whole) net_pkt.
2) When inserting a new buffer in front of the net_pkt, the (previously)
   first buffer (and its user data) are no longer accessible via
   net_pkt->buffer.
3) net_buf_user_data_copy() allows to simply copy the user data from the
   old to the new first  buffer.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-25 09:32:48 +01:00
Reto Schneider 6c300c9c66 tests: net: buf: Improve testing coverage
Before this commit, cloning a buffer was tested only for a buffer
belonging to a reference counted pool.

By using a buffer from a pool that does not support reference counting,
the added test ensures that the non-ref-counting code path also works.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-22 21:01:26 -05:00
Konrad Derda 5e46a49358 tests: net: mdns: add test for external mDNS records
This commit adds a test for externally stored mDNS records for mDNS
responder.

Signed-off-by: Konrad Derda <konrad.derda@nordicsemi.no>
2024-03-22 12:41:56 +00:00