Commit graph

1749 commits

Author SHA1 Message Date
Oleg Zhurakivskyy 851042e8e6 net: tcp2: Send TCP data to caller
Add a net_context backpointer and receiver user data to the tcp
structure. Once the desired callback and user data is set in
net_tcp_recv(), net_context_packet_received() can be called at
TCP reception in tcp_data_get(), moving the TCP data to the
recipient. IP and TCP protocol headers are sent as NULL, they
are not used by e.g. the socket code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy 2eb1bef4c8 net: tcp2: Implement TCP data sending
Since TCP needs to be able to decide how much data is to be sent
in a TCP segment and when the segment needs to be sent, the TCP
data buffer needs to be passed down to the TCP stack. For tcp2
this causes a new function handling the data as a buffer or as an
iov to be implemented and only that function is called when
sending data out via the new TCP stack. net_tcp_send_data() is
invoked as the caller expects to be informed when the data has
been sent.

For the current stack keep the sending functions as is.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Patrik Flykt bc69ae4f22 net: tcp2: Add functionality for close()
Call TCP stack net_close() when net_tcp_put() is called. Pass in
the tcp struct as argument.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy c8a1b35987 net: tcp2: Implement accept() and connect()
Register the TCP connection when accept() and connect() is called.
With the connection registration net_context will have the necessary
callback pointer set up, whereby net_context can call the proper
function when receiving packets for the TCP connecton.

With the new TCP stack this callback is always the same function.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Patrik Flykt a4ac0b024b net: tcp2: Update net_context state on established TCP connection
Update net_context state to NET_CONTEXT_CONNECTED when TCP
ESTABLISHED state is reached.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy e3d3af2768 net: tcp2: Implement net_tcp_input()
Implement net_tcp_input().

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy fd2f26ba14 net: tcp2: Implement net_tcp_finalize()
Implement net_tcp_finalize().

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Jukka Rissanen 28547b8507 net: tcp2: Logging strings need to use log_strdup()
In order not to point to stack variable, use log_strdup() for
strings that are logged.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy deb5a4c72a net: shell: Disable TCP commands for TCP2
Currently the TCP commands work only for legacy TCP.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy c7c2495682 net: context: Document net_context_packet_received()
Document net_context_packet_received().

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy 32040ce4df net: tcp2: Intercept TCP
Intercept TCP.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy 7ca983e6d3 net: tcp2: Add Kconfig and CMakeLists.txt entries
Add Kconfig and CMakeLists.txt entries.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy fb9288bf39 net: tp: Add test protocol
Add test protocol.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Oleg Zhurakivskyy 133fa0fb84 net: tcp2: Add experimental TCP
Add experimental TCP.

Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
2019-10-25 14:33:37 +03:00
Markus Fuchs 4ff6c69233 net: dhcpv4: Cancel pending DNS queries on DNS server update
On processing a DNS server option, which re-initializes the DNS resolve
context, also cancel all pending DNS queries before closing the old DNS
resolve context. Otherwise, `z_clock_announce()` will later work on the
re-initialized context once the queries expire and crash because the
reference to the timeout function `query_timeout()` has been cleared.

Signed-off-by: Markus Fuchs <markus.fuchs@de.sauter-bc.com>
2019-10-22 15:06:51 +03:00
Jukka Rissanen f98684cbcf net: shell: Unify info print when an option is not enabled
Use same format string when printing information that certain
config option is not enabled. This saves some flash as the
same string can be shared in the shell.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-22 09:11:07 +03:00
Jukka Rissanen 97b6588976 net: tcp: When closing the connection send FIN without extra delays
The earlier code was always queuing the FIN that is sent when
connection is closed. This caused long delay (200 ms) before the peer at
the other end noticed that the connection was actually closed.
Now check if there is nothing in the queue, then send the FIN
immediately. If there is some data in the queue, flush it when a valid
ack has been received.

Fixes #19678

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-17 17:02:18 +03:00
Robert Lubos 047969c0d0 net: if: Fix interface initialization with socket offloading
A socket-offloaded interface should bypass interface initialization in
the same way as net-offloaded interface does.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-10-15 11:06:40 +03:00
Jukka Rissanen 0464caef6a net: shell: Add command to clear network statistics
Needed when testing the amount of bytes transferred.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +03:00
Jukka Rissanen a779185133 net: stats: Add functions to reset the statistics
This function will be useful in shell when we want to monitor
the amount of bytes transferred and want to clear earlier
statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +03:00
Jukka Rissanen 8a0c917c92 net: shell: Print TX packet timings
Print information about how long network packets took from
application to the network device driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +03:00
Jukka Rissanen d03cb7367c net: Add statistics how long packets have spent in TX path
Calculate how long on average net_pkt has spent on its way from
application to the network device driver. The data is calculated
for all network packets and not just for UDP or TCP ones like in
RX statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +03:00
Jukka Rissanen 4f92b7b648 net: shell: Print RX packet timings
Print information about how long network packets took from
network device driver to the application.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +03:00
Jukka Rissanen 8d3b74ab61 net: Add statistics how long packets have spent in RX path
Calculate how long on average net_pkt has spent on its way from
network device driver to the application. The data is only
calculated for UDP and TCP network packets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-14 16:34:48 +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 6933248e0c net: shell: ping: Figure out the output network interface
Try to figure out where the ping reply should be sent if there
are multiple network interfaces in the system.

Fixes #19612

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-07 12:51:38 +03:00
Benjamin Lindqvist 81ccbd96c9 net: coap: Add internal init function to seed message_id
Randomly generating ID the first time coap_next_id() is called is more
in accordance with CoAP recommendations (see
https://tools.ietf.org/html/draft-ietf-core-coap-18, section 4.4)

"It is strongly recommended that the initial value of the
variable (e.g., on startup) be randomized, in order to make successful
off-path attacks on the protocol less likely."

Doing this in a dedicated init function is the cleanest and most
idiomatic approach. This init function is not exposed publically which
means it will be called only once, by the network stack init procedure.

Signed-off-by: Benjamin Lindqvist <benjamin.lindqvist@endian.se>
2019-10-04 21:22:55 +03:00
Jukka Rissanen f06fa770a6 net: shell: Print info about websocket
Add "net websocket" command that displays websocket information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-04 16:38:34 +03:00
Jukka Rissanen 6af987646f net: websocket: client: Simple API for Websocket client
Implement simple API to do Websocket client requests.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-10-04 16:38:34 +03:00
Andrew Boie fe031611fd kernel: rename main/idle thread/stacks
The main and idle threads, and their associated stacks,
were being referenced in various parts of the kernel
with no central definition. Expose these in kernel_internal.h
and namespace with z_ appropriately.

The main and idle threads were being defined statically,
with another variable exposed to contain their pointer
value. This wastes a bit of memory and isn't accessible
to user threads anyway, just expose the actual thread
objects.

Redundance MAIN_STACK_SIZE and IDLE_STACK_SIZE defines
in init.c removed, just use the Kconfigs they derive
from.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-09-30 15:25:55 -04:00
Wayne Ren 6bdeeca6f5 net: offload: When NET_OFFLOAD is enabled bypass some net_tcp functions
* The issue is found in supporting offload module esp8266
* For device like esp8266, it's responsible for tcp/udp handling,
  no need of net_tcp related functions
* This commit is only tested for esp8266, no gurantee for other
  modules

Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
2019-09-23 10:36:01 +03:00
Jukka Rissanen 2ec7e70509 net: routing: Hide routing option temporarily
Currently the CONFIG_NET_ROUTING option has limited use as there
would be some entity that populates routing table. Previously it
was RPL that did it but RPL support was removed some time ago.

Fixes #16320

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-23 10:25:11 +03:00
Jukka Rissanen 1593de9642 net: socket: Init net_context when taken into use
If we are getting an old net_context, clear the content of it
in order to make sure we do not have old data in it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-18 23:47:36 +03:00
Jan Van Winkel a4eba66ff4 net: Added missing do to net_route_info macro
Added missing do statement of the enclosing do {} while(0) statement to
net_route_info macro

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-17 11:27:19 +02:00
Jukka Rissanen 207943c2a7 net: pkt: Clone cursor position in net_pkt_clone()
We need to make sure that net_pkt_clone() sets cursor correctly.
This cursor position is needed so that we can skip IP header
for incoming packet properly. Not all applications need to know
the cursor position of the cloned packet. Unfortunately we cannot
know that in advance so just set the cursor to correct position in
the cloned packet.

Fixes #19135

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-13 16:30:02 +03:00
Jukka Rissanen 99e0ae6fd9 net: conn: Deliver multicast pkt to all interested parties
If we receive a multicast IPv4 or IPv6 packet, then we need to
deliver it to all sockets that have installed a handler for it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-12 17:33:44 +03:00
Andy Ross 643701aaf8 kernel: syscalls: Whitespace fixups
The semi-automated API changes weren't checkpatch aware.  Fix up
whitespace warnings that snuck into the previous patches.  Really this
should be squashed, but that's somewhat difficult given the structure
of the series.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Andy Ross 6564974bae userspace: Support for split 64 bit arguments
System call arguments, at the arch layer, are single words.  So
passing wider values requires splitting them into two registers at
call time.  This gets even more complicated for values (e.g
k_timeout_t) that may have different sizes depending on configuration.
This patch adds a feature to gen_syscalls.py to detect functions with
wide arguments and automatically generates code to split/unsplit them.

Unfortunately the current scheme of Z_SYSCALL_DECLARE_* macros won't
work with functions like this, because for N arguments (our current
maximum N is 10) there are 2^N possible configurations of argument
widths.  So this generates the complete functions for each handler and
wrapper, effectively doing in python what was originally done in the
preprocessor.

Another complexity is that traditional the z_hdlr_*() function for a
system call has taken the raw list of word arguments, which does not
work when some of those arguments must be 64 bit types.  So instead of
using a single Z_SYSCALL_HANDLER macro, this splits the job of
z_hdlr_*() into two steps: An automatically-generated unmarshalling
function, z_mrsh_*(), which then calls a user-supplied verification
function z_vrfy_*().  The verification function is typesafe, and is a
simple C function with exactly the same argument and return signature
as the syscall impl function.  It is also not responsible for
validating the pointers to the extra parameter array or a wide return
value, that code gets automatically generated.

This commit includes new vrfy/msrh handling for all syscalls invoked
during CI runs.  Future commits will port the less testable code.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-09-12 11:31:50 +08:00
Ravi kumar Veeramally 1a6f4a6368 net: tcp: Accept connections only in LISTENING state
Issue noticed with following scenario.

 1) TCP server is listening for connections but will handle
    only one connection at a time (e.g. echo-server sample)
 2) Client A connects, and the connection is accepted.
 3) Client B connects, instead of denying a connection,
    it is "auto" accepted (this is the actual bug) even
    if the application has not called accept().
 4) After the connection A is closed, the connection B
    gets accepted by application but now the closed
    connection A will cause confusion in the net-stack
 5) This confusion can cause memory leak or double free
    in the TCP core.

