Commit graph

880 commits

Author SHA1 Message Date
Jukka Rissanen
9f17c33b60 net: sockets: Refactor because of timeout overhaul
Use k_timeout_t internally, no change to user API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen
5cf75fe091 net: websocket: Refactor because of timeout overhaul
Mention in websocket API documentation that the timeout value
is in milliseconds. Check timeout values properly using K_TIMEOUT_EQ()
macro.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Jukka Rissanen
a49741ff66 net: dns: Refactor because of timeout overhaul
Use k_timeout_t internally, no change to user API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-04-09 16:07:03 +03:00
Robert Lubos
1fb418df4c net: ieee802154_radio: Allow to specify TX mode
Even though radio driver can report in its capabilities that it does
support CSMA CA, there's no way in the driver to select how the frame
should be transmitted (with CSMA or without). As layers above radio
driver (Thread, Zigbee) can expect that both TX modes are available, we
need to extend the API to allow either of these modes.

This commits extends the API `tx` function with an extra parameter,
`ieee802154_tx_mode`, which informs the driver how the packet should be
transmitted. Currently, the following modes are specified:
* direct (regular tx, no cca, just how it worked so far),
* CCA before transmission,
* CSMA CA before transmission,
* delayed TX,
* delayed TX with CCA

Assume that radios that reported CSMA CA capability transmit in CSMA CA
mode by default, all others will support direct mode.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-04-03 14:07:41 +03:00
Johan Hedberg
b3f39226ec net: tests: Fix timeout passed to k_sleep()
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>
2020-04-01 20:03:15 +03:00
Robert Lubos
b173c177db net: mqtt: Improve PUBLISH message length validation
Identify when received PUBLISH message is malformed and overall packet
length received is smaller than parsed variable header lenght.
Add unit test to cover this case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-28 09:36:12 +02:00
Robert Lubos
1ad165a62d net: mqtt: Fix packet length decryption
The standard allows up to 4 bytes of packet length data, while current
implementation parsed up to 5 bytes.

Add additional unit test, which verifies that error is reported in case
of invalid packet length.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-03-28 09:36:12 +02:00
Torsten Rasmussen
407b49b35c cmake: use find_package to locate Zephyr
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>
2020-03-27 16:23:46 +01:00
Tomasz Bursztyka
4ae72db135 net: Enable PM settings on network devices
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>
2020-03-27 14:48:30 +02:00
Ravi kumar Veeramally
2f6bb980e8 tests: net: Improve ICMPv4 tests
Earlier tests were not going through ICMP echo
core stack handlers. Due to that unable to verify
echo reply. Tests are improved to verify replies.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-03-16 14:34:24 +02:00
Marcin Niestroj
67527ce4b7 tests: mqtt_packet: use MQTT_UTF8_LITERAL() to simplify code
Using MQTT_UTF8_LITERAL() allows to reduce code and make it less error
prone, since utf8 length is calculated automatically by the macro.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
2020-03-13 10:06:18 +02:00
Jukka Rissanen
ad4a267cbd tests: net: af_packet: Add test for binding with multiple interfaces
Add a simple test to verify that the bind() can be called multiple
times if AF_PACKET is set and there are multiple network interfaces
in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-03-10 14:58:30 +02:00
Ravi kumar Veeramally
cfd0f3e18d tests: net: Enable NET_IPV4_HDR_OPTIONS in tests
Test case for IPv4 header options was added but
CONFIG_NET_IPV4_HDR_OPTIONS option was not enabled.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-03-03 16:50:32 +02:00
Ravi kumar Veeramally
2709b14bcb tests: net: Add wrong options length case
Wrong option length in IPv4 header options testcase
added. This should cover malformed packet case.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-02-28 22:34:11 +02:00
Ravi kumar Veeramally
01867fa28c tests: net: Simple test for net_pkt clone
Added simple test case for net_pkt_clone() to verify
cursor position after cloning.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2020-02-21 16:49:14 +02:00
David D
b45b1e393c test: net: pkt: Added a test case for net_pkt_pull()
Added a test case for net_pkt_pull() with large packet buffers

Signed-off-by: David D <a8961713@gmail.com>
2020-02-03 10:47:08 +02:00
Robert Lubos
ece552c644 drivers: wifi: simplelink: Rework offloading mechanism
Switch to `NET_SOCKET_REGISTER` mechanism over the offloaded API
registration.

