This fixes a bug in tcp_split_unsent_seg where oversized segments were not
handled during the split, leading to pcb->unsent_oversized and
useg->oversize_left getting out of sync with the split segment
This would result in over-writing the pbuf if another call to tcp_write()
happened after the split, but before the remainder of the split was sent in
tcp_output
Now pcb->unsent_oversized is explicitly cleared (because the remainder at
the tail is never oversized) and useg->oversized_left is cleared after it is
trimmed
This also updates the test_tcp_persist_split unit test to explicitly check for
this case
MSG_PEEK on TCP sockets was broken since commit b71d4477ea
from 06.03.2017: recv hung in an endless loop and tcp_recved() was called for peeked data
(which would result in a too large window advertised).
Aded TCP MSG_PEEK to socket unit tests
DHCP test code didn't set link up on net_test netif (exposed by changes
in 637bce91b4)
Then during the test_dhcp function, a Gratuitous ARP was not sent during
the call to dhcp_bind() because the link was still down
The sets the link state for all DHCP test functions
This fixes the following warnings:
test_tcp.c:266:5: error: code will never be executed [-Werror,-Wunreachable-code]
pbuf_free(p);
^~~~~~~~~
- The check API 'fail' aborts the test, thus pbuf_free(p) will never be executed
pbuf.c:783:111: error: format specifies type 'unsigned short' but the argument has type 'u8_t' (aka 'unsigned char') [-Werror,-Wformat]
LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
- LWIP_PBUF_REF_T is u8_t by default and doesn't match U16_F, so cast to u16_t. The cast and formatter will need to be changed
if ref is larger than 16 bits
ethernet.c:105:16: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
(unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- addr[] is type u8_t, formatter is X8_F which should be 8 bits. 'unsigned' is an int, so cast to unsighed char instead
This re-works the persist timer to have the following behavior:
1) Only start persist timer when a buffered segment doesn't fit within
the current window and there is no in-fligh data. Previously, the
persist timer was always started when the window went to zero even
if there was no buffered data (since timer was managed in receive
pathway rather than transmit pathway)
2) Upon first fire of persist timer, fill the remaining window if
non-zero by splitting the unsent segment. If split segment is sent,
persist timer is stopped, RTO timer is now ensuring reliable window
updates
3) If window is already zero when persist timer fires, send 1 byte probe
4) Persist timer and zero window probe should only be active when the
following are true:
* no in-flight data (pcb->unacked == NULL)
* when there is buffered data (pcb->unsent != NULL)
* when pcb->unsent->len > pcb->snd_wnd
This commit adds a timeout to the zero-window probing (persist timer)
mechanism. LwIP has not historically had a timeout for the persist
timer, leading to unbounded blocking if connection drops during the
zero-window condition
This commit also adds two units test, one to check the RTO timeout
and a second to check the zero-window probe timeout
This commit adds CMSG infrastructure (currently used with recvmsg) and
the IP_PKTINFO socket option.
In order to use IP_PKTINFO, set LWIP_NETBUF_RECVINFO to 1
Unit test is added to verify this feature
This commit adds TCP Appropriate Byte Counting (ABC) support based on
RFC 3465
ABC replaces the previous congestion window growth mechanism and has been
configured with limit of 2 SMSS. See task #14128 for discussion on
defaults, but the goal is to mitigate the performance impact of delayed
ACKs on congestion window growth
This commit also introduces a mechanism to track when the stack is
undergoing a period following an RTO where data is being retransmitted.
Lastly, this adds a unit test to verify RTO period tracking and some
basic ABC cwnd checking
This creates a single version of test IP addresses, netmasks, and ports.
All tests were using the same values, but duplicated in each test
This also adds const to some functions so we can use a const version
of addresses
This commit moves common defines and senqo array so they can be
re-used in mulptiple places for sequence number checking rather
than duplicated
Currently they are used in two places, but I'm anticipating needing
them in future TCP unit tests
In unit test if_fail check for nullptr
is always located after dereferencing this
null pointer. This patch introduces correct
order: first check, then use
This code is marked as dead when BUF_SZ is a multiple of 4 (current
situation with unit tests)
This hopefully fixes a -Wunreachable-code failure found by Travis CI
This migrates the sendmsg TCP test from socket examples (task #14408)
to socket unit tests
Additionally, this adds support for testing recvmsg, creating a TCP
test for both sendmsg/recvmsg (referred to as msgapi test)
This also makes a small change to msgapi UDP to clear the receive
buffer after verifying the previous datagram
Using {0} broke Travis CI even though this should be correct for
initializing struct msghdr (see example in Linxu man pages:
http://man7.org/linux/man-pages/man3/cmsg.3.html)
Just use memset for now which is the common approach in LwIP codebase
This converts the sendmsg test to use recvmsg for receiving, thus
exercising both sendmsg and recvmsg in a single test
This also adjusts the test naming to communicate all message APIs
(sendmsg/recvmsg) are being tested
This commit moves the sendmsg UDP test from socket examples to socket
unit tests
The test has been converted to send/receive on the loopback interface
and also test a connected sendmsg with NULL msg_name
test_tcp_fast_rexmit_wraparound correctness relied on the congestion
window being in congestion avoidance so that only a single TCP_MSS
segment is sent upon ACKing the first segment.
It's not known whether the test was relying tcp_alloc() to set ssthresh
to 0 and thus start in congestion avoidance or if the test was working by
accident until changes in b90a54f989
This fixes the test by enforcing the requirement of starting in
congestion avoidance
Signed-off-by: goldsimon <goldsimon@gmx.de>