It is not easy to trigger this issue because it depends
on timing of the connections A & B.

Fixes: #18308

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-09-10 22:57:48 +03:00
Jukka Rissanen 29cae7e2fa net: tcp: Cleanup context if connection is not established
If we are closing connection before the connection was established,
then unref the context so that the cleanup is done properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 22:53:12 +03:00
Jukka Rissanen 6cf1da486d net: Add CONFIG_NET_NATIVE option for selecting native IP
Allow user to disable native IP stack and use offloaded IP
stack instead. It is also possible to enable both at the same
time if needed.

Fixes #18105

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-09-10 12:45:38 +03:00
Michael Scott a4f4f6d6f3 net: net_if: avoid deref of NULL L2
When using offloaded network, an L2 is never assigned to the net_if.
Only certain portions of the net_if code are referenced such as:
net_if_up()
net_if_down()

And these functions make use of several L2 references:
get_flags()
enable()

Let's add checks to make sure we don't deref a NULL when using these
functions.

Fixes the following exception on K64F and other HW which can make
use of offloaded network HW:
FATAL: ***** Reserved Exception ( -16) *****
FATAL: r0/a1:  0x00000010  r1/a2:  0x0000644f  r2/a3:  0x00000000
FATAL: r3/a4:  0x00000000 r12/ip:  0x2000474c r14/lr:  0x0001475b
FATAL:  xpsr:  0x00000000
FATAL: Faulting instruction address (r15/pc): 0x0001b1cd
FATAL: >>> ZEPHYR FATAL ERROR 0: CPU exception
FATAL: Current thread: 0x20004c4c (unknown)

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/18957

Signed-off-by: Michael Scott <mike@foundries.io>
2019-09-08 22:08:02 -04:00
Jan Van Winkel a219710760 net: ip: utils: Corrected memcpy length for port in parse_ipv6
Corrected the amount of bytes copied for port handling in parse_ipv6
to prevent reading past the boundaries of the input string.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-09-08 12:37:16 +02:00
Jukka Rissanen 0049c52651 net: ipv6: Check sub-option length
Make sure that the extension, like HBHO, sub-option length is
not too large.

Fixes #16323

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-27 14:02:32 +02:00
Alexander Wachter 210455a0ae net: ip: ipv6_nbr: Make LLAO length calculation more universal
This commit changes the Link-Layer Address Option length calculation
from hardcoded values to a numerical rounding up to full 8.
The length is calculated according to rfc4861 section 4.6.1.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-09 15:11:45 +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 c80407d30e net: context: sendmsg: Allow use of connected UDP sockets
If the UDP socket is connected, then allow the user to leave
out the remote address in msghdr struct.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-08 23:13:51 +03:00
Alexander Wachter 8a69b83d3f net: ip: ipv6_nbr: use temp variables for ntoh conversion
The network to host byte order conversion is actually in place
on the network buffer. This prevents the reuse and forwarding of
RA packets. This commit uses temporary variables instead.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Alexander Wachter 64d495df45 net: ip: ipv6_nbr: take TLLAO length from src lladdres
Take the targer link layer address option link laxer addres lenght
from net packets source addres instead if the interface.
This is usefull for 6LoCAN border translator (6LoCAN to Ethernet).

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +03:00
Alexander Wachter 95863a73da net: ip: net_pkt: Implement net_pkt_shallow_clone
This commit implements net_pkt_shallow_clone. A shallow clone clones
the net_pkt but not the buffers. The buffers are only referenced and
therefor only freed when both copies of the net_pkt are freed.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-08-08 13:25:01 +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
Jukka Rissanen 7c387a34ac net: context: Allow TCP to use sendmsg()
If sendmsg() is used for TCP sockets, the msghdr->msg_name is not
really used as the socket must already have been connected.
In that case just get the destination address directly from
net_context remote address field.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-08-08 09:44:50 +03:00
Ravi kumar Veeramally c8fa169294 net: Add support for SOCKS5 socket option
The SO_SOCKS5 socket option can be used by the application to
set the SOCKS5 proxy details. These details will be used when
connecting to peer.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-08-05 13:26:11 +03:00
Jukka Rissanen c4a692a85f net: ppp: Add proper support to receive Echo-Reply message
Currently only net-shell calls net_ppp_ping() command, so make
it return the amount of time that it took to receive Echo-Reply
so the net-shell can print the round trip time value.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Jukka Rissanen 19a09bf553 net: pkt: Add net_pkt_read_le16() helper
We had a big endian helper but little endian one was missing.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Jukka Rissanen 7ccc47de78 net: if: No need to set IP addresses etc for PPP
If the network interface is point-to-point one which does
not need IP address etc, then no need to start DAD etc for
those interfaces.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Jukka Rissanen 4a5543db25 net: shell: Add ppp network interface support
Print point-to-point network information properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Jukka Rissanen 4df61cd772 net: shell: Refactor network statistics printing
The traffic class printing section was too convoluted because of
many #ifdef's.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Jukka Rissanen f95938da0f net: ppp: Initial support for point-to-point protocol
This implements ppp L2 component, LCP and IPCP modules.

