]> git.meshlink.io Git - utcp/log
utcp
4 years agoAvoid calling the poll callback for UDP style channels.
Guus Sliepen [Mon, 13 Apr 2020 19:30:00 +0000 (21:30 +0200)]
Avoid calling the poll callback for UDP style channels.

We still call it on connection establishment and on errors, but we don't
call it when we have space free in the send buffer.

4 years agoHandle the case where we reduce the buffer size below the amount currently used.
Guus Sliepen [Sat, 11 Apr 2020 22:38:54 +0000 (00:38 +0200)]
Handle the case where we reduce the buffer size below the amount currently used.

4 years agoHandle incoming packets that don't fit into the receive buffer.
Guus Sliepen [Sat, 11 Apr 2020 22:29:49 +0000 (00:29 +0200)]
Handle incoming packets that don't fit into the receive buffer.

If the receive buffer size is reduced while there are still incoming
packets in flight, it can be that those will not fit inside the receive
buffer. Instead of calling abort(), just handle as much of the packet as
we can fit in the receive buffer, or handle the whole packet if it is in
order since we bypass the receive buffer in that case.

4 years agoFix generating invalid retransmit timeouts.
Guus Sliepen [Mon, 6 Apr 2020 06:35:05 +0000 (08:35 +0200)]
Fix generating invalid retransmit timeouts.

If the retransmit timeout was more than a second we could end up
generating a timeout that was both invalid (tv_nsec >= 1e9) and too
large.

4 years agoMake RTT variables per-connection.
Guus Sliepen [Sun, 5 Apr 2020 23:53:18 +0000 (01:53 +0200)]
Make RTT variables per-connection.

We do congestion management per connection, so we should also track RTT per
connection.

4 years agoFix RTT measurement.
Guus Sliepen [Sun, 5 Apr 2020 23:41:14 +0000 (01:41 +0200)]
Fix RTT measurement.

Commit 723d8c8b2d96834135f00c0ac4147282e1f0cc2c introduced a bug where we
fail to subtract two timespecs correctly, resulting in incorrect RTT values.

4 years agoAdd IPv4 style fragments for UDP style channels.
Guus Sliepen [Thu, 2 Apr 2020 22:15:29 +0000 (00:15 +0200)]
Add IPv4 style fragments for UDP style channels.

Add a More Fragments (MF) bit to the ctl field in the header, and reuse the
wnd field for the fragment offset.

We only handle fragments that are received in-order. But this allows an
application to not care about the maximum segment size.

4 years agoTurn constants back into macros.
Guus Sliepen [Thu, 2 Apr 2020 18:28:11 +0000 (20:28 +0200)]
Turn constants back into macros.

Constants initialized with expressions are not allowed by all compilers.

4 years agoFix a memory leak.
Guus Sliepen [Sun, 29 Mar 2020 21:58:44 +0000 (23:58 +0200)]
Fix a memory leak.

4 years agoAdd a tool to generate a stream with a configurable bitrate.
Guus Sliepen [Sun, 29 Mar 2020 17:30:01 +0000 (19:30 +0200)]
Add a tool to generate a stream with a configurable bitrate.

This generates a stream with a configurable average bitrate and number of
frames sent per second. The stream has embedded timestamps and counters,
which can be used by the same program to verify the integrity of an
incoming stream and to print the latency between sender and receiver.

4 years agoFix data corruption.
Guus Sliepen [Sun, 29 Mar 2020 17:23:41 +0000 (19:23 +0200)]
Fix data corruption.

This was caused by the code handling incoming retransmissions not reading
from the receive buffer correctly after the change to ringbuffers.

4 years agoFix buffer resizing.
Guus Sliepen [Sun, 29 Mar 2020 16:08:40 +0000 (18:08 +0200)]
Fix buffer resizing.

4 years agoFix building without UTCP_DEBUG.
Guus Sliepen [Sun, 29 Mar 2020 15:10:24 +0000 (17:10 +0200)]
Fix building without UTCP_DEBUG.

4 years agoDon't call the poll callback unnecessarily.
Guus Sliepen [Sun, 29 Mar 2020 14:21:51 +0000 (16:21 +0200)]
Don't call the poll callback unnecessarily.

