Verify that Route Info data received in Router Advertisment creates a
route and correctly populates the net_route_entry structure.
Additionally, extend the MTU on the test interface, to accomodate the
extended Router Advertisement message.
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
Move to CMake 3.20.0.
At the Toolchain WG it was decided to move to CMake 3.20.0.
The main reason for increasing CMake version is better toolchain
support.
Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
The tests/net/ipv6/src/main.c uses net_if_get_default() to get the
interface for testing. This is problematic when board introduces its own
linker script, which places board's network interface on the "default"
position - i.e. the first one.
To fix this issue - the lookup for network device defined for this test
is used instead.
Moreover, interfaces rename has been performed in a manner, which would
allow working with 'eth_native_posix' interface being added as linker
object when drivers/ethernet/eth_native_posix.c file is linked for
./zephyr/tests/net/ipv6 test on 'native_posix' board.
Signed-off-by: Lukasz Majewski <lukma@denx.de>
The net_timeout structure is documented to exist because of behavior
that is no longer true, i.e. that `k_delayed_work_submit()` supports
only delays up to INT32_MAX milliseconds. Nonetheless, use of 32-bit
timestamps within the work handlers mean the restriction is still
present.
This infrastructure is currently used for two timers with long
durations:
* address for IPv6 addresses
* prefix for IPv6 prefixes
The handling of rollover was subtly different between these: address
wraps reset the start time while prefix wraps did not.
The calculation of remaining time in ipv6_nbr was incorrect when the
original requested time in seconds was a multiple of
NET_TIMEOUT_MAX_VALUE: the remainder value would be zero while the
wrap counter was positive, causing the calculation to indicate no time
remained.
The maximum value was set to allow a 100 ms latency between elapse of
the deadline and assessment of a given timer, but detection of
rollover assumed that the captured time in the work handler was
precisely the expected deadline, which is unlikely to be true. Use of
the shared system work queue also risks observed latency exceeding 100
ms. These calculations could produce delays to next event that
exceeded the maximum delay, which introduced special cases.
Refactor so all operations that use this structure are encapsulated
into API that is documented and has a full-coverage unit test. Switch
to the standard mechanism of detecting completed deadlines by
calculating the signed difference between the deadline and the current
time, which eliminates some special cases.
Uniformly rely on the scanning the set of timers to determine the next
deadline, rather than assuming that the most recent update is always
next.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Added additonal checks in net_ipv6_input to ensure that multicasts
are only passed to the upper layer if the originating interface
actually joined the destination multicast group.
Signed-off-by: Philip Serbin <philip.serbin@lemonbeat.com>
Unit tests were failing to build because random header was included by
kernel_includes.h. The problem is that rand32.h includes a generated
file that is either not generated or not included when building unit
tests. Also, it is better to limit the scope of this file to where it is
used.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
... because it is (required).
This makes a difference when building with CMake and forgetting
ZEPHYR_BASE or not registering Zephyr in the CMake package registry.
In this particular case, REQUIRED turns this harmless looking log
statement:
-- Could NOT find Zephyr (missing: Zephyr_DIR)
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- ...
-- ...
-- ...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:8 (target_sources):
Cannot specify sources for target "app" which is not built by
this project.
... into this louder, clearer, faster and (last but not least) final
error:
CMake Error at CMakeLists.txt:5 (find_package):
Could not find a package configuration file provided by "Zephyr" with
any of the following names:
ZephyrConfig.cmake
zephyr-config.cmake
Add the installation prefix of "Zephyr" to CMAKE_PREFIX_PATH or set
"Zephyr_DIR" to a directory containing one of the above files. If
"Zephyr" provides a separate development package or SDK, be sure it
has been installed.
-- Configuring incomplete, errors occurred!
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Use the appropriate K_SECONDS() or K_MSEC() macros to pass a timeout to
k_sleep() and other kernel APIs.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Using find_package to locate Zephyr.
Old behavior was to use $ENV{ZEPHYR_BASE} for inclusion of boiler plate
code.
Whenever an automatic run of CMake happend by the build system / IDE
then it was required that ZEPHYR_BASE was defined.
Using ZEPHYR_BASE only to locate the Zephyr package allows CMake to
cache the base variable and thus allowing subsequent invocation even
if ZEPHYR_BASE is not set in the environment.
It also removes the risk of strange build results if a user switchs
between different Zephyr based project folders and forgetting to reset
ZEPHYR_BASE before running ninja / make.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
By changing the various *NET_DEVICE* macros. It is up to the device
drivers to either set a proper PM function or, if not supported or PM
disabled, to use device_pm_control_nop relevantly.
All existing macro calls are updated. Since no PM support was added so
far, device_pm_control_nop is used as the default everywhere.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This is bad practice and may conceal issues on platforms
not in the whitelist.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Now length of the UDP header is checked, and obviously these test were
avoiding setting it properly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Test case added for IPv6 neighbors. This will add more than
CONFIG_NET_IPV6_MAX_NEIGHBORS neighbors. Network stack should
remove oldest neighbor which is in STALE state and it should
add new neighbor. So call to net_ipv6_nbr_add() should succeed.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Now that legacy - and unrelated - function named net_pkt_get_data has
been removed, we can rename net_pkt_get_data_new relevantly.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
If pkt allocation fails, then prepare to handle NULL pointer.
Coverity-CID: 195835
Fixes#14409
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
It is now useless and can be replaced by net_udp_get_hdr() directly, in
the 2 unit tests it was used.
Removing as well the dbg function too_short_msg()
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
The DAD was failing because we received the DAD network packet
even when should not had received it. Fix it by discarding all
the ICMPv6 NS packets that we receive.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
The packet can be referenced somewhere else and letting the newly added
L2 header will generate corrupt packet. If the same packet is being
resent, ethernet will add again its L2 header. Thus the need to remove
such L2 header every time a packet has been sent, successfully or not.
Fixes#12560
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
If status is 0, both ip_hdr and proto_hdr will own a pointer to the
relevant IP and Protocol headers. In order to know which of ipv4/ipv6
and udp/tcp one will need to use respectively net_pkt_family(pkt) and
net_context_get_ip_proto(context).
Having access to those headers directly, many callbacks will not need
to parse the packet again no get the src/dst addresses or the src/dst
ports. This will be change after this commit.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Use the new net_pkt API to proceed through IPv6 header and all the
extension header as well.
Use udp/tcp input functions relevantly, and call net_conn_input
afterwards.
Note: This commit temporarly disable IPv6 fragmentation support
in the code directly. Which support will be re-enabled afterwards.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Move to latest cmake version with many bug fixes and enhancements.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Now it does not mangle with any ll reserver space, let's rename it to
net_pkt_lladdr_clear instead.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Valgrind reported this:
==14823== Invalid read of size 4
==14823== at 0x113FB9: memcpy (string_fortified.h:34)
==14823== by 0x113FB9: ethernet_fill_header (ethernet.c:483)
==14823== by 0x113FB9: ethernet_send (ethernet.c:588)
==14823== by 0x116720: net_if_tx (net_if.c:173)
==14823== by 0x116720: process_tx_packet (net_if.c:211)
==14823== by 0x10FDB6: z_work_q_main (work_q.c:32)
==14823== by 0x10FD55: _thread_entry (thread_entry.c:29)
==14823== by 0x111CF7: posix_thread_starter (posix_core.c:301)
==14823== by 0x49673BC: start_thread (pthread_create.c:463)
==14823== by 0x4A78E15: clone (clone.S:108)
==14823== Address 0x87822a6 is in a rw- anonymous segment
The issue is that we had a pointer that pointed to local stack
variable and that pointer was used to access stuff after the
test function had returned.
Fixes#12006
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Remove network specific default and max log level setting
and start to use the zephyr logging values for those.
Remove LOG_MODULE_REGISTER() from net_core.h and place the
calls into .c files. This is done in order to avoid weird
compiler errors in some cases and to make the code look similar
as other subsystems.
Fixes#11343Fixes#11659
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Many tests use either Ethernet or Dummy L2 and as such require
modifications towards the driver API on their fake devices.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Make sure that if network packet destination IPv6 address is
interface local scope multicast address FF01::, then those
packets must routed back to us when sending them.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Unify the function naming for various network checking functions.
For example:
net_is_ipv6_addr_loopback() -> net_ipv6_is_addr_loopback()
net_is_my_ipv6_maddr() -> net_ipv6_is_my_maddr()
etc.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Test that we drop the received packet if the destination
address is organisation scope (ff08::) multicast address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Test that we drop the received packet if the destination
address is site scope (ff05::) multicast address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Test that we drop the received packet if the destination
address is zero scope (ff00::) multicast address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Test that we drop the received packet if the destination
address is interface scope multicast address.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>