aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorJon Maloy <jmaloy@redhat.com>2026-11-25 19:13:27 -0500
committerStefano Brivio <sbrivio@redhat.com>2026-11-27 02:42:24 +0100
commitb6453be585bd224451ae42dea3e1a4dc2f271d95 (patch)
tree5398b22916df2d4d50759da82c5f0b57bee1ae19
parent6af105391cea3c6501ede02ffe937af26b544ba8 (diff)
downloadpasst-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar.gz
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar.bz2
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar.lz
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar.xz
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.tar.zst
passt-b6453be585bd224451ae42dea3e1a4dc2f271d95.zip
tcp_buf: Don't fill the slot reserved for duplicate ACKs with data
Since commit db7fb06f710e ("tcp_buf: Always reserve slot for possible duplicate ACK flag in the same batch"), tcp_data_to_tap() flushes the batch when only one free slot is left. However, in passt mode, tcp_buf_data_from_sock() can still receive into all TCP_FRAMES_MEM buffers at once, meaning that if it gets more than TCP_FRAMES_MEM - 1 segments, tcp_data_to_tap() flushes after the second last one, and then continues with building the last frame in slot 0. This has the consequence that the last segment is forwarded to the guest with the payload of the first segment, which we just sent, instead of the one we received into the last slot. We limit the number of buffers we receive into to TCP_FRAMES_MEM - 1, so that a whole batch of data frames always fits before the reserved slot. This also fixes a clang-tidy 23 warning in tcp_buf_data_from_sock(), as the check on available slots there can now be false. Fixes: db7fb06f710e ("tcp_buf: Always reserve slot for possible duplicate ACK flag in the same batch") Signed-off-by: Jon Maloy <jmaloy@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--tcp_buf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tcp_buf.c b/tcp_buf.c
index 0780a32..c9d675e 100644
--- a/tcp_buf.c
+++ b/tcp_buf.c
@@ -35,7 +35,7 @@
#define TCP_FRAMES_MEM 128
#define TCP_FRAMES \
- (c->mode == MODE_PASTA ? 1 : TCP_FRAMES_MEM)
+ (c->mode == MODE_PASTA ? 1 : TCP_FRAMES_MEM - 1)
/* Static buffers */