Currently we call the poll callback if there is any free space in the send
buffer, every time we call utcp_timeout(). However, if the application
does not send anything inside the callback, then it most likely won't send
anything the next time if the free space in the send buffer did not change.
So only call the callback when more space has been made available in the
send buffer.

4 years agoAdd utcp_set_clock_granularity().
Guus Sliepen [Sun, 29 Mar 2020 13:39:01 +0000 (15:39 +0200)]
Add utcp_set_clock_granularity().

This overrides the value gotten from clock_getres(), and is intended for
use by an application that knows it might not call utcp_timeout()
exactly on time.

4 years agoUse clock_gettime() instead of gettimeofday().
Guus Sliepen [Sat, 28 Mar 2020 21:30:04 +0000 (22:30 +0100)]
Use clock_gettime() instead of gettimeofday().

It is more portable, and allows reading out the monotonic clock. On some
systems it is also faster than gettimeofday().

4 years agoAdd utcp_get_mss().
Guus Sliepen [Sat, 28 Mar 2020 21:14:51 +0000 (22:14 +0100)]
Add utcp_get_mss().

4 years agoImplement ringbuffers.
Guus Sliepen [Thu, 19 Mar 2020 23:00:05 +0000 (00:00 +0100)]
Implement ringbuffers.

This avoids a memmove() call every time data in the send buffer is
ACKed. Instead, we now have a memmove() every time the send buffer is
grown, but this happens only a few times at most.

4 years agoAllocate a persistent packet buffer.
Guus Sliepen [Thu, 19 Mar 2020 21:17:34 +0000 (22:17 +0100)]
Allocate a persistent packet buffer.

Instead of allocating a new packet buffer every time we generate a packet,
we pre-allocate it and keep it around. We only reallocate when the MTU
increases.

4 years agoAdd better debugging of UDP style connections. feature/congestion-window
Guus Sliepen [Fri, 27 Mar 2020 21:12:20 +0000 (22:12 +0100)]
Add better debugging of UDP style connections.

Report packets that are out of order, either because of reordering or
packet loss.

4 years agoDistinguish between MTU and MSS.
Guus Sliepen [Thu, 19 Mar 2020 07:30:58 +0000 (08:30 +0100)]
Distinguish between MTU and MSS.

Have the application set the maximum size of a UTCP packet (= MTU), and from
that derive the maximum size of the payload of a UTCP packet (= MSS).

4 years agoReset the retransmission timer when receiving duplicate ACKs.
Guus Sliepen [Wed, 18 Mar 2020 21:24:52 +0000 (22:24 +0100)]
Reset the retransmission timer when receiving duplicate ACKs.

While we are getting duplicate ACKs, and are likely in fast recovery,
keep resetting the retransmission timer, so that if fast recovery takes
longer than the RTO, we don't trigger a slow start.

When we do get a real timeout during fast recovery, reset the duplicate
ACK counter to signal we are no longer in fast recovery.

We also should not do anything when receiving duplicate ACKs when all
data has already been ACKed.

4 years agoMinor improvements to the benchmark script and graph output.
Guus Sliepen [Sun, 15 Mar 2020 13:55:50 +0000 (14:55 +0100)]
Minor improvements to the benchmark script and graph output.

4 years agoUse flightsize instead of cwnd to set ssthresh.
Guus Sliepen [Sun, 15 Mar 2020 13:55:17 +0000 (14:55 +0100)]
Use flightsize instead of cwnd to set ssthresh.

4 years agoReport initial ssthresh value as 0 while debugging.
Guus Sliepen [Sun, 15 Mar 2020 13:49:12 +0000 (14:49 +0100)]
Report initial ssthresh value as 0 while debugging.

The initial is actually UINT_MAX, but since this makes it hard to plot a
graph of it with autoscaling axes, show it as 0 instead. This removes the
hack where ssthresh is set to sndbuf.maxsize at the start of a connection,
which is wrong when the application overrides the send buffer size later.

4 years agoMake global variables and functions static in the test program.
Guus Sliepen [Sat, 14 Mar 2020 16:17:34 +0000 (17:17 +0100)]
Make global variables and functions static in the test program.

4 years agoMake the send/receive buffer size configurable in the test program.
Guus Sliepen [Sat, 14 Mar 2020 16:15:51 +0000 (17:15 +0100)]
Make the send/receive buffer size configurable in the test program.

