From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id B93665A027B; Fri, 15 Aug 2025 18:10:42 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 1/6] tcp: FIN flags have to be retransmitted as well Date: Fri, 15 Aug 2025 18:10:37 +0200 Message-ID: <20250815161042.3606244-2-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250815161042.3606244-1-sbrivio@redhat.com> References: <20250815161042.3606244-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: KLEDPCUGLYU5UNYSDSCPGPUTURKE3LY7 X-Message-ID-Hash: KLEDPCUGLYU5UNYSDSCPGPUTURKE3LY7 X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Jon Maloy , Paul Holzinger X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If we're retransmitting any data, and we sent a FIN segment to our peer, regardless of whether it was received, we obviously have to retransmit it as well, given that it can only come with the last data segment, or after it. Unconditionally clear the internal TAP_FIN_SENT flag whenever we re-transmit, so that we know we have to send it again, in case. Reported-by: Paul Holzinger Signed-off-by: Stefano Brivio --- tcp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tcp.c b/tcp.c index 957b498..7c1f237 100644 --- a/tcp.c +++ b/tcp.c @@ -1759,6 +1759,7 @@ static int tcp_data_from_tap(const struct ctx *c, struct tcp_tap_conn *conn, "fast re-transmit, ACK: %u, previous sequence: %u", max_ack_seq, conn->seq_to_tap); conn->seq_to_tap = max_ack_seq; + conn->events &= ~TAP_FIN_SENT; if (tcp_set_peek_offset(conn, 0)) { tcp_rst(c, conn); return -1; @@ -2286,6 +2287,7 @@ void tcp_timer_handler(const struct ctx *c, union epoll_ref ref) flow_dbg(conn, "ACK timeout, retry"); conn->retrans++; conn->seq_to_tap = conn->seq_ack_from_tap; + conn->events &= ~TAP_FIN_SENT; if (!conn->wnd_from_tap) conn->wnd_from_tap = 1; /* Zero-window probe */ if (tcp_set_peek_offset(conn, 0)) { -- 2.43.0