public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 1/3] tcp: Retransmit FINs like data segments
Date: Fri, 30 Jan 2026 15:41:02 +1100	[thread overview]
Message-ID: <20260130044104.1793253-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260130044104.1793253-1-david@gibson.dropbear.id.au>

RFC 9293 doesn't distinguish between regular data segments and FIN segments
for the purposes of retransmissions.  Our existing retransmission logic
will also work for FIN segments, except for one detail: we don't currently
set the ACK_FROM_TAP_DUE flag when we send a FIN.  Add the flag, so that
we'll properly retransmit FIN segments like data segments.

Remove the section from the theory of operation comment that describes a
different way of handling FIN timeouts which (a) isn't correct behaviour
and (b) doesn't appear to be implemented.

I've tested this by adding logic to suppress sending the FIN if retries <
some non-zero value.  We correctly resend the FIN and close normally after
the expected timeouts.

Link: https://bugs.passt.top/show_bug.cgi?id=195
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 tcp.c     | 4 ----
 tcp_buf.c | 1 +
 tcp_vu.c  | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tcp.c b/tcp.c
index 17e5b006..dbfde2e0 100644
--- a/tcp.c
+++ b/tcp.c
@@ -190,10 +190,6 @@
  * - RTO_INIT_AFTER_SYN_RETRIES: if SYN retries happened during handshake and
  *   RTO is less than this, re-initialise RTO to this for data retransmissions
  *
- * - FIN_TIMEOUT: if a FIN segment was sent to tap/guest (flag ACK_FROM_TAP_DUE
- *   with TAP_FIN_SENT event), and no ACK is received within this time, reset
- *   the connection
- *
  * - FIN_TIMEOUT: if a FIN segment was acknowledged by tap/guest and a FIN
  *   segment (write shutdown) was sent via socket (events SOCK_FIN_SENT and
  *   TAP_FIN_ACKED), but no socket activity is detected from the socket within
diff --git a/tcp_buf.c b/tcp_buf.c
index 5d419d36..d2925410 100644
--- a/tcp_buf.c
+++ b/tcp_buf.c
@@ -407,6 +407,7 @@ int tcp_buf_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn)
 			}
 
 			conn_event(c, conn, TAP_FIN_SENT);
+			conn_flag(c, conn, ACK_FROM_TAP_DUE);
 		}
 
 		return 0;
diff --git a/tcp_vu.c b/tcp_vu.c
index db9db78a..b9e9b55e 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -425,6 +425,7 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn)
 			}
 
 			conn_event(c, conn, TAP_FIN_SENT);
+			conn_flag(c, conn, ACK_FROM_TAP_DUE);
 		}
 
 		return 0;
-- 
2.52.0


  reply	other threads:[~2026-01-30  4:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30  4:41 [PATCH v2 0/3] Fix errors in FIN timeout logic David Gibson
2026-01-30  4:41 ` David Gibson [this message]
2026-01-30  4:41 ` [PATCH v2 2/3] tcp: Eliminate FIN_TIMEOUT David Gibson
2026-01-30  4:41 ` [PATCH v2 3/3] tcp, tcp_splice: Check for failures of shutdown(2) David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260130044104.1793253-2-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).