4 years agoAdd packet loss to the benchmark script.
Guus Sliepen [Sat, 14 Mar 2020 15:51:46 +0000 (16:51 +0100)]
Add packet loss to the benchmark script.

4 years agoAdd a script to generate graphs of the data recorded by the benchmark script.
Guus Sliepen [Sat, 14 Mar 2020 15:46:18 +0000 (16:46 +0100)]
Add a script to generate graphs of the data recorded by the benchmark script.

4 years agoAdd better debugging output.
Guus Sliepen [Sat, 14 Mar 2020 15:45:28 +0000 (16:45 +0100)]
Add better debugging output.

All messages from UTCP itself are now of the form:

timestamp srcport:dstport foo 123 bar 456 ...

The UNIX timestamp is wall clock time, to allow data from multiple
computers that are synchronised via NTP to be correlated.
Only part of the payload is now dumped by default to make the logs more
easily readable.

The test program now also adds the same format timestamp to its debug
messages.

4 years agoFix congestion window size after a triplicate ACK
Guus Sliepen [Fri, 13 Mar 2020 07:45:44 +0000 (08:45 +0100)]
Fix congestion window size after a triplicate ACK

4 years agoImplement fast recovery according to RFC 5681.
Guus Sliepen [Sun, 8 Mar 2020 22:48:30 +0000 (23:48 +0100)]
Implement fast recovery according to RFC 5681.

4 years agoAvoid sending packets smaller than the MTU if we don't need to.
Guus Sliepen [Sun, 8 Mar 2020 21:12:41 +0000 (22:12 +0100)]
Avoid sending packets smaller than the MTU if we don't need to.

If we have almost filled the congestion window but have more data in the
send buffer than we can send right now, wait until the congestion window
frees up to avoid sending small packets unnecessarily.

4 years agoImplement slow start threshold according to RFC 5681.
Guus Sliepen [Sun, 8 Mar 2020 20:57:57 +0000 (21:57 +0100)]
Implement slow start threshold according to RFC 5681.

4 years agoAlways announce the receive window size as the size of the receive buffer.
Guus Sliepen [Sun, 8 Mar 2020 20:52:23 +0000 (21:52 +0100)]
Always announce the receive window size as the size of the receive buffer.

Since UTCP requires the application to handle incoming in-sequence data
immediately, the start of the receive buffer is always right after the
last ACKed byte, so we can always announce the size of the receive buffer
as the maximum receive window size.

4 years agoAdd a benchmark script.
Guus Sliepen [Sun, 8 Mar 2020 20:09:25 +0000 (21:09 +0100)]
Add a benchmark script.

This script sets up two network namespaces connected via a veth tunnel with
the netem qdisc to simulate "realistic" network conditions.

It first uses socat to transmit data via regular TCP, then transmits the
same amount of data using the UTCP test program. It prints the time it took
for both methods, and stores a packet trace for both methods so it can be
analyzed.

4 years agoAdd a Wireshark plugin to help dissect UTCP packets.
Guus Sliepen [Sun, 8 Mar 2020 19:59:59 +0000 (20:59 +0100)]
Add a Wireshark plugin to help dissect UTCP packets.

This assumes UTCP is being transported in plaintext over UDP port 9999.

4 years agoUpdate test program to set a better default MTU.
Guus Sliepen [Sun, 8 Mar 2020 19:56:28 +0000 (20:56 +0100)]
Update test program to set a better default MTU.

4 years agoFix garbage being sent at start of UDP connection.
Guus Sliepen [Sat, 8 Feb 2020 14:59:41 +0000 (15:59 +0100)]
Fix garbage being sent at start of UDP connection.

If utcp_send() was called right after utcp_connect_ex(..., UTCP_UDP),
and the handshake phase hadn't completed yet, we left some garbage in
the send buffer which wasn't cleared until two more calls to utcp_send()
were made.

5 years agoAvoid a compiler warning when compiling with -DNDEBUG.
Guus Sliepen [Thu, 31 Oct 2019 19:41:04 +0000 (20:41 +0100)]
Avoid a compiler warning when compiling with -DNDEBUG.