Fixes #14034

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-29 10:24:46 +03:00
Alexander Wachter 144dc592a6 net: ip: 6lo: Remove unnecessary net_buf allocation and memmove
This patch tries to avoid memmoves and buffer allocations when there
is enough space in the original buffer. Headers are still contiguous
but not in the same buffer.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter f10da7b643 net: ip: 6lo (IPHC) uncompression rework
This is a rework of the 6lo IPHC uncompression.
The uncompression now tries to work in place on the original buffer
instead of allocation a new one. If there is not enough tail-room,
a new buffer is allocated and filled with the IP and maybe UDP header.
The compressed header is pulled from the original buffer and the
buffer is preserved.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter 0261ecdee4 net: ip: net_pkt: Add pkt_cursor_advance before contiguous check
When net_pkt_skip skips the entire data in a net buffer, the cursor
still points to this buffer on data that is off by one.
Calling pkt_cursor_advance in net_pkt_is_contiguous fixes this and
moves the cursor to the next buffer.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Alexander Wachter 12e11b0451 net: ip: 6lo compression rework
This is a rework of the 6lo IPHC. The compression now works inline
on the original buffer instead of allocation a new one.
Additionally DAM_11 (Destination address fully elided) has precedence
over DAM_10 (16 bit compressible) now.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-07-25 15:19:28 +03:00
Jukka Rissanen 0435dce697 net: Add support for TXTIME socket option
The SO_TXTIME socket option can be used by the application to
tell the network device driver the exact moment when the
network packet should be sent.

This feature is also implemented in Linux.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen 390a6cf617 net: context: Add support for net_context_sendmsg()
After this we can implement BSD sendmsg() API.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen a0865adf25 net: context: Use const for the IP address
We are not modifying the IP address and this is needed in next
commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-24 10:17:16 +03:00
Jukka Rissanen aaafb6abba net: pkt: Allow larger packets for IPv6 fragmentation
If the allocated net_pkt is larger than the network interface MTU,
then check if the IPv6 fragmentation is enabled and allow larger
net_pkt length as the IPv6 fragmentation will split the packet into
suitable parts.

Fixes #16354

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-23 15:40:27 +03:00
Jukka Rissanen ccba1036c5 net: ipv6: Fix fragmentation
The next header was not properly set in the de-fragmented
packet.

Fixes #16354

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-23 15:40:27 +03:00
Jukka Rissanen 0ec4341277 net: pkt: Move everything up when pulling data
The net_pkt_pull() needs to move all the remaining data in the
net_buf instead of just the pull amount.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-23 15:40:27 +03:00
Jukka Rissanen 3ebe60a3ba net: ip: Helper for getting used network address family as string
This helper can be used in debugging the used network address family.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-12 12:33:19 +03:00
Tomasz Bursztyka 845f070c1e net/ethernet: Cleanup a bit on the usage of ifdefs
ARP, LLDP and GPTP functions have dummies in case of being disabled so
let's use IS_ENABLED() accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-10 15:24:32 +03:00
Tomasz Bursztyka 599450671d net/gptp: net_gptp_recv() dummy function needs to return a verdict
Since gptp is disabled in this case, let's return NET_DROP.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-10 15:24:32 +03:00
Jukka Rissanen 44d6838d2b net: ipv6: Drop pkt if src address is unspecified
If we receive IPv6 packet where source address is unspecified
(all zeros), then we need to drop it.

Fixes #17450

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-10 14:47:32 +03:00
Jukka Rissanen 868cd477d5 net: ipv4: Drop pkt if src address is unspecified
If we receive IPv4 packet where source address is unspecified
(all zeros), then we need to drop it.

Fixes #17427

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-09 21:02:27 +03:00
Tomasz Bursztyka d80d181d04 net/iface: Add IPv4 route find and add
Removing an IPv4 router was missing, as well as finding the default
router for an IPv4 address.

Note howevere that IPv4 router features are not used anywhere yet. But
at least the API is there and is a 1:1 to IPv6, if that matters.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka eccc268d0a net/iface: Rework how routers are handled
- router lifetime is always a u16_t so fixing
net_if_ipv6_router_update_lifetime() signature.
- Coalescing router timers into one: this reduces the net_if_router
structure by 22 bytes
- refactor IPv6 and IPv4 router code so it's handled in generic
functions, to avoid duplicating 90% of the code for each family. This
also fixes the lifetime support for IPv4 which was missing.

Note however that IPv4 routing support seems to be missing as none of
the relevant functions are used anywhere yet.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka b5bcd25398 net/iface: Coalesce all RS timers through one
This reduces the size of struct net_if_ipv6 by 24 bytes by moving
the k_delayed_work attribute into net_if core code.
Then each net_if_ipv6 can be added to the timer handler via a slist.

This does not make much gain if the system has only 1 network interface
It starts to be interesting if it has 2+ network interfaces then.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka 09e7262be8 net/iface: Coalesce all DAD timers through one
This reduces the size of struct net_if_addr by 24 bytes by moving
the k_delayed_work attribute into net_if core code.
Then each net_if_addr can be added to the timer handler via a slist.

This does not make much gain if the system has only 1 unicast IPv6
address. It's a nice memory improvment once it has 2+ unicast IPv6
address. Note that having IPv4 enabled along with IPv6 will also see
memory improvements since both IPv6 and IPv4 use the same struct
net_if_addr.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka 4e3a93d530 net/iface: Initialize IPv4/6 address so it removes more ifdef
Just create init functions for each IP version.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka 6a513e4394 net/iface: Reduce ifdef usage on various options
Offload, DAD, RS and IPv4 autoconf.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka cf6c5428e1 net/iface: Reduce usage of ifdef around CONFIG_NET_IPV4
Let's regroup all the IPv4 related function into one ifdef. There is no
need to implement a dummy function for each: if IPv4 is not enabled,
these functions are unused in the core.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Tomasz Bursztyka 315b47b56b net/iface: Reduce usage of ifdef around CONFIG_NET_IPV6
Let's regroup all the IPv6 related function into one ifdef. There is no
need to implement a dummy function for each: if IPv6 is not enabled,
these functions are unused in the core.

Fixes #8728

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-07-09 14:54:23 +03:00
Jukka Rissanen b68d6a9a26 net: tcp: Adjust data length if TCP options are present
Skip the TCP options before giving the data to application.
Without this, the TCP options would be passed to the application.

Fixes #17055

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-08 10:27:33 +03:00
Jukka Rissanen 77c10fc7e3 net: shell: Show network packet TX transit times
Useful when checking TX packet timings in the network stack.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-03 09:42:45 +03:00
Jukka Rissanen e809b95c51 net: Collect network packet TX send time
Finalize the CONFIG_NET_CONTEXT_TIMESTAMP support that was started
earlier but never properly finished. We collect network statistics for
TX packet network stack throughput time from when the net_context_send
is called and when the net_pkt was sent out successfully by the network
device driver.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-03 09:42:45 +03:00
Jukka Rissanen 5d13df9c3b net: utils: Add userspace support to net_addr_ntop/pton()
Allow userspace application call net_addr_ntop() and
net_addr_pton() functions.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 2da132e5e3 net: mgmt: Send event with info when applicaple
If the net_mgmt event has some info, like IP address, that
could be sent, then send it the same time. This is very useful
for the receiver of the event in order to know that is happening
in the system.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 02b3826fa0 net: mgmt: Add info length to event wait API
The info parameter is difficult to use if the caller does not
get information how long the info struct is. So add info_length
parameter to net_mgmt_event_wait_on_iface() and
net_mgmt_event_wait() APIs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 13:50:08 -07:00
Jukka Rissanen 766ad9f96c net: if: Make gateway address in net_if_ipv4_set_gw() const
As the function does not modify the parameter, we can make it const.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 7063921e87 net: if: Add userspace support to IPv4 gateway set function
Allow application to call net_if_ipv4_set_gw_by_index()
and set the gateway if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 813ae63f6b net: if: Add userspace support to IPv4 netmask set function
Allow application to call net_if_ipv4_set_netmask_by_index()
and set the netmask if enabled by configuration.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 10189332cd net: if: Make IPv4 address const in removal function
As the function does not touch IPv4 address in removal, we
can mark it const.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Jukka Rissanen 041cd5f18f net: if: Add syscall interface to IP address add and rm
Make IPv4 and IPv6 address addition and removal possible from
userspace app. But allow this only if CONFIG_NET_IF_USERSPACE_ACCESS
By default these operations are not allowed from userspace app.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-07-01 15:34:11 +03:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 536dd5a71f cleanup: include/: move misc/slist.h to sys/slist.h
move misc/slist.h to sys/slist.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 5d001f3e41 cleanup: include/: move misc/byteorder.h to sys/byteorder.h
move misc/byteorder.h to sys/byteorder.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Jukka Rissanen 034bccca20 net: Fix net_pkt_hexdump() to print pkt address properly
If immediate logging is disabled, then we must use log_strdup()
when printing log string allocated from stack.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-24 16:44:02 +03:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
David B. Kinder 2aebc980e2 doc: fix Kconfig misspellings
Fix misspellings in Kconfig files missed during regular reviews.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-06-18 15:07:52 -04:00
Jukka Rissanen 06b500b6bd net: sockets: can: Close the socket cleanly
If the socket is closed, then do CAN detach if that is needed.
This way the CAN interrupts are not received if there are no
CAN sockets listening the data.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-18 17:58:00 +03:00
Jukka Rissanen 7e37fd7203 net: connection: The connection logic was not init properly
We need to initialize the connection.c for UDP, TCP, PACKET socket
and CANBUS sockets.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-18 17:58:00 +03:00
Jukka Rissanen 1e98928424 net: shell: Print connection information properly for AF_CAN
CANBUS socket information was just printing unknown information.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-18 17:58:00 +03:00
Jukka Rissanen 0032f68669 net: context: Set local address properly for AF_CAN connections
At the moment there is no real address for local CANBUS socket,
but we can still set protocol family of local socket to AF_CAN
so that for example net-shell "net conn" command can show
information about it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-18 17:58:00 +03:00
Jukka Rissanen 6621491014 net: sockets: can: Add dispatcher
We need to dispatch the received CAN frame if there are multiple
sockets interested in the same CAN-IDs.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-18 17:58:00 +03:00
Jukka Rissanen bf0f52dc4c net: nbr: Set the link address type when saving neighbor data
The neighbor cache did not contain link address type. This is not
causing problems atm but good to fix anyway.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-13 19:47:31 +03:00
Jukka Rissanen d20c6f96e6 net: utils: Print pkt address in net_pkt_hexdump()
It is useful in debugging if net_pkt pointer value is printed
in net_pkt_hexdump().

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-13 19:46:54 +03:00
Jukka Rissanen 343bdd3e3a net: if: Fix null pointer deref when selecting IPv4 address
It is possible that iface is NULL when selecting IPv4 destination
address for a sent packet.

