diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2023-03-27 14:56:34 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2023-03-29 13:47:07 +0200 |
commit | 4e73e9bd655c8ebb3e253284f51d4349eea1cc5c (patch) | |
tree | 680864efaf7627cf595ae42e5ee78bc219ef9d46 /udp.c | |
parent | 085672f77cce3e91a116ac39cff581bca64ba50a (diff) | |
download | passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar.gz passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar.bz2 passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar.lz passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar.xz passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.tar.zst passt-4e73e9bd655c8ebb3e253284f51d4349eea1cc5c.zip |
tcp: Don't special case the handling of the ack of a syn
TCP treats the SYN packets as though they occupied 1 byte in the logical
data stream described by the sequence numbers. That is, the very first ACK
(or SYN-ACK) each side sends should acknowledge a sequence number one
greater than the initial sequence number given in the SYN or SYN-ACK it's
responding to.
In passt we were tracking that by advancing conn->seq_to_tap by one when
we send a SYN or SYN-ACK (in tcp_send_flag()). However, we also
initialized conn->seq_ack_from_tap, representing the acks we've already
seen from the tap side, to ISN+1, meaning we treated it has having
acknowledged the SYN before it actually did.
There were apparently reasons for this in earlier versions, but it causes
problems now. Because of this when we actually did receive the initial ACK
or SYN-ACK, we wouldn't see the acknoweldged serial number as advancing,
and so wouldn't clear the ACK_FROM_TAP_DUE flag.
In most cases we'd get away because subsequent packets would clear the
flag. However if one (or both) sides didn't send any data, the other side
would (correctly) keep sending ISN+1 as the acknowledged sequence number,
meaning we would never clear the ACK_FROM_TAP_DUE flag. That would mean
we'd treat the connection as if we needed to retransmit (although we had
0 bytes to retransmit), and eventaully (after around 30s) reset the
connection due to too many retransmits. Specifically this could cause the
iperf3 throughput tests in the testsuite to fail if set for a long enough
test period.
Correct this by initializing conn->seq_ack_from_tap to the ISN and only
advancing it when we actually get the first ACK (or SYN-ACK).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'udp.c')
0 files changed, 0 insertions, 0 deletions