5 years agoFix retransmission timeout calculation.
Guus Sliepen [Mon, 14 Oct 2019 20:32:35 +0000 (22:32 +0200)]
Fix retransmission timeout calculation.

The RTO calculation was missing a factor 4 multiplication of the
RTT variance, which caused it to set the RTO to a much lower value than
specified by RFC 6298. This would result in more retranmissions and a
lower throughput.

5 years agoCorrectly handle incoming retransmissions of SYN packets.
Guus Sliepen [Thu, 10 Oct 2019 20:10:44 +0000 (22:10 +0200)]
Correctly handle incoming retransmissions of SYN packets.

5 years agoReplace two hardcoded timeout values with utcp->timeout.
Guus Sliepen [Thu, 10 Oct 2019 18:48:16 +0000 (20:48 +0200)]
Replace two hardcoded timeout values with utcp->timeout.

5 years agoDon't reset timers that were not set in utcp_reset_timers() and utcp_offline().
Guus Sliepen [Thu, 10 Oct 2019 18:43:45 +0000 (20:43 +0200)]
Don't reset timers that were not set in utcp_reset_timers() and utcp_offline().

In utcp_reset_timers(), we were actually setting the connection timer even
if it was not set before, therefore causing spurious channel closures on
channels that did not have any unACKed data.

In utcp_offline(), we were setting the retransmission timer even if there
was nothing to retransmit.

5 years agoAlso always send an ACK back when the SYN or FIN bit is set.
Guus Sliepen [Mon, 7 Oct 2019 10:45:12 +0000 (12:45 +0200)]
Also always send an ACK back when the SYN or FIN bit is set.

5 years agoAlways send an ACK back when we receive data from the peer.
Guus Sliepen [Sat, 5 Oct 2019 12:29:16 +0000 (14:29 +0200)]
Always send an ACK back when we receive data from the peer.

A previous ACK could get lost, causing the peer to resend data. If the
retransmission doesn't contain any new data, we would consider this data
to be outside our receive window, and then not resend our ACK.

5 years agoSeveral fixes for handling UDP-like channels.
Guus Sliepen [Sun, 22 Sep 2019 13:01:29 +0000 (15:01 +0200)]
Several fixes for handling UDP-like channels.

- Drop data sent before the connection is established.
- Relax checks on incoming ACK seqnos
- Always consider all data ACKed
- Disregard hdr.seq when a FIN packet is received
- Don't ACK pure data packets

5 years agoAllow setting the MTU in the test program.
Guus Sliepen [Sun, 22 Sep 2019 11:00:08 +0000 (13:00 +0200)]
Allow setting the MTU in the test program.

5 years agoCall the poll callback with 0 whenever a connection is closed.
Guus Sliepen [Tue, 17 Sep 2019 19:45:22 +0000 (21:45 +0200)]
Call the poll callback with 0 whenever a connection is closed.

5 years agoDon't abort when UTCP_NO_PARTIAL is set.
Guus Sliepen [Tue, 13 Aug 2019 18:45:34 +0000 (20:45 +0200)]
Don't abort when UTCP_NO_PARTIAL is set.

5 years agoAdd a flag to prevent partial writes on a UTCP connection.
Guus Sliepen [Thu, 8 Aug 2019 13:14:09 +0000 (15:14 +0200)]
Add a flag to prevent partial writes on a UTCP connection.

5 years agoAdd a function to manually start the connection timeout timers.
Guus Sliepen [Sun, 7 Jul 2019 16:00:06 +0000 (18:00 +0200)]
Add a function to manually start the connection timeout timers.

If the application knows the peer is offline, it can call utcp_offline().
This will start the connection timers on all connections to that peer.
This can be undone by marking the peer online again. This will also reset
the retransmission timers.

5 years agoStart the connection timeout timer when we have unACKed data.
Guus Sliepen [Sun, 7 Jul 2019 14:54:25 +0000 (16:54 +0200)]
Start the connection timeout timer when we have unACKed data.

Start it when we are have some data to send, and reset it whenever some of
the data is ACKed. Stop the timer if the peer has received all the data.

Also ensure the poll callback is called with len = 0 when the timeout is
hit.

5 years agoCheck for astyle version 3 before formatting the code.
Guus Sliepen [Sun, 17 Mar 2019 19:57:43 +0000 (20:57 +0100)]
Check for astyle version 3 before formatting the code.