Coverity-CID: 198877
Fixes #16570

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-06-12 14:50:38 -04:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Tomasz Bursztyka e9a4ef2b0a net/udp: Always drop IPv6 UDP packet if checksum field is 0
Missing checksum is only valid in IPv4 and only on certain context.

Fixes #16483

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-30 13:02:25 +08:00
Tomasz Bursztyka a5b90a4aad net/udp: Check UDP header's length attribute
Length should be at least of UDP header size but not bigger than actual
payload size.

Reported-by: Ruslan Mstoi <ruslan.mstoi@intel.com>

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-30 13:01:30 +08:00
Tomasz Bursztyka 274db4f33d net/udp: Accept UDP packet with missing checksum
Having a checksum of zeros in UDP means "missing checksum" and is a
valid case as per RFC 768:

"An all zero transmitted checksum value means that the transmitter
generated no checksum (for debugging or for higher level protocols
that don't care)."

Such support is made possible by adding a new Kconfig option named
CONFIG_NET_UDP_MISSING_CHECKSUM.

However, that is valid only for IPv4. For IPv6, see the RFC 2460
section 8.1:

"Unlike IPv4, when UDP packets are originated by an IPv6 node, the UDP
checksum is not optional."

So the UDP checksum will always be verified in IPv6.

Fixes #16375

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-27 20:58:53 +08:00
Tomasz Bursztyka 770625826c net/udp: Computed checksum field should not be 0
From RFC 768, in "Fields":
"If the computed  checksum  is zero,  it is transmitted  as all ones"

Fixes #16379

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-27 20:58:53 +08:00
Jukka Rissanen ecac10cb47 net: shell: Refactor help information for ping command
Do not always print general help for ping cmd. Only if user supplies
'-h' or '--help' command, print information about the parameters.
After this the generated HTML documentation looks better for the
ping command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-23 22:12:23 +03:00
Jukka Rissanen d13039f80f net: shell: Remove leading underscore from parse_args()
The leading underscore in function names should not be used
because of Misra rules.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-23 22:12:23 +03:00
Jukka Rissanen 29b55f860e net: shell: Indentation fixes for ping command
Fix the indentation of code for the ping command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-23 22:12:23 +03:00
Jukka Rissanen 6f79b019c4 net: if: Select global IPv4 address if needed
The net_if_ipv4_select_src_addr() should return global address
in the interface if nothing else is being found.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 15:37:53 +03:00
Tomasz Bursztyka 426764ebcf net/iface: Add a function to get IPv4 global address
As for IPv6, let's create the same function on IPv4 side.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-21 15:37:53 +03:00
Tomasz Bursztyka 979aedfab4 net/iface: Modify function to get IPv6 global address
Let's filter out on a state parameter.

There is no impact as this function is not used anywhere yet.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-21 15:37:53 +03:00
Jukka Rissanen 60cb25d198 net: ipv4: Send multicast ICMPv4 reply with correct src address
If we receive a multicast ICMPv4 packet, then send the reply back
with correct source address and not with multicast address.

Fixes #16257

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-21 15:37:53 +03:00
Jukka Rissanen b800737f72 net: ipv4: Allow UDP packets with broadcast dst address
Make sure we are able to receive UDP packets with broadcast
destination address. If CONFIG_NET_IPV4_ACCEPT_ZERO_BROADCAST
is set, then check here also non-standard broadcast address
that is described in RFC 1122 chapter 3.3.6.

Fixes #11617

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-20 14:11:11 +03:00
Sebastian Bøe c2c8c849b6 cmake: Don't have users call zephyr_link_interface on mbedTLS
Libraries that use mbedTLS have been invoking
zephyr_link_interface(mbedTLS). It is not clear what the intent of
this code has been, but it is redundant with the mbedTLS build
scripts, so it can be safely removed.

In addition to being redundant, it causes problems as it introduces an
ordering dependency, with this code mbedTLS must be declared before
users of mbedTLS are declared. Since this code is redundant, this
ordering dependency is also unnecessary.

This code is believed to have been added early on by accident and
copied through cargo-cult programming since.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-05-11 08:35:26 -04:00
Robert Lubos 2de06b4b3c net: Avoid calling L2 functions on offloaded interface
Calling functions like `net_if_start_dad`, `join_mcast_nodes` or
`net_if_start_rs` lead to L2 API function calls, which is not correct
for offloaded interfaces and leads to a crash. This is especially
problematic, as they are called in the default configuration.

Avoid calling these functions while an offloaded interface is brought up
by adding extra jump label.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-05-10 10:07:26 +03:00
Robert Lubos cd07a30c51 net: Allow to disable native IP stack with socket offloading
In case socket offloading is used, one might want to disable native IP
stack, both IPv4 and IPv6, to save memory. Currently it is not possible
due to preprocessor check. Prevent that by adding additional exception
for socket offloading.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-05-10 10:07:05 +03:00
Jukka Rissanen 9a6bbbfb69 net: Check device driver API pointer
It is possible that the device driver API pointer is null.
For example if the device driver returns an error, the device
code will make the API pointer NULL so that the API would not
be used. This can cause errors in networking code where we
typically do not check the NULL value.

Fixes #15003

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-05-07 15:41:15 +03:00
Tomasz Bursztyka 9a6e3012da net/connection: Final cleanup
- renaming functions to better names
- reordering functions place (register, then unregister for instance)
- centralizing logs to relevant place

Fixes #8722

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Tomasz Bursztyka d652a1e809 net/connection: Merge rank bits into flags attribute
Also, there is no need for unspecified address bit. If specified address
bit is not set, then it will be obvious address is unspecified. Reducing
the amount of bits from 6 to 4.

This permits to reduce net_conn structure of 4 bytes. Its size is as
before indroducing node attribute.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Tomasz Bursztyka d85aabe2a6 net/connection: Use slist to manage used/unused connections
This will optimize path when unused an connection is required or when
looking up a used one.

That said, at this stage, it bloats up the net_conn structure with 4
added bytes. More optimization will overcome this drawback.

Fixes #8722

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Tomasz Bursztyka de6fd24e96 net/connection: Reduce usage of #ifdef
Most of present #ifdef can be removed via using IS_ENABLED() macro.

Only small part of cache related logic still require #ifdef.

Fixes #8722

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Tomasz Bursztyka b2b21412ae net/connection: Removing cache feature
There were various flaws in it that motivated its removal:

- No hash collision handling mechanism. In case that would happen, the
behavior of the network connection would be unknown. This is the main
drawback
- The lookup is not that much more efficient than the default one. The
only difference of gain is in connection comparison (a u32t comparison
vs a full connection compare). But the list handling is the same. It's
made worse by the presence of a negatives match array which can be
easily filled in and becomes then fully usless, appart from consuming
CPU. As well as adding a new connection: it requires the whole cache
to be cleared which is unefficient.
- Not memory efficient, even compared to a proper hash table.
Two arrays instead of one etc...

All of this could be fixed by using a proper hash table, though it
remains to be seen if such object could fit in Zephyr core.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:53 +03:00
Tomasz Bursztyka dea1cdfdea net/context: Reordering some ipv4/6 logic to follow all other places
During net_pkt/net_context API changes, some ip handling blocks were
ordered ipv4 first, ipv6 second. While it is the contrary everywhere
else. So reordering to get things consistent.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:33 +03:00
Tomasz Bursztyka 6fee12619f net/context: Reduce the usage of #ifdef/#endif
- Not all #ifdef can be removed: those which have a dedicated attribute
in struct net_context.
- For CONFIG_NET_CONTEXT_CHECK: switching the NET_ASSERT_INFO to
NET_DBG (simpler to read and anyway an error code is returned)

Fixes #8725

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-05-07 15:40:33 +03:00
Luiz Augusto von Dentz 95cadb7bfe net: bt: Add multi-link support
This adds support for having multiple connections based on BT_MAX_CONN.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2019-05-07 11:16:29 +03:00
Jukka Rissanen 3d8fe9a8fa net: core: In RX check if the pkt is for loopback interface
If the loopback driver is enabled, then the packet might come
from localhost in which case mark it properly. Without this marking
the packet from/to 127.0.0.1 or ::1 would be dropped in later checks.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-30 09:56:01 -07:00
Ravi kumar Veeramally 543eecb9a5 net: shell: Add VLAN tag stripping to capabilites
VLAN tag stripping flag added to ethernet_capabilities
print in net shell.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:46:27 +03:00
Ravi kumar Veeramally 25309eb356 net: ipv6: Trivial changes in fragmentation debug
Values are misleading when debugging IPv6 fragmentation.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-04-26 10:45:45 +03:00
Benjamin Valentin 812b999731 net: shell: Improve the output of the ping function
Report rtt, ttl and rssi if available.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-26 09:05:14 +03:00
Benjamin Valentin 7c09695344 net/icmpv6: Allow for arbitrary payload data in ICMP echo
Allow for including arbitrary data in net_icmpv6_send_echo_request()
that will be echoed verbatim by the receiver.

This allows to use ICMP echo for diagnostic use cases, e.g. by testing
packet framentation (large payload) or measuring round-trip-time.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-26 09:05:14 +03:00
Benjamin Valentin dd65cfb533 net/icmpv4: Allow for arbitrary payload data in ICMP echo
Allow for including arbitrary data in net_icmpv4_send_echo_request()
that will be echoed verbatim by the receiver.

This allows to use ICMP echo for diagnostic use cases, e.g. by testing
packet framentation (large payload) or measuring round-trip-time.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-04-26 09:05:14 +03:00
Benjamin Valentin b938324345 net/icmpv4: Include icmp_hdr in callback
Allow accessing already parsed information from the ICMP header
that callbacks might be interested in.

This makes the callback signature and behaviour match that of
the ICMPv6 implementation.

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
2019-04-26 09:05:14 +03:00
ling wei cdebd81994 net: trickle: Re-init trickle timer for multiple triggerings
We need to re-initialize the trickle->timer delayed work to use
trickle_timeout() if there are multiple triggerings.

Fixes #15606

Signed-off-by: ling wei <lingwei@cisco.com>
2019-04-24 12:54:48 +03:00
Jukka Rissanen 3633951652 net: if: Only start the network interface during init if needed
If the NET_IF_NO_AUTO_START network interface flag is set, then
do not take network interface up during the initialization of the
network interface. The network device driver can set the flag in its
network interface initialization function if needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 13:11:03 +03:00
Jukka Rissanen 712103d594 net: if: Add access functions for network interface flags
Provide access functions for manipulating network interface flags.
There is no need for the caller of this API to know about the inner
details of the flags.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-23 13:11:03 +03:00
Patrik Flykt 91ca8aabc8 net/ip/dhcpv4: Set source IP address in DHCP Request
The source address in unicast DHCPv4 Request packets was found out
to be all zeros address 0.0.0.0. This address is only acceptable if
the destination is a multicast one, where the host in question is
acquiring a DHCP address lease. This is true for the DHCP Discover
and the initial DHCP Request message from the client towards the
server. As subsequent DHCP Request renewal messages are sent as
unicast to the server, the server will drop such packets.

Fix this issue by explicitely specifying what source IP address is
to be used, if none is specified, the all zeros address 0.0.0.0 is
used in multicast addresses. The source address in the other
unicast cases is identical to the 'ciaddr' in the DHCP message.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-17 10:35:38 -05:00
Alexander Wachter c204f70540 net: increase mgmt event stack size
Increase the default mgmt event stack size from 512 to 768 because of
stack overflows.

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
2019-04-09 15:35:41 -04:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
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>
2019-04-07 08:45:22 -04:00
Andrew Boie 4e5c093e66 kernel: demote K_THREAD_STACK_BUFFER() to private
This macro is slated for complete removal, as it's not possible
on arches with an MPU stack guard to know the true buffer bounds
without also knowing the runtime state of its associated thread.

As removing this completely would be invasive to where we are
in the 1.14 release, demote to a private kernel Z_ API instead.
The current way that the macro is being used internally will
not cause any undue harm, we just don't want any external code
depending on it.

The final work to remove this (and overhaul stack specification in
general) will take place in 1.15 in the context of #14269

Fixes: #14766

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-04-05 16:10:02 -04:00
Patrik Flykt 4aa48833d8 subsystems: Rename reserved function names
Rename reserved function names in the subsys/ subdirectory except
for static _mod_pub_set and _mod_unbind functions in bluetooth mesh
cfg_srv.c which clash with the similarly named global functions.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Tomasz Bursztyka 16dd53b5a5 net/core: Initialize network services only after the stack
DNS is not part of L3, but as dhcpv4 or the net shell, it is a services
on top of the network stack. So let's gather all in a dedicated
function.

This also rework the order when starting the DNS service. There was an
issue for offload device: these would be fully initialized in
init_rx_queues() which was called after l3_init. l3_init had already
started dns: which would not be able to bind correctly, proving to be
fully dead afterwards. Instead, starting the dns at the very end
ensures that all is initialized properly from devices to stack.

Fixes #15124

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-04-03 09:32:39 -04:00
Tomasz Bursztyka eea0f6f8f0 net/dhcpv4: Avoid ifdefs when using net_dhcpv4_init()
Just provide a macro of value 0 in case CONFIG_NET_DHCPV4 is unset.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-04-03 09:32:39 -04:00
Tomasz Bursztyka 26a335c2e8 net/ipv6: Fix IPv6 fragment nexthdr field in case of no option headers
With or without options headers it has to work. Currently it was
setting always hop-by-hop next header which is obviously wrong but
worked on ipv6_fragment test since that one has only packets with
optional headers (hop-by-hop in that case has to be the first optional
header).

Fixes #14622

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-04-02 13:18:46 -04:00
Jukka Rissanen 1eead93a48 net: tcp: Do not mark TCP segment not sent in net_if
If the TCP segment is not sent properly by L2, then do not mark
it "not sent" in net_if.c:net_if_tx(). That "not sent" marking
confused TCP ref counting in tcp.c:tcp_retry_expired() and caused
the packet to be freed too early which then caused free net_buf
access issue during packet resend. This free memory access was
seen with zperf sample application.

From TCP point of view, the packet can be considered sent when
it is given to L2. The TCP timer will resend the packet if needed.

Fixes #15050

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-01 12:39:32 -04:00
Jukka Rissanen 30d31936a0 Revert "net: tcp: Fix ref counting for the net_pkt"
This reverts commit 9cd547f53b.

The commit we are reverting, fixed originally the issue that was
seen with zperf. There we freed the net_pkt too early while it was
still waiting for a TCP ACK. The commit 9cd547f5 seemd to fix that
issue but it was causing issues in dump_http_server sample app which
then started to leak memory. No issues were seen with echo-server
with or without the commit 9cd547f5.

So the lessons learned here is that one needs to test with multiple
network sample apps like dump_http_server, echo_server and zperf
before considering TCP fixes valid, especially fixes that touch
ref counting issues.

Fixes #15031

The next commit will fix the zperf free memory access patch.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-04-01 12:39:32 -04:00
Patrik Flykt 21358baa72 all: Update unsigend 'U' suffix due to multiplication
As the multiplication rule is updated, new unsigned suffixes
are added in the code.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Jukka Rissanen 9cd547f53b net: tcp: Fix ref counting for the net_pkt
The network packet ref count was not properly increased when
the TCP was retried. This meant that the second time the packet
was sent, the device driver managed to release the TCP frame even
if we had not got ACK to it.

Somewhat long debug log follows:

The net_pkt 0x08072d5c is created, we write 1K data into it, initial ref
count is 1.

net_pkt_write: pkt 0x08072d5c data 0x08075d40 length 1024
net_tcp_queue_data: Queue 0x08072d5c len 1024
net_tcp_trace: pkt 0x08072d5c src 5001 dst 5001
net_tcp_trace:    seq 0x15d2aa09 (366127625) ack 0x7f67d918
net_tcp_trace:    flags uAPrsf
net_tcp_trace:    win 1280 chk 0x0bea
net_tcp_queue_pkt: pkt 0x08072d5c new ref 2 (net_tcp_queue_pkt:850)

At this point, the ref is 2. Then the packet is sent as you see below.

net_pkt_ref_debug: TX [13] pkt 0x08072d5c ref 2 net_tcp_queue_pkt():850
net_tcp_send_data: Sending pkt 0x08072d5c (1084 bytes)
net_pkt_unref_debug: TX [13] pkt 0x08072d5c ref 1 (ethernet_send():597)

Ref is still correct, packet is still alive. We have not received ACK,
so the packet is resent.

tcp_retry_expired: ref pkt 0x08072d5c new ref 2 (tcp_retry_expired:233)
net_pkt_ref_debug: TX [10] pkt 0x08072d5c ref 2 tcp_retry_expired():233
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 1 ... (net_if_tx():173)
net_pkt_unref_debug: TX [10] pkt 0x08072d5c ref 0 ... (net_if_tx():173)

Reference count is now wrong, it should have been 1. This is because we
did not increase the ref count when packet was placed first time into
sent list in tcp.c:tcp_retry_expired().

The fix is quite simple as you can see from this commit.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-26 07:29:26 -05:00
Ravi kumar Veeramally f361859fde net: ipv6: Fix IPv6 neighbor table
This patch fixes following issues.

  * If IPv6 neighbor table is full, stack can not add any new
    neighbors. So stale counter is introduced. Whenever neighbor
    enters into STALE state, stale counter will be incremented
    by one. When table is full and if stack wants to add new
    neighbor, oldest neighbor in STALE state will be removed
    and new neighbor will be added.

  * When neighbor is in PROBE state and when it exceeds max
    number of PROBEs, only neighbor with router is removed.
    As per RFC 4861 Appendix C, entry can be discarded. Now
    neighbor will be removed from the table.

  * Reachability timer has an issue. e.g. if a first entry timer
    is 10 seconds, after 3 seconds, a new entry added with
    only 3 seconds. But current implementation does not check
    whether remaining time of current left over timeout is more
    than new entry timeout or not. In this example, when new entry
    timeout is 3 seconds, left over timeout from first etnry is
    still 7 seconds. If k_delayed_work_remaining_get() returns
    some value then new entry time out was not considered.
    Which is bad. It fixed now.

  * nbr_free is used sometimes to remove the neighbor. Which does
    not remove route if that particulat neighbor is route to some
    other neighbor. net_ipv6_nbr_rm() should be used in such places.

  * Trivial changes which does not affect functionality.

Fixes #14063

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-25 22:49:52 -04:00
Jukka Rissanen a8b1dadac5 net: connection: Allow same port number for dest and source
Fix regression and allow incoming packet when source and
destination port numbers are the same.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-25 22:44:43 -04:00
Tomasz Bursztyka c0de64fc59 net/ipv6: Take iface's MTU into account to decide fragmenting or not
In case of Ethernet for instance, the MTU is larger than the minimal
IPv6 MTU, so it is not required to fragment a packet that fits in
Ethernet MTU.

Fixes #14659

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-25 22:33:41 -04:00
Charles E. Youse 8e85d7d6c0 net/ip: fix input packet filtering criteria
The "is this packet for us?" filter in net_ipv4_input() has a minor
logic error which fails to discard many packets which are.. not for us.

Fixes: #14647

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
2019-03-20 16:37:12 -05:00
Jukka Rissanen bf8d391ad4 net: context: Check if we run out of mem
The context_alloc_pkt() might run out of memory, and if that
happens we must not try to set the context pointer in it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-20 16:32:16 -05:00
Paul Sokolovsky 69afd80a3d net: ip: connection: Typo fixes in comment
Fix typos and reword code comment on module dependencies a bit.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-20 16:24:05 -05:00
Tomasz Bursztyka 1a98d4d1fe net: Move the chksum offload verification to relevant places
Since the new packet flow came in, payload comes at the end so udp
length for instance is known only when we "finalize" the packet.
However such finalization was still under the condition of chksum
offload, like it used to be in the former flow (udp headers were
inserted). This is obviously wrong but that was not caught with
existing driver in master as none of these drivers offloading
chksum calculation.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 11:34:14 -05:00
Michael Scott 4f707ae896 net/context: Relocate offload handling in net_context_connect()
Commit fc27a81ed2 ("net: context: Select proper network interface
when binding") moved the bind_default() call to after the remote
address was set for the net_context.

This and a later net_pkt API refactor broke net_offload() handling
so that context->iface wasn't set and context->flags didn't have
NET_CONTEXT_REMOTE_ADDR_SET correctly.

Let's fix this by relocating the net_offload handling to after
these have happened.

Signed-off-by: Michael Scott <mike@foundries.io>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 84909970a0 net/pkt: Remove unused legacy net_pkt allocator
Now, only net_pkt_alloc and variants are used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 89c4a4a26f net/context: Re-enable offloaded send/sendto
net_offload API is left untouched, so it still takes a net_pkt as input
for the buffer. This is under-optimized since offload drivers will copy
the data from that net_pkt back into contiguous buffer again.
Let's tackle this issue another time.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 730b5de6d9 net/pkt: Remove superfluous total_pkt_len attribute
This attribute, in case CONFIG_NET_STATISTICS is enabled, made sense
when L2's send() function did not return the length of the sent packet.
But now, it's a superflous optimization as is it used only to set the
stats on recv or send, where net_pkt_get_len() can be used directly.

This helps to save 2 bytes from struct net_pkt.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 03bfc5dd0f net/context: Remove token parameter from net_context_send/sendto
And also to the relevant callbacks.

That parameter is not used anywhere so it is useless.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 7d97a1871a net/pkt: Remove unused token attribute
Seems like a useless attribute. Since net_context is not being used by
the user directly (socket is the unique interface now) and since no core
parts uses the token parameter of net_context API: let's remove the
attribute.

This helps to save 4 bytes from struct net_pkt.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 39504c2560 net/pkt: Remove legacy net_frag_linear_copy function
This function is now superseded by net_pkt_read() and is no longer
used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka ec3fe5560b net/pkt: Remove legacy net_pkt_append functions
These were based on the former allocation scheme and are no longer used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 23b753feed net/pkt: Remove legacy net_frag_read/skip/get_pos functions
These were based on the former allocation scheme and are no longer used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka d6d52ce9e5 net/pkt: Remove _new suffix to net_pkt_write functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka a15654980e net/pkt: Remove legacy net_pkt_insert functions
These were based on the former allocation scheme and are no longer used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka ea518af5dd net/pkt: Remove legacy net_pkt_write functions
These were based on the former allocation scheme and are no longer used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka a25f054cbd net/pkt: Remove _new suffix to net_pkt_read functions
Suffix is now useless, as these functions are now the only ones.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka f8a091104e net/pkt: Remove _new suffix to net_pkt_get_data_new function
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>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 2022aa3484 net/pkt: Remove now useless net_pkt_get_data()
That function was responsible for allocating new buffer element, but it
is now unused and can be removed safely. Buffer allocation is now done
via net_pkt_alloc_buffer().

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 7e4f03aabe net/icmpv4: Remove unused net_icmpv4_set_checksum function
Checksum is now set via net_icmpv4_finalize() function.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 820f3ad006 net/ipv6: Replace legacy net_ipv6_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka ca58b4c761 net/ipv4: Replace legacy net_ipv4_create by the new one
Thus removing the legacy one, and renaming the new one to legacy name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 172fe5a87b net/context: Remove _new suffix on net_context_send/sendto functions
Now that legacy functions are removew, let's rename the new functions by
removing the _new suffix.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 62ab954251 net/pkt: Remove appdata/appdatalen attributes and related functions
There is no need for these anymore: all is dictated by the position of
the net_pkt's cursor now

- actual cursor position is like the former appdata attribute
- net_pkt_remaining_data() is like the former appdatalen attribute

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 54ac7a43e9 net/udp: Remove net_udp_insert legacy function
It is unused anywhere now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 0b173e3b77 net/context: Remove legacy API
Former net_context_send/sendto and net_context_create_ipv4/ipv6 are now
unused and can be removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-20 10:27:14 -05:00
Tomasz Bursztyka 7ba52eae93 net/ipv6: Set the right protocol when finalizing MLD packet
IPv6 next header might be something else (here NET_IPV6_NEXTHDR_HBHO)
but when finalizing it is mandatory to give the actual last header
protocol type. In this case IPPROTO_ICMPV6, so the checksum can be
computed properly then by net_icmpv6_finalize() called from
net_ipv6_finalize().

Fixes #14663

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-19 09:45:01 -04:00
Jukka Rissanen 20ea069d81 net: if: Init cursor for promiscuous mode after L2
As the L2 layer might have modified the cursor, reset it here
before giving the packet to promiscuous mode API. This way
the application will get a fresh copy of the buffer.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-18 11:39:33 -05:00
Paul Sokolovsky bce27220a1 net: context: put: Update for shared TCP context ownership
TCP context is now created with refcount of 2, signifying that it's
jointly owned by an app and stack. Thus, net_context_put()
unconditionally calls net_context_unref() to decrement refcount on
app's behalf, and leaves stack's refcount to internal routines
which handle sending/receiving/timing out FINs, etc.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2019-03-18 10:49:25 -05:00
Tomasz Bursztyka f1810c8495 net/icmpv4: Create reply taking taking into account the IPv4 hdr lengh
Now that IPv4 options are handled, ICMPv4 echo reply must be created
taking into account that IPv4 header length can be variable. So instead
of cloning and rewriting (that would copy the useless options), let's
allocate and copy only the payload.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-11 20:57:29 -07:00
Tomasz Bursztyka a567bcb765 net/utils: Use the right IPv4 header length for checksum calculation
IPv4 header length might be bigger than struct net_ipv4_hdr if there are
options appended to it.

Fixes #11618

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-11 20:57:29 -07:00
Tomasz Bursztyka 21c66a8fe1 net/ipv4: Handle options relevantly
IPv4 header might come with options, unlike IPv6, these are not
encapsulated in option header but are fully part of the IPv4 header.

Zephyr must handles these. Now silently ignoring their content and
setting the cursor to the payload properly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-11 20:57:29 -07:00
Tomasz Bursztyka 5594aee9aa net/context: Enable using dedicated slab/pools to allocate a packet
This is probably the only place where net_pkt_alloc_from_slab() is going
to be used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-11 20:56:44 -07:00
Tomasz Bursztyka 4508e94b4e net/pkt: Enable allocating from external slab and data pool on new API
This is meant for very particular use case as only logging uses that.
Where it makes entirely sense for it to send the logs through its own
slab/pool in order to not drain the core slabs/pools.

So enabling the new API to manage that. That has to be used with
net_context for the buffer pool. So one has to first allocate the
net_pkt from external slab, set the context and then (and only then)
allocate buffer. Basically, only net_context will uses that scheme
anyway.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-11 20:56:44 -07:00
Tomasz Bursztyka dd01e9997f net/context: Add an option so set/unset packet timestamping
Though core system is able to manage packet timestamping internaly (gptp
requires it for instance), it might be necessary to enable/disable
packet timestamping from net context directly.

Currently this will be only used by the tx timestamp test. So this
support is disabled by default. (And gptp does not require it anyway).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka c7ee54aeab net/context: If enabled, pass the context priority to the packet
This is required if traffic class is enabled, so allocated packets from
net_context do get the right priority set.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Tomasz Bursztyka 6c18a27c30 net/pkt: Allow having NULL as iface
That can be useful on some tests which will not have any interface but
still allocate net_pkt. Also, one may allocate a packet with buffer not
knowing yet the interface it will be send through.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-03-09 10:09:33 -05:00
Ulf Magnusson 214ef00db3 kconfig: subsys: net: Remove redundant dependencies
subsys/net/lib/lwm2m/Kconfig.ipso is 'source'd within an 'if LWM2M', in
subsys/net/lib/lwm2m/Kconfig, so the 'depends on LWM2M' is redundant.

The 'depends on NET_IPV4' and 'depends on NET_L2_OPENTHREAD' are within
corresponding 'if's in the same file.

'if FOO' is just shorthand for adding 'depends on FOO' to each item
within the 'if'. Dependencies on menus work similarly. There are no
"conditional includes" in Kconfig, so 'if FOO' has no special meaning
around a source. Conditional includes wouldn't be possible, because an
if condition could include (directly or indirectly) forward references
to symbols not defined yet.

Tip: When adding a symbol, check its dependencies in the menuconfig
('ninja menuconfig', then / to jump to the symbol). The menuconfig also
shows how the file with the symbol got included, so if you see
duplicated dependencies, it's easy to hunt down where they come from.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-09 09:49:59 -05:00
Ravi kumar Veeramally ecfe1fc7e3 net: dhcpv4: Introduce config option for max delay
As per RFC2131 4.1.1 requires we wait a random period
between 1 and 10 seconds before sending the initial
discover. But tests can not wait that longer. So this
option helps test to configure the value to minimum.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2019-03-05 08:29:02 -05:00
Jukka Rissanen ea1e4fd0d7 net: tcp: Check TCP ACK flag properly during conn establishment
Multiple flag bits were set so the ACK flag set was not checked
properly which meant that connection establishment was not
successfull.

Fixes #13943

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-01 09:49:02 +01:00
Jukka Rissanen 52dc50dc6b net: lldp: Allow generation of documentation
No need to hide the symbols in the header file if CONFIG_NET_LLDP
is not enabled. This also allows the documentation to be generated
properly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-03-01 09:45:06 +01:00
Jukka Rissanen 8e066aba0f net: ipv6: Extension header length failure not properly checked
The ipv6_handle_ext_hdr_options() can return negative value
but we stored it into unsigned variable and then checked < 0.

Coverity-CID: 190995
Fixes #13830

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:47:24 -06:00
Jukka Rissanen 4bbcf391c3 net: context: Remove dead code from net_context_connect
The ret=0; statement cannot be reached.

Coverity-CID: 190973
Fixes #13846

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-28 08:46:09 -06:00
David B. Kinder e731bdc81a doc: fix docs, include, and Kconfig misspellings
Fix misspellings missed during regular reviews

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2019-02-28 09:32:12 +01:00
Ulf Magnusson 9aab5cef96 kconfig: Remove redundant 'default n' properties
Some more were added since the cleanup pass in June 2018. See e.g.
commit 2d50da70a1 ("drivers: ipm: Kconfig: Remove redundant 'default n'
properties") for a motivation. It also avoids people wondering whether
or not they need to put in 'default n'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 09:25:22 +01:00
Jukka Rissanen 429b6ed68e net: stats: Wrong Kconfig options were used for statistics
The net-shell was using wrong config options for statistics
support. Also net_stats.h had wrong config used for IPv6 MLD
statistics.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-26 02:25:45 +01:00
Tomasz Bursztyka 6435553dea net/context: Add a way to set/get ttl/hop_limit from net_context
Since net_context_sendto_new() does not take a net_pkt anymore, the only
way to set net_pkt's ttl/hop_limit is to pass it through net_context.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-26 01:50:59 +01:00
Tomasz Bursztyka 9104211d9e net/6lo: Add a way to get the difference of hdr size after uncompression
Since we don't want to redo the complex calculation, let's reuse the
uncompress functions, adding a dry_run possibility to those.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-23 07:44:59 -05:00
Tomasz Bursztyka c6f0491606 net/shell: Switch TCP send command to new API
It simplifies things again, as it does not need to create the net_pkt by
itself anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-21 18:06:06 -05:00
david leach b08afdb348 net: sockets: Clean up socket shutdown on listen() socket
When closing the socket, zsock_close_ctx() would call
net_context_accept() when the socket was in "LISTEN" state.
This would result in an error log message for "Identical
connection handler already found" because the connection
context was already created because the initial
zsock_listen_ctx() called net_context_accept() to set up
the socket at the beginning. This change adds a test to
check if the callback is NULL which indicates this
close state and avoids the error message.

Signed-off-by: david leach <david.leach@nxp.com>
2019-02-21 11:58:46 -05:00
david leach 45df09c010 net: tcp: Clean up FIN send on socket shutdown
The sending of the final FIN message was being put on the sent_list
to be handled by the retry logic and being sent directly. But in
the case of a socket that never had a connection, the logic after
the direct send would decrement the reference on the packet which
would cause the retry logic to eventually have a situation where
the pkt is on the sent_list queue but the buffer associated with
the packet is freed back to slab. The code would then get a null
pointer to the tcp header and would fault when setting the crc to
zero on frdm-k64f platform.

Fixes #13489, #13301

Signed-off-by: david leach <david.leach@nxp.com>
2019-02-21 11:58:46 -05:00
Jukka Rissanen 18f9db5381 net: route: Do not access null neighbor
Possible null pointer dereference when looking up the nexthop
neighbor.

Coverity-CID: 190639
Fixes #12294

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-21 09:23:53 -05:00
Robert Lubos 749596659f net: ipv6: Do not pass ICMPv6 packets to net_conn_input
ICMPv6 network packets are processed and consumed (if not dropped)
within `net_icmpv6_input` function. Therefore they shoud not be
passed to the `net_conn_input` function.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-02-20 12:50:43 -05:00
Krzysztof Chruscinski a64b0fe1e3 shell: Deprecate macros for subcommands creation
Macros are replaced by C++ friendly versions:
- SHELL_CREATE_STATIC_SUBCMD_SET by SHELL_STATIC_SUBCMD_SET_CREATE
- SHELL_CREATE_DYNAMIC_CMD by SHELL_DYNAMIC_CMD_CREATE

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Krzysztof Chruscinski 3605e48c44 shell: Modify subcommands to use SHELL_STATIC_SUBCMD_SET_CREATE
It is planned to deprecate SHELL_CREATE_STATIC_SUBCMD_SET macro
which is replaced by SHELL_STATIC_SUBCMD_SET_CREATE.

Additionally, removed irrelevant comments about alphabetical
ordering which is no longer needed.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-02-20 07:31:35 -05:00
Robert Lubos c47ef5e142 net: icmpv6: Fix echo request packet generation
`net_ipv6_finalize` expects packet cursor to be reinitialized in order
to finalize packet correctly. This commits adds missing cursor
initialization.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2019-02-19 17:34:23 -05:00
Jukka Rissanen 3206568e43 net: if: Start index numbering from 1
In order to follow the BSD socket numbering of the network
interfaces, start numbering from 1. The index 0 is reserved
to mean any interface in BSD socket code.

Fixes #13084

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-18 15:10:54 -05:00
Jukka Rissanen ef7081ee44 net: Fix the function API documentation generation
Make sure that network related functions are always documented.
This means keeping the prototype and possible stub together.

Fixes #12615

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-15 16:39:06 -05:00
Carlos Stuart 75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Jukka Rissanen dbf7af7f43 net: context: can: Fix typo in Kconfig option name
The option CONFIG_NET_SOCKETS_RAW name was changed to
CONFIG_NET_SOCKETS_PACKET but two checks using the old name
was left to net_context.c

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-13 09:18:36 -06:00
Tomasz Bursztyka dad4b297f3 net/context: No need to set pkt family as the allocator did already
net_context uses net_pkt_alloc_with_buffer(), which sets the family and
protocol (according to parameters) so no need to set the family again.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-13 06:56:15 -06:00
Tomasz Bursztyka 2b22b71e42 net/pkt: Remove useless legacy net_frag_linearize function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka bc5411816a net/pkt: Remove useless legacy net_pkt_append_memset function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 1fab039102 net/pkt: Remove useless legacy net_pkt_split function
Now that the stack does not use this function, it can be removed
safely.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka c71ce193c4 net/pkt: Rename net_pkt_pull_new to net_pkt_pull
Now that legacy net_pkt_pull function has been removed, the new
function can be renamed accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 09b782a82d net/pkt: Remove useless legacy net_pkt_pull function
Now that the stack uses the new API from net_pkt for pulling, no need
to keep the legacy one around.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka c65304f088 net/pkt: Rename net_pkt_copy_new to net_pkt_copy
Now that legacy net_pkt_clone function has been removed, the new
function can be renamed accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 895c8eb0e3 net/pkt: Remove useless legacy net_pkt_copy/_all functions
Now that the stack uses the new API from net_pkt for copying, no need
to keep the legacy one around.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 38a3e79f9b net/pkt: Rename net_pkt_clone_new to net_pkt_clone
Now that legacy net_pkt_clone function has been removed, the new
function can be renamed accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 347e17543f net/pkt: Remove useless legacy net_pkt_clone() function
Now that the stack uses the new API from net_pkt for cloning, no need to
keep the legacy one around.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka f447c47699 net/if: Use new net_pkt API for cloning in case of promiscuous mode
That was the last place where legacy net_pkt_clone() was used.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 40167ad0d9 net/icmpv4: Do not reuse echo request ttl for the echo reply
net_pkt_clone_new() sets the same attributes of the original packet to
the cloned one.

Fixes #13147

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 36740ecec7 net/pkt: Add a function to know the amount of data to read left
It will return the amount of data to be read from current cursor
position. This will prove to be useful to remove appdatalen attribute.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka a905203c57 net/tcp: Remove useless tcp_hdr_len() function
It is now useless as the only function using it
(net_pkt_set_appdata_values) got removed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka ea671acadb net/pkt: Remove useless net_pkt_set_appdata_values() function
UDP/TCP are setting the appdata attributes by themselves now.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 5dd657fe4f net/context: Do not set the appadata attributes again
These are already set either by udp or tcp at relevant places.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 8bc8e6f83d net/tcp: Let's set the appdata related attributes by ourselves
Let's not call net_pkt_set_appdata_values() which will be more costly
since it will need to parse all over again the packet to grab the tcp
header. Instead, let's use the tcp header pointer we have already and
set the appdata attributes directly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka cdf4ce51d8 net/udp: Let's set the appdata related attributes once header parsed
No need to do it later as all necessary informations are there already.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 129f93fdd2 net/private: Rename net_print_frags() function
Though unused anywhere, this function seems to have some usage while
debugging.

Let's rename it to a more semantically relevant name.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka a6426620da net/private: Rename net_hexdump_frags to net_pkt_hexdump
And remove the parameter "full" as there is no "ll reserve" distinction
anymore. The parameter was unused since the ll reserve concept removal.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 42b0bbf956 net/utils: Remove net_header_fits() function
It is not used anymore. Instead, use net_pkt_is_contiguous()

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 44577d44f2 net/udp: Remove net_udp_header_fits legacy function.
It not used anymore. If one wants to do the same check, it will require
to place the net_pkt cursor at the relevant position and use
net_pkt_is_contiguous(pkt, sizeof(struct net_udp_hdr))

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 909eb7271a net/udp: Remove net_pkt_udp_data() function
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>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 8ceedafdc4 net/udp: Switch net_udp_get/set_hdr to new net_pkt API
Let's use the new API for these 2 functions. Note that in some places,
using these functions is under-optimized (like in llmnr-responder in
dns: it gets the ip/udp headers already from the recv callback. That
will need to be taken care of later).

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 674d7c47b4 net/udp: Remove useless net_udp_set_chksum
It was only used in ipv6_fragment unit test and could be easily
replaced.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka c079242583 net/icmpv6: Remove useless net_icmpv6_set_chksum
net_ipv6_finalize do not use it anymore.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka d8624513e6 net/icmp: Remove useless icmp functions using legacy net_pkt API
net_pkt_icmp_data was only used in ipv6 unit test and could be easily
replaced.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 04966ac10d net/tcp: Remove useless tcp function using legacy net_pkt API
net_pkt_tcp_data was only used in tcp unit test and could be replaced by
local net_tcp_get_hdr.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka fd1401495b net/tcp: Move net_tcp_set_hdr() away from net core
Only the unit test needs it now, so let's move it there.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00
Tomasz Bursztyka 869427c8bc net/tcp: Removing net_tcp_set_chksum function
Now that it's unused, it's useless.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-02-12 20:24:02 -05:00