Including the following fixes from the review:

* The fd returned by the socket accept call needs to be finalized,
  similar to how it is done for socket creation.

* sl_RecvFrom() in TI SimpleLink Host driver does not support NULL
  pointers for 'from' address and address length, and sl_SendTo() does
  not ignore the destination address when in connection mode, so passing
  NULL would cause a failure. These issues have been reported to TI
  (CC3X20SDK-1970, CC3X20SDK-1971).

  Let's use sl_Recv and sl_Send to implement recvfrom/sendto in the case
  of NULL addresses.

* simplelink_poll() should not process negative file descriptors in the
  fds array after sl_Selecti() returns. A negative fd value indicates
  that the entry is invalid and should be ignored.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 11:36:02 -05:00
Robert Lubos
ac12066800 tests: net: mqtt: Fix failure at disconnect
It's no longer needed to call `mqtt_input` after `mqtt_disconnect`.
Doing this will actually return an error as the MQTT connection is no
longer active after calling `mqtt_disconnect`.

Fixes #22360

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-31 17:13:35 +02:00
Jukka Rissanen
b957581391 tests: net: websocket: Add TX unit tests for websocket API
Add simple tests for testing sent and received websocket data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-28 19:49:16 +02:00
Jukka Rissanen
86b688d43f tests: net: websocket: Add RX unit tests for websocket API
Add simple tests for testing receiving websocket data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-28 19:49:16 +02:00
Robert Lubos
7e7f05546d modules: nordic: Allow separate nRF 802.15.4 radio driver build
So far, nRF 802.15.4 radio driver build was dependent on the 802.15.4
subsystem in Zephyr. While this was a reasonable approach for samples,
it prevented the radio driver from being built as a standalone entity,
which could be useful in some applications (e. g. running core nRF
802.15.4 radio driver tests with Zephyr).

Resolve this, by providing a separate set of Kconfigs for the radio
driver, therefore allowing to build it as a separate entity. The 802154
subsystem simply enables the radio driver module in this case.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-28 15:18:42 +01:00
Robert Lubos
8801fd015f tests: net: ieee802154: Set LL addresses on a packet
The reworked 6lowpan implementation asserts when no LL source or
destination address is set on a packet. This caused the fragmentation
tests to fail before they completed.

Fix the issue, by setting a dummy address on a packet during a setup.

Fixes #19761

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2020-01-22 11:57:11 -06:00
Ulf Magnusson
ae900a94d0 tests: net: all: kconfig: Do not assign promptless NET_INIT_PRIO
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