Unfortunately, code formatters change their behaviour between versions.
The code currently requires astyle version 3.x, so check this before
running astyle. If the wrong version is installed, print an error.

5 years agoAdd functions to get the amount of bytes in the send and receive buffers.
Guus Sliepen [Sun, 17 Mar 2019 19:54:19 +0000 (20:54 +0100)]
Add functions to get the amount of bytes in the send and receive buffers.

utcp_get_sendq() returns the amount of bytes in the send buffer, which
corresponds to the amount of bytes not yet ACKed by the peer.

utcp_get_recvq() returns the amount of bytes in the receive buffer,
which may or may not have been acked already, but have not been read by
the application.

5 years agoKeep a copy of the old receive callback before calling reset_connection().
Guus Sliepen [Wed, 27 Feb 2019 19:05:00 +0000 (20:05 +0100)]
Keep a copy of the old receive callback before calling reset_connection().

The latter function clears the receive callback, so make a copy before
calling trying to call the receive callback for the final time.

5 years agoSmall fixes for utcp_abort_all_connections().
Guus Sliepen [Mon, 25 Feb 2019 08:57:57 +0000 (09:57 +0100)]
Small fixes for utcp_abort_all_connections().

- Make utcp_reset_connection() a private function.
- Ensure we don't repeat any action when aborting a connection twice.
- Call the receive callback after resetting the connection, so the callback
  function can safely call utcp_close().

5 years agoAdd utcp_abort_all_connections function.
SS Roop [Fri, 15 Feb 2019 05:27:32 +0000 (10:57 +0530)]
Add utcp_abort_all_connections function.

This adds a function to abort all open connections without invalidating
the utcp_connection_t handles. Its main purposes is when the application
knows communication with the peer is definitely not possible/desired anymore.
A RST packet will be sent to each connection's remote end, and the
receive callback will be invoked to indicate an error on each
connection.

6 years agoAllow utcp_send() before a connection has been fully established.
Guus Sliepen [Sun, 22 Jul 2018 11:19:01 +0000 (13:19 +0200)]
Allow utcp_send() before a connection has been fully established.

This will put the data in the send buffer, and it will be sent when possible.
This also allows the socket to be shut down for writing before it has
reached the ESTABLISHED state.

6 years agoAdd more error messages to test program, allow socket reuse.
Guus Sliepen [Sun, 22 Jul 2018 11:16:13 +0000 (13:16 +0200)]
Add more error messages to test program, allow socket reuse.

6 years agoFix all compiler warnings found using -Wall -W -pedantic.
Guus Sliepen [Tue, 1 May 2018 12:59:06 +0000 (14:59 +0200)]
Fix all compiler warnings found using -Wall -W -pedantic.

7 years agoFormat the code using the Artistic Style formatter.
Guus Sliepen [Mon, 2 Oct 2017 20:52:53 +0000 (22:52 +0200)]
Format the code using the Artistic Style formatter.

7 years agoConvert sizeof foo to sizeof(foo).
Guus Sliepen [Mon, 2 Oct 2017 20:40:47 +0000 (22:40 +0200)]
Convert sizeof foo to sizeof(foo).

While technically sizeof is an operator and doesn't need the parentheses
around expressions it operates on, except if they are type names, code
formatters don't seem to handle this very well.

7 years agoFix warnings when compiling with -Wall -W.
Guus Sliepen [Mon, 2 Oct 2017 20:24:32 +0000 (22:24 +0200)]
Fix warnings when compiling with -Wall -W.

7 years agoCall the receive callback for unclosed channels during utcp_exit().
Guus Sliepen [Sun, 13 Aug 2017 19:46:24 +0000 (21:46 +0200)]
Call the receive callback for unclosed channels during utcp_exit().

This allows the application to clean up any resources associated with
these UTCP connections.

7 years agoFix SYN packet handling.
Guus Sliepen [Sun, 13 Aug 2017 19:27:00 +0000 (21:27 +0200)]
Fix SYN packet handling.

This fixes problems with SYN packets arriving out of the usual order.
This also adds a more proper handling of the aux field.

7 years agoAllow timers to be reset.
Guus Sliepen [Sun, 13 Aug 2017 15:43:48 +0000 (17:43 +0200)]
Allow timers to be reset.

