From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id A61C75A0271 for ; Fri, 27 Nov 2026 18:58:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795802336; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=1A+DrQvp+dEz0+hDR9GgwffU6C7X15gQm3zDO3v7N4I=; b=DWtU6y2EtnJQSII2IPtS7EiB8uva6LGYt3YYkMMRxRHiOZXc5WrmM1VWT5vpFUC+DVBcFd WFd4rNMDRW3Ry6sB3ggEgcBxhgG5cxiYbNxDy2gkswhVW9Bb01oVsXzw+VUeuvlxOFVvOq MzU1ljjiMHOFLsc9OVn5dKe+GRaGLFs= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-650-xXA8rz63Nyqn__PFHrL5pg-1; Fri, 27 Nov 2026 17:58:54 +0000 X-MC-Unique: xXA8rz63Nyqn__PFHrL5pg-1 X-Mimecast-MFC-AGG-ID: xXA8rz63Nyqn__PFHrL5pg_1795802333 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 987811800547; Fri, 27 Nov 2026 17:58:53 +0000 (UTC) Received: from anskuma-thinkpadp1gen7.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 24722195604A; Fri, 27 Nov 2026 17:58:50 +0000 (UTC) From: Anshu Kumari To: passt-dev@passt.top, sbrivio@redhat.com, ada.urbaniec+bugzilla@gmail.com Subject: [PATCH v4] tcp: Limit fast retransmit to one per loss event Date: Fri, 27 Nov 2026 23:28:48 +0530 Message-ID: <20261127175848.664310-1-anskuma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0xSzL74RiFpnrYrJbyy5LdmWIb6NP5DIPJqQDOTIHPg_1795802333 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 7CDQH5W2WQIHCXEQNZ6NZ5Z64KZEWKOZ X-Message-ID-Hash: 7CDQH5W2WQIHCXEQNZ6NZ5Z64KZEWKOZ X-MailFrom: anskuma@redhat.com 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: anskuma@redhat.com, Ada Urbaniec 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: Every duplicate ACK unconditionally triggered a fast retransmit, even when the ACK sequence hadn't advanced. Guard fast retransmit on !conn->retries, and increment retries after the first retransmit. This is a quick fix to stop the amplification storm. Full compliance with RFC 5681 Section 3.2 (three duplicate ACKs) is left to a later patch. As a fast retransmit is now accounted in conn->retries, the next retransmission timeout is doubled (tcp_timer_ctl() uses conn->retries as backoff exponent). Link: https://bugs.passt.top/show_bug.cgi?id=224 Reported-by: Ada Urbaniec Signed-off-by: Anshu Kumari --- v4: - Move !conn->retries into the retr check in TAP_FIN_RCVD - Add previous ACK/window snapshots in TAP_FIN_RCVD - includes Reported-by --- tcp.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tcp.c b/tcp.c index 95f4f3e1..f327e62e 100644 --- a/tcp.c +++ b/tcp.c @@ -2082,7 +2082,9 @@ static int tcp_data_from_tap(const struct ctx *c, struct tcp_tap_conn *conn, tcp_tap_window_update(c, conn, max_ack_seq_wnd, now); - if (retr) { + if (retr && !conn->retries) { + conn->retries++; + flow_trace(conn, "fast re-transmit, ACK: %u, previous sequence: %u", conn->seq_ack_from_tap, conn->seq_to_tap); @@ -2417,6 +2419,8 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, /* Established connections not accepting data from tap */ if (conn->events & TAP_FIN_RCVD) { + uint32_t prev_ack = conn->seq_ack_from_tap; + uint16_t prev_wnd = conn->wnd_from_tap; bool fin_only, retr; size_t dlen; @@ -2432,7 +2436,7 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, fin_only = (conn->events & TAP_FIN_SENT) && conn->seq_to_tap == conn->seq_ack_from_tap + 1; - retr = th->ack && !th->fin && !fin_only && + retr = th->ack && !th->fin && !fin_only && !conn->retries && ntohl(th->ack_seq) == conn->seq_ack_from_tap && ntohs(th->window) == conn->wnd_from_tap; @@ -2444,6 +2448,8 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, now); if (retr) { + conn->retries++; + flow_trace(conn, "fast re-transmit, ACK: %u, previous sequence: %u", ntohl(th->ack_seq), conn->seq_to_tap); @@ -2452,8 +2458,10 @@ int tcp_tap_handler(const struct ctx *c, uint8_t pif, sa_family_t af, return -1; } - if (tcp_tap_window_update(c, conn, ntohs(th->window), now) || - retr) + if (tcp_tap_window_update(c, conn, ntohs(th->window), now) && + (retr || + prev_ack != conn->seq_ack_from_tap || + prev_wnd != conn->wnd_from_tap)) tcp_data_from_sock(c, conn, now); if (conn->seq_ack_from_tap == conn->seq_to_tap) { -- 2.55.0