From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M9afIpzR; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 383865A0274 for ; Sun, 28 Sep 2025 09:30:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759044636; 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: in-reply-to:in-reply-to:references:references; bh=aplbqznJITn9igbc8e/c86iN4Vb2Ik2/MmlD5aLYf9Y=; b=M9afIpzRjpLnD19nPCauqgAtxi17gDyhXzY+uDAvjJniSkiEVTSn66f9/VGwKuaqwG5n3X VeNRUjd9RioYvvSIXGDM8RIO+hdMafmOlOdNPv2ghmTdXF5llZgAA/I1vfYHxW/UlNb8WX CZ3QhVkhzHdVZGGE4AQ6A29dABx1gio= 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-353-wEzUyxYaN7q8Fu4Lteo47Q-1; Sun, 28 Sep 2025 03:30:34 -0400 X-MC-Unique: wEzUyxYaN7q8Fu4Lteo47Q-1 X-Mimecast-MFC-AGG-ID: wEzUyxYaN7q8Fu4Lteo47Q_1759044633 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 7F8501800366; Sun, 28 Sep 2025 07:30:33 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.39]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 72F4C19560A2; Sun, 28 Sep 2025 07:30:30 +0000 (UTC) From: Yumei Huang To: passt-dev@passt.top, sbrivio@redhat.com Subject: [PATCH 2/2] tcp: Resend SYN for inbound connections Date: Sun, 28 Sep 2025 15:29:46 +0800 Message-ID: <20250928072946.15284-3-yuhuang@redhat.com> In-Reply-To: <20250928072946.15284-1-yuhuang@redhat.com> References: <20250928072946.15284-1-yuhuang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: W-5zmdKOex7KJ7HXBc7YOxPAFuYZbwsoLedcXRMOXDM_1759044633 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: GIGDHJNAEDRBPABX5P4BX6B3QTZRDDRV X-Message-ID-Hash: GIGDHJNAEDRBPABX5P4BX6B3QTZRDDRV X-MailFrom: yuhuang@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: david@gibson.dropbear.id.au, yuhuang@redhat.com 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 a client connects while guest is not connected or ready yet, resend SYN instead of just resetting connection after SYN_TIMEOUT. Signed-off-by: Yumei Huang --- tcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tcp.c b/tcp.c index 21b75a5..6fe8678 100644 --- a/tcp.c +++ b/tcp.c @@ -2378,8 +2378,15 @@ void tcp_timer_handler(const struct ctx *c, union epoll_ref ref) tcp_timer_ctl(c, conn); } else if (conn->flags & ACK_FROM_TAP_DUE) { if (!(conn->events & ESTABLISHED)) { - flow_dbg(conn, "handshake timeout"); - tcp_rst(c, conn); + if (conn->retries == TCP_MAX_RETRANS){ + flow_dbg(conn, "handshake timeout"); + tcp_rst(c, conn); + } else { + flow_dbg(conn, "SYN timeout, retry"); + tcp_send_flag(c, conn, SYN); + conn->retries++; + tcp_timer_ctl(c, conn); + } } else if (CONN_HAS(conn, SOCK_FIN_SENT | TAP_FIN_ACKED)) { flow_dbg(conn, "FIN timeout"); tcp_rst(c, conn); -- 2.47.0