The function utcp_reset_timers() will reset the retransmit timers of all
connections to zero, so they will fire immediately. The connection timeout will
be reset to the user timeout value, and if the RTO is larger than the
starting RTO, it will be set to the starting RTO.

7 years agoRemove debug message.
Guus Sliepen [Sun, 13 Aug 2017 14:22:39 +0000 (16:22 +0200)]
Remove debug message.

7 years agoEnable retransmit timer for SYN packets.
Guus Sliepen [Sun, 13 Aug 2017 12:48:49 +0000 (14:48 +0200)]
Enable retransmit timer for SYN packets.

7 years agoCall the poll callback with len = 0 on errors.
Guus Sliepen [Thu, 27 Jul 2017 09:25:50 +0000 (11:25 +0200)]
Call the poll callback with len = 0 on errors.

7 years agoAdd UDP semantics.
Guus Sliepen [Mon, 3 Jul 2017 21:16:01 +0000 (23:16 +0200)]
Add UDP semantics.

Basically, never retransmit, and whatever we get we immediately pass up to
the application. The only thing we do handle the TCP way is the FIN packet.

This also introduces the use of the aux entry in the header. We know that
older versions of UTCP ignore this field, and also ignore any extra data
in SYN packets, so we can add anything here in a backwards-compatible way.

7 years agoIntroduce utcp_connect_ex().
Guus Sliepen [Mon, 3 Jul 2017 20:31:50 +0000 (22:31 +0200)]
Introduce utcp_connect_ex().

This takes an extra argument "flags", which can be used to change the type
of connection to create. Possible flags are UTCP_INORDER, UTCP_RELIABLE and
UTCP_FRAMED, which can be bitwise-or'd together, or UTCP_TCP or UTCP_UDP as
shortcuts for what is assumed will be common combinations of those flags.

7 years agoFix handling packets partially overlapping the start of the receive buffer.
Guus Sliepen [Sun, 2 Jul 2017 19:35:55 +0000 (21:35 +0200)]
Fix handling packets partially overlapping the start of the receive buffer.

7 years agoFix handling retransmitted data when the receive buffer is full.
Guus Sliepen [Sun, 2 Jul 2017 13:43:57 +0000 (15:43 +0200)]
Fix handling retransmitted data when the receive buffer is full.

7 years agoRemove two unnecessary calls to abort().
Guus Sliepen [Sun, 2 Jul 2017 12:58:56 +0000 (14:58 +0200)]
Remove two unnecessary calls to abort().

7 years agoAllow test program to compare input to a reference file.
Guus Sliepen [Sun, 2 Jul 2017 12:58:08 +0000 (14:58 +0200)]
Allow test program to compare input to a reference file.

7 years agoFix compiler warnings.
Guus Sliepen [Sun, 2 Jul 2017 10:47:58 +0000 (12:47 +0200)]
Fix compiler warnings.

7 years agoFix buffer resizing logic in buffer_put_at().
Guus Sliepen [Thu, 17 Dec 2015 17:07:19 +0000 (18:07 +0100)]
Fix buffer resizing logic in buffer_put_at().

When growing the buffer when it's not big enough for new data, the
current size is doubled repeatedly until it is big enough for the new
data. The required new size is stored in the variable "required",
however the doubling loop exited when the new size was at least
buf->used + len, which might be much smaller than "required" if an
out-of-order packet is received.

7 years agoOnly log debug messages in test program when UTCP_DEBUG is defined.
Guus Sliepen [Sun, 15 Nov 2015 19:35:30 +0000 (20:35 +0100)]
Only log debug messages in test program when UTCP_DEBUG is defined.

7 years agoAdd more debug messages.
Guus Sliepen [Fri, 30 Oct 2015 22:42:35 +0000 (23:42 +0100)]
Add more debug messages.

7 years agoEnsure utcp_close() works properly on a socket that is in the CLOSED state.
Guus Sliepen [Fri, 30 Oct 2015 22:16:47 +0000 (23:16 +0100)]
Ensure utcp_close() works properly on a socket that is in the CLOSED state.

7 years agoLog when dropping packets in the test program.
Guus Sliepen [Fri, 30 Oct 2015 22:16:24 +0000 (23:16 +0100)]
Log when dropping packets in the test program.