NET_INIT_PRIO (defined in subsys/net/ip/Kconfig) is currently hardcoded
to 90 (it's not set via any Kconfig.defconfig files either). Maybe it
could be given a prompt or be removed, but just remove the assignment
for now.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-17 10:01:58 +02:00
Ulf Magnusson
8e4a9774f7 tests: net: all: kconfig: Do not assign promptless NET_ROUTING
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

The prompt was removed in commit 2ec7e70509 ("net: routing: Hide routing
option temporarily").

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-17 10:01:43 +02:00
Ulf Magnusson
ba98e72db2 tests: net: all: kconfig: Do not assign promptless NET_RAW_MODE
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

This symbol is selected by IEEE802154_RAW_MODE, defined in
drivers/ieee802154/Kconfig.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-16 14:34:41 -05:00
Ulf Magnusson
4d32d0ae02 tests: all: kconfig: Do not assign promptless NET_L2_IEEE802154_SUB_GHZ
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

This symbol is enabled through being selected by IEEE802154_CC1200 and
IEEE802154_RF2XX.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-16 08:05:00 -06:00
Ulf Magnusson
95e5ac11ba tests: net: kconfig: Do not assign promptless NET_L2_IEEE802154_MGMT
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

This symbol is already enabled indirectly through being selected by
NET_L2_IEEE802154_RFD, which is enabled in the configuration file.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-14 16:35:51 -05:00
Ulf Magnusson
e0848a8d61 tests: net: kconfig: Do not assign promptless NET_ROUTE symbol
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

(There doesn't seem to be any way to enable this symbol, because it's
not being select'ed either.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-13 14:19:08 -05:00
Joakim Andersson
9483e432d8 tests: net: arp: Fix net_buf assert in ARP unit test
Fix ASSERTs that appears when enabling asserts in net buf.
Asserts are:
 - Pulling from net buf before any data has been added.
 - Pulling more data than has been allocated for the buf.

Fix warning:
W: You have 1 IPv4 net_if addresses but 2 network interfaces
W: Consider increasing CONFIG_NET_IF_MAX_IPV4_COUNT value.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-13 13:59:55 +01:00
Joakim Andersson
0484c5af4d tests: net: buf: Fix byteorder test writing beyond buffer
Fix byteorder test writing past the data pointer. This would otherwise
have been caught by the assert, but net buf asserts were not enabled in
the test. Reset the buffer between different tests to re-use the same
16-byte buffer.

Turning on asserts gives:

starting test - net_buf_test_byte_order
ASSERTION FAIL [net_buf_simple_tailroom(buf) >= len] @
	ZEPHYR_BASE/subsys/net/buf.c:775
E: r0/a1:  0x00000004  r1/a2:  0x00000307  r2/a3:  0x00000000
E: r3/a4:  0x00006d79 r12/ip:  0x00000000 r14/lr:  0x000028ad
E:  xpsr:  0x61000000
E: Faulting instruction address (r15/pc): 0x000050b0
E: >>> ZEPHYR FATAL ERROR 4: Kernel panic on CPU 0

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-13 13:59:55 +01:00
Joakim Andersson
3797832030 tests: net: ipv6: Fix net_buf asserts in fragment unittest
Fix ASSERTs that appears when enabling asserts in net buf when adding
more data than has been allocated for the buf.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2020-01-13 13:59:55 +01:00
Ulf Magnusson
04f966ed3e tests: all: Remove assignment to promptless NET_GPTP_CLOCK_ACCURACY
Assignments have no effect on promptless symbols. Flagged by
https://github.com/zephyrproject-rtos/zephyr/pull/20742.

Also remove the assignments to the other NET_GPTP_CLOCK_ACCURACY_*
symbols. They are all in the same choice (in
subsys/net/l2/ethernet/gptp/Kconfig), meaning only one of them can be
enabled, and the choice already defaults to
NET_GPTP_CLOCK_ACCURACY_UNKNOWN, which is the symbol assigned last.

The symbol assigned last becomes the choice selection when multiple
symbols in a choice are assigned to. The other choice symbols still
become n. Dependencies override assignments.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2020-01-13 13:51:16 +01:00
Oleg Zhurakivskyy
8a77b53053 net: core: Drop NET_ASSERT_INFO() macro
A single assert macro can serve a purpose here.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2020-01-08 14:10:21 +02:00
Jukka Rissanen
0b7844e0be tests: net: icmpv4: Test NULL ptr in proper time
The code tried to use the allocated pkt ptr before checking for
NULL value.

Fixes #21699
Coverity-CID: 206608

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-07 19:27:11 +02:00
Jukka Rissanen
07489a1aa2 tests: net: poll: Fix the test name and add proper tag
The test name did not reflect the purpose of the test.
Also add "poll" tag so that we can more easily launch just
this test.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-03 11:26:46 -08:00
Jukka Rissanen
cbf77c1c18 tests: net: poll: Add test case for POLLOUT
We were not testing POLLOUT case so add it here.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2020-01-03 11:26:46 -08:00
Alberto Escolar Piedras
0b8678a2b0 samples & tests: Correct main() type
The application main() in Zephyr is defined as having a prototype:
void main(void), as expected by the kernel init (bg_thread_main).

So, correct the different samples and tests that were defined
otherwise.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-12-16 11:27:56 +01:00
Ravi kumar Veeramally
50631d66b9 tests: net: icmpv4: Add unit tests
ICMPv4 basic unit tests.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-12-16 11:35:24 +02:00
Ulf Magnusson
d748cb6118 tests: net: all: check_net_options.sh: Use lowercase for internal vars
This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Kumar Gala
6561b19bc5 include: Fix use of <crc.h> -> <sys/crc.h>
Fix #include <crc.h> as it has been deprecated and
should be #include <sys/crc.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Kumar Gala
24ae1b1aa7 include: Fix use of <misc/FOO.h> -> <sys/FOO.h>
Fix #include <misc/FOO.h> as misc/FOO.h has been deprecated and
should be #include <sys/FOO.h>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-12-10 08:39:37 -05:00
Luiz Augusto von Dentz
dd94be3ffc tests: buf: Add byte order tests
This adds tests for reading and writing 16, 24, 32, 48 and 64 bits in
different byte orders.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-12-10 09:55:30 +02:00
Anas Nashif
70758c4374 tests: fix test identifiers
The seasonal overhaul of test identifiers aligning the terms being used
and creating a structure. This is hopefully the last time we do this,
plan is to document the identifiers and enforce syntax.

The end-goal is to be able to generate a testsuite description from the
existing tests and sync it frequently with the testsuite in Testrail.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-12-09 15:53:44 -05:00
Ravi kumar Veeramally
434a92e48f tests: net: Fix CoAP coverity issues
Fix unintended sign extension (SIGN_EXTENSION).

The result of "coap_block_size_to_bytes() * (iter - 1)"
extending the sign type.

Issue is the conversion of iter from u8_t to int because it's
an unsigned operand in an binary subtraction with 1 which is
a signed operand with higher conversion rank (int).

Fixes #20880
Fixes #20881
Fixes #20882
Fixes #20883

Coverity CID :205780
Coverity CID :205786
Coverity CID :205806
Coverity CID :205808

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-11-26 13:35:20 +01:00
Ravi kumar Veeramally
94e048559c tests: net: Fix TCP tests Coverity issue
Check return values of function.

Fixes #20540
Coverity CID :205656

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-11-22 10:01:23 -05:00
Daniel Leung
b7eb04b300 x86: consolidate x86_64 architecture, SoC and boards
There are two set of code supporting x86_64: x86_64 using x32 ABI,
and x86 long mode, and this consolidates both into one x86_64
architecture and SoC supporting truly 64-bit mode.

() Removes the x86_64:x32 architecture and SoC, and replaces
   them with the existing x86 long mode arch and SoC.
() Replace qemu_x86_64 with qemu_x86_long as qemu_x86_64.
() Updates samples and tests to remove reference to
   qemu_x86_long.
() Renames CONFIG_X86_LONGMODE to CONFIG_X86_64.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-10-25 17:57:55 -04:00
Maksim Masalski
11d6385ebe tests: remove duplicate names for the net tests
According to the comment in #20008 I found out that some test cases
for different tests have same names.
To get rid of it, I decided to change test cases names.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-24 06:31:48 -04:00
Ulf Magnusson
9d46779ca7 net: ieee802154: kconfig: Remove unused fragmentation debugging symbol
Unused after commit a76814bfb6 ("net: Convert core IP stack to use log
levels").

Found with a script.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-22 13:10:52 +03:00
Jukka Rissanen
1f97946358 tests: net: icmpv6: Increase the TX buf counts
If the ICMPv6 test is run in real hw, we need a bit more buffers
to pass the test.

Fixes #19915

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-22 09:12:24 +03:00
Jukka Rissanen
feb6cf56f4 tests: net: shell: Increase the main stack size
Stack size might be too small when running the test in real
board like sam-e70.

Fixes #19914

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-21 09:58:56 +03:00
Maksim Masalski
03e6d3bb41 tests: updated names for the dns tests
After run Sanitycheck script I found out that
some test cases have a same test case name
in the test result .xml file.
For boards mimxrt1050_evk, qemu_x86, sam_e70_xplained
in .xml files that cases were dublicated.
Problem happened only with cases net.dns.no_ipv6.init
and net.dns.init. Only that cases were dublicated.
To solve it, I decided to change test cases names for the dns tests.

Signed-off-by: Maksim Masalski <maksim.masalski@intel.com>
2019-10-18 15:30:06 +03:00
Ulf Magnusson
2d8bd31b37 tests: net: Remove CONFIG_NET_HEADERS_ALWAYS_CONTIGUOUS assignment
This symbol is not user-configurable (has no prompt), so assignments in
prj.conf have no effect on it.

(It has no defaults either, and isn't selected/implied, so nothing in
vanilla Zephyr will ever enable it.)

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-10-18 09:13:49 +02:00
Jukka Rissanen
d500ac87c4 tests: net: tls: Increasing stack size
The default main stack is too small for some boards so increasing
it to 2048. The issue was seen with sam_e70_xplained.

Fixes #19762

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-17 17:01:23 +03:00
Jukka Rissanen
6188185c57 tests: net: tcp: Initialize TCP header properly
When constructing TCP packet, make sure the TCP header is
initialized.

Fixes #19775

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-15 11:01:20 +03:00
Peter Bigot
e28f330a8e coccinelle: standardize k_thread create/define calls with integer timeouts
Re-run with updated script to convert integer literal delay arguments
to k_thread_create and K_THREAD_DEFINE to use the standard timeout
macros.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2019-10-09 08:38:10 -04:00
Jukka Rissanen
8a4fa570ac tests: net: hostname: Set MAC address properly to all interfaces
The test creates two network interfaces, but does not set MAC
address of one of them correctly (MAC address is all zeros).
This is not good and the issue fixed in commit 9468cb6eb1
could have been revealed earlier.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-04 17:42:14 +03:00
Jan Van Winkel
9468cb6eb1 tests: net: hostname: Corrected unique hostname conversion
Replaced net_bytes_from_str in hostname_get test by a new function that
converts the unique part of the hostname in a byte array.

net_bytes_from_str can not be used as it assumes that the string input
is of the format "xx:xx:xx:xx:xx:xx" where as the unique part of the
hostname is a MAC address string without colons. If net_bytes_from_str
is used this could result in buffer overrun on the input string.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-10-02 12:52:16 +03:00
Jukka Rissanen
49a4144ac5 tests: net: hostname: Add tests for hostname set/get
Add tests that set or get system network hostname.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-20 11:42:51 +03:00
Andrew Boie
c91b9b37d0 tests: net: stop whitelisting
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>
2019-09-20 09:21:11 +03:00
Jukka Rissanen
a077bdd417 tests: net: shell: Add some simple tests for net-shell
Make sure net-shell is started properly and it does not crash.
The purpose of this test is to catch issues described in #19178
where UART was not working which was seen as net-shell crashing
at startup.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-17 22:41:56 +08:00
Jukka Rissanen
8e6aaaf919 tests: net: socket: Test that non-blocking accept() works
Mark socket non-blocking and make sure that accept() will return
immediately.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-13 10:41:33 +03:00
Jukka Rissanen
f6c5ea6c81 tests: net: dhcpv4: Increase the buffer count
Test requires more network buffers to work properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 17:33:44 +03:00
Jukka Rissanen
117d385de8 tests: net: socket: register: Fix unit tests when proto == 0
Make sure the tests pass properly if the socket() is called
with proto 0.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 11:22:45 +03:00
Jukka Rissanen
b14856589e tests: net: getaddrinfo: Logging was missing log_strdup() call
A call to log_strdup() was missing which caused tests to fail if
logging was enabled.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen
8108f06113 tests: net: getaddrinfo: Resolve using wrong address family
Make sure that resolving IPv4 address but returning IPv6 address
(and vice versa) is failing and we catch that scenario.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-11 16:17:42 +03:00
Jukka Rissanen
8fa6dfbe5a tests: net: tcp: Test connection cleanup after receiving SYN
Make sure the net_context is properly removed if done after
receiving SYN.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 22:53:12 +03:00
Jukka Rissanen
b73a3de4ed tests: net: poll: Increase the poll timeout value
Got several sanity failures with this information

Assertion failed at tests/net/socket/poll/src/main.c:76: \
  test_poll: (tstamp >= 30U && tstamp <= 30 + FUZZ is false)

In one of the failed tests, the tstamp was 50. Dunno what is
wrong here but in order to proceed with this, increasing the
timeout temporarily. This commit can be removed if the root
cause for this timeout is figured out.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Jukka Rissanen
a76b786eb6 tests: net: poll: Moving config options from yaml to conf file
Moving Kconfig options from testcase.yaml file to prj.conf so
that we can run the test app easily from command line and without
sanitycheck.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Charles E. Youse
cda625b726 drivers/ethernet/eth_dw: remove DesignWare Ethernet driver
This was only used on the Quark SoCs. It is no longer used, can no
longer be tested, and it's reliant upon the deprecated legacy PCI
subsystem. Remove it to prevent bitrot.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-09-08 22:09:10 -04:00
Ioannis Glaropoulos
571b42e74e tests: net: dns_addremove: increase main stack size
We need to increase the stack size of the main thread, to
avoid stack overflow, when executing the tests on various
platforms.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
2019-08-27 11:02:18 +02:00
Vincent Wan
fdf0af3b5a tests: net: trickle: use separate semaphore for second trickle timer
A second semaphore is used for the second trickle timer, so that if the
first timer expires twice before the second one, the test would still
wait before proceeding to check on cb_2_called.

Fixes #18598.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
2019-08-26 12:57:56 +02:00
Jan Van Winkel
029189cb68 tests: mqtt Corrected memcmp in mqtt pubsub tests
Corrected payload memcmp in function publish_handler of mqtt pusub
tests.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-08-26 11:29:53 +02:00
Tomasz Bursztyka
7ea5ec8baf tests: net: Fix for coverity CID 203499
Adding an assertion on returned allocation.

Coverity-CID: 203499
Fixes #18454

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-08-19 16:27:23 +02:00
Kumar Gala
deae969de3 tests: net: lib: dns: dns_addremove: Increase stack size for FRDM-K64F
CONFIG_MAIN_STACK_SIZE was originally 1344 in this test.  The following
commit removed setting the stack size in the test:

commit 7b3cd7d371
Author: Cami Carballo <cami.carballo@intel.com>
Date:   Fri Jul 26 10:59:16 2019 -0400

    tests: net: increase stack size

However getting the default stack size on FRDM-K64F of 512 causes the
following panic:

FATAL: ***** BUS FAULT *****
FATAL:   Stacking error
FATAL:   Imprecise data bus error
FATAL:   NXP MPU error, port 3
FATAL:     Mode: Supervisor, Data Address: 0x20002ff0
FATAL:     Type: Write, Master: 0, Regions: 0x8200
FATAL: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x00000000
FATAL:  xpsr:  0x200002f4
FATAL: Faulting instruction address (r15/pc): 0x00000000
FATAL: >>> ZEPHYR FATAL ERROR 2: Stack overflow
FATAL: Current thread: 0x2000182c (main)
FATAL: Halting system

Bump stack back to original 1344 fixes the issue.

Fixes #18292

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-08-16 09:20:45 +02:00
Jukka Rissanen
7da78796de tests: net: udp: We need to reserve enough space for the data
We are trying to pass 64-bit value to the driver, but we only
allocate space for an integer. This will not work and will cause
invalid memory access.

Fixes #18205

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-14 09:15:34 +03:00
Cami Carballo
7b3cd7d371 tests: net: increase stack size
fixes issues with tests/net when code coverage is enabled in qemu_x86

Signed-off-by: Cami Carballo <cami.carballo@intel.com>
2019-08-08 13:50:32 -07:00
Jukka Rissanen
ed10c9068e tests: net: sendmsg: Verify that connected UDP sock works
Add new tests that make sure that sendmsg() works when using
connected UDP socket and when not setting msghdr destination
address.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-08 23:13:51 +03:00
Alexander Wachter
35f01673ac net: l2: 6LoCAN implementation
This commit is an implementation of 6LoCAN, a 6Lo adaption layer for
Controller Area Networks. 6LoCAN is not yet standardised.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Alexander Wachter
c8c5f3bbf3 net: canbus: Rename canbus to canbus_raw
Rename the socket_can implementation from CANBUS to CANBUS_RAW.
This is a preperation for 6LoCAN which is a CANBUS L2 for IPv6.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Jukka Rissanen
fc79a789c7 tests: net: context: Let the net_context cb to run first
An issue was seen after changes introduced in #17933.
The net_context callback was run after we checked that it
was run ok. This test failed of course in that case. Simple
solution is to k_yield() which will make sure that the
callback gets called before we continue. This works for this
test as our threads have suitably selected priorities.
There is also no need to use K_NO_WAIT here so replacing the
timeout with K_FOREVER.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-05 16:25:18 +03:00
Anas Nashif
578ae40761 boards: remove quarl_se_c1000
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Anas Nashif
ffaba63b10 boards: remove arduino 101 and related boards
This board and SoC was discontinued some time ago and is currently not
maintained in the zephyr tree.
Remove all associated configurations and variants from the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-07-29 21:30:25 -07:00
Jukka Rissanen
d09248219d tests: net: ppp: Add unit tests for PPP driver
Make sure that we are able to parse incoming PPP data
correctly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Alexander Wachter
62ded2ded4 tests: net: 6Lo: Add test criterion HDR diff
This commit adds a test criterion that checks how many bytes
are compressed.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter
0f8c2acece tests: net: 6lo: Adapt tests to deal with headers in multiple frames
The testcases are adapted to handle more than one net buffer in
a net_pkt. After the IPHC optimization it is possible that IP header
is not in the same buffer than the UDP header.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Jukka Rissanen
c470fff3c9 tests: net: txtime: Add tests for SO_TXTIME and SCM_TXTIME
Make sure that SO_TXTIME socket option can be set and get.
Verify also that TX time is passed properly to network device
driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen
4a8154f6c1 tests: net: udp: Add tests for sendmsg() call
Make sure we are able to pass ancillary data using the
sendmsg() API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Nicolas Pitre
6609c12516 tests: enable native_posix_64 testing
Whenever conditions are applied to native_posix, they should apply to
native_posix_64 too.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-16 10:41:11 -07:00
Marc Herbert
c429051380 tests/net/: samples/net/: add a few 'userspace' tags
See commit message 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-15 09:05:10 -04:00
Jukka Rissanen
600c1d6fa7 tests: net: trickle: Adjust config options to avoid error prints
Noticed this error print when running in mps2_an385 platform.

   <err> net_if: There is no network interface to work with!

Adding CONFIG_NET_LOOPBACK=y removes this error. After this
the CONFIG_NET_IPV6_MLD=n needed to be added in order to avoid
crashes when IPv6 MLD is done which is not needed for this test.

Removed also the whitelisting as that is not really needed and
we want to run these in as many platforms as possible.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-10 18:55:37 +03:00
Jamie McCrae
3e734ddbce tests: net: lib: dns: dns_addremove
Adds test code for new net_mgmt events relating to adding and
removing DNS servers

Signed-off-by: Jamie McCrae <jamie.mccrae@lairdtech.com>
2019-07-09 17:04:55 +03:00
Jukka Rissanen
0d8b0c6714 tests: net: dhcpv4: Make sure we get DNS add/del events
Verify that DNS server add/del event is received properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-09 17:04:55 +03:00
Nicolas Pitre
d19a5f9119 net: socket: mgmt: use uintptr_t for the nm_pid field
This may contain a pointer so make sure it is sufficiently wide
on 64-bit targets.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-05 10:06:23 -04:00
Jukka Rissanen
ac56fd8d27 tests: net: Increase stack sizes for coverage testing
We need to increase the stack sizes if user enables CONFIG_COVERAGE
option. You can test this by this command

    sanitycheck --coverage -p qemu_x86 -T tests/net/udp \
                -T tests/net/mgmt  -T tests/net/mld

This is partial fix for issues described in #17323

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 09:42:44 -07:00
Jukka Rissanen
06136e5670 tests: net: socket: register: Do not close invalid fd
If the socket descriptor is invalid (fd < 0), there is no
need to try to close it.

Coverity-CID: 198949
Fixes #16785

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-04 07:23:50 -04:00
Marc Herbert
5acb622171 tests/net/ptp/clock: add 'userspace' tag
... because this test does use userspace, as seen in the source or
demonstrated by the failure of this command:

  sanitycheck --extra-args=CONFIG_TEST_USERSPACE=n

See commit message of 4afcc0f8af for the long story.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-07-04 11:44:11 +03:00
Jukka Rissanen
4bb57c481e tests: net: tx_timestmp: Fix the tests
Fix tests because of changes in TX timestamping options.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-03 09:42:45 +03:00
Jukka Rissanen
efd99e6634 tests: net: ip-addr: Avoid possible null pointer dereference
Check return value of net_if_ipv6_get_ll() before accessing it.

Coverity-CID: 199437
Fixes #17201

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-02 11:37:05 +03:00
Jukka Rissanen
3b3844a921 tests: net: socket: mgmt: Add tests for get|setsockopt()
Test AF_NET_MGMT API getsockopt() and setsockopt() functions that
they work properly when called from kernel or from userspace.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen
40ec4bc15c tests: net: socket: mgmt: Add unit tests for net_mgmt sockets
Almost the same as the net_mgmt socket sample but can be run by
sanitychecker.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00