In order to fix the line tracking of the TCP packet allocation
with the test protocol enabled, refactor tcp_pkt_alloc(),
so the line of the allocation can be tracked properly.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Make sure we only parse the received TCP options only once. Store
the options to tcp conn struct for later use.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Avoid dynamic allocations and all the issues if we run out of
memory, by placing the connection endpoint directly to TCP
connection struct.
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
Some other part of Zephyr has similar defines (SRC)
causing build failures.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
In order to support TIME_WAIT state during the TCP connection
termination, add a TIME_WAIT timer and the corresponding state.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
In order to improve readability, rename TCP_FIN_WAIT
states into TCP_FIN_WAIT_1, TCP_FIN_WAIT_2.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
Use existing network stack calls to create net pkt,
ip header and udp header creation. Also simplify
finalize api calls.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Use existing network stack calls to create net pkt,
ip header and tcp header creation. Also simplify
finalize api calls.
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
According to RFC 793 and IANA "TCP Option Kind Numbers" an option with
kind 0 is an End of Option List option and not a PAD.
Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
The TCP connection might be concurrently modified from the
TR/TX threads, so add a mutex to protect from the concurrent
modification.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
After removing the test windows, update test protocol
functions for the TTCN-3 sanity check.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
These test receive windows were used by TTCN-3 sanity check,
but it's possible to do without them.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
In order to drop dependency on a heap, drop the
test send window.
Use net_tcp_queue_data() to receive the outgoing data
from the socket layer.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
In order to drop dependency on a heap, drop the test
receive window.
The receive window was needed for TTCN-3 sanity check,
but it's possible to do without it.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
k_timer callback is executed from ISR context, which isn't
currenty compatible with Zephyr's shell implementation.
This problem was found while testing TCP2 client side.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
In order to properly remove struct tcp and its data, net_context
needs to be supplied as k_timer user data. Modify net_tcp_unref()
to take a net_context argument when removing, and add ifdefs
around code that after this will only be used by TCP testing
functionality.
Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
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>
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>