7 years agoDefine USEC_PER_SEC, use "sec" and "usec" in comments.
Guus Sliepen [Sun, 2 Jul 2017 10:13:24 +0000 (12:13 +0200)]
Define USEC_PER_SEC, use "sec" and "usec" in comments.

7 years agoAdd debug message when dropping a packet because all SACK entries are used.
Guus Sliepen [Thu, 29 Oct 2015 15:36:39 +0000 (16:36 +0100)]
Add debug message when dropping a packet because all SACK entries are used.

7 years agoClarify description of sack_consume().
Guus Sliepen [Thu, 29 Oct 2015 15:35:16 +0000 (16:35 +0100)]
Clarify description of sack_consume().

7 years agoMake max() an inline function.
Guus Sliepen [Thu, 29 Oct 2015 15:33:45 +0000 (16:33 +0100)]
Make max() an inline function.

7 years agoDon't use ?: without the middle argument.
Guus Sliepen [Thu, 29 Oct 2015 15:31:17 +0000 (16:31 +0100)]
Don't use ?: without the middle argument.

7 years agoAlways check the return value of malloc().
Guus Sliepen [Thu, 29 Oct 2015 15:26:54 +0000 (16:26 +0100)]
Always check the return value of malloc().

7 years agoFix bugs in sack_consume() causing data corruption or abort()s.
Guus Sliepen [Mon, 19 Oct 2015 20:04:50 +0000 (22:04 +0200)]
Fix bugs in sack_consume() causing data corruption or abort()s.

Put in a lengthy comment with some ASCII-art to describe what we are
actually trying to do in this function.

7 years agoFix bug in retransmit().
Guus Sliepen [Mon, 19 Oct 2015 20:03:21 +0000 (22:03 +0200)]
Fix bug in retransmit().

The logic to check whether we actually have something to retransmit was
wrong, causing retransmit() to bail out early without setting or resetting
the timer. This also caused utcp_timeout() to return a negative value.

7 years agoEnsure FIN packets start the retransmission timer as well.
Guus Sliepen [Mon, 19 Oct 2015 19:18:14 +0000 (21:18 +0200)]
Ensure FIN packets start the retransmission timer as well.

7 years agoAllow setting $DROPFROM without having to specify $DROPTO as well.
Guus Sliepen [Mon, 19 Oct 2015 19:17:38 +0000 (21:17 +0200)]
Allow setting $DROPFROM without having to specify $DROPTO as well.

7 years agoSimulate packet reordering.
Guus Sliepen [Mon, 19 Oct 2015 19:17:06 +0000 (21:17 +0200)]
Simulate packet reordering.

With a configurable chance, delay a packet for a random amount of packets.

7 years agoFix a memory leak.
Guus Sliepen [Mon, 19 Oct 2015 18:46:27 +0000 (20:46 +0200)]
Fix a memory leak.

The receive buffer was never freed.

7 years agoMake sure all of the packet header is set when retransmitting packets.
Guus Sliepen [Mon, 19 Oct 2015 18:45:31 +0000 (20:45 +0200)]
Make sure all of the packet header is set when retransmitting packets.

7 years agospeed up utcp print_packet debug output and print in hex
Hannes [Thu, 15 Oct 2015 18:35:04 +0000 (20:35 +0200)]
speed up utcp print_packet debug output and print in hex

7 years agohandle overlapping packets
Hannes [Sat, 17 Oct 2015 13:39:12 +0000 (15:39 +0200)]
handle overlapping packets

# Conflicts:
# utcp.c

7 years agoSend ACKs also when receiving out-of-order data.
Guus Sliepen [Sun, 18 Oct 2015 18:53:55 +0000 (20:53 +0200)]
Send ACKs also when receiving out-of-order data.

This is necessary to trigger the triplicate ACK detection on the sender.

7 years agoLog when we start retransmission.
Guus Sliepen [Sun, 18 Oct 2015 18:31:34 +0000 (20:31 +0200)]
Log when we start retransmission.

7 years agoGet rid of an unused label.
Guus Sliepen [Sun, 18 Oct 2015 18:31:09 +0000 (20:31 +0200)]
Get rid of an unused label.