From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202512 header.b=RLNAaJNe; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 02B295A065C for ; Wed, 04 Feb 2026 12:42:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1770205359; bh=GIi0DhvBEahXUrV0uYVh700/aydOWlewGhvpRUpKbq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RLNAaJNeiQKjZuYtweKItyXHErx/WZehJu/WtO0eFnwgcfA66Oclm4bkZXPA0Azki uuk1PUVWwUo93A9BbTblZX2Z7cCkcZHvohyh+M1ldzI/GqMLPSgBhNUlY7yE/pb6Yg /RPWQ4aARCbtEYa5K5vNh6gLFqNPPiIGjA/L5vIl7afM9BzP7QBi5fxvjseF1IP3SX 9cDO7AsV44IcT4+Qjmoqx5N2ejJJfCzt4aJO4RidEYyLfgMpAKU+oanzK/6Z1xoA2u QfG5aOij+26oW7h2n0N1m9GdAgEvN7wescncbV2crDkef1MTjWD4p+avcSm2SPEBMA 0genihQRIKOqA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4f5dkl0J3Mz4w9T; Wed, 04 Feb 2026 22:42:39 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH 1/4] tcp: Remove non-working activity timeout mechanism Date: Wed, 4 Feb 2026 21:41:34 +1000 Message-ID: <20260204114137.2784090-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260204114137.2784090-1-david@gibson.dropbear.id.au> References: <20260204114137.2784090-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: LHGOYQZDQIA6TUSZZD77XR5JUQYVM7IN X-Message-ID-Hash: LHGOYQZDQIA6TUSZZD77XR5JUQYVM7IN X-MailFrom: dgibson@gandalf.ozlabs.org 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 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: This mechanism was intended to remove connections which have had no activity for two hours, even if they haven't closed or been reset internally. It operated by setting the two hour timeout if there are no sooner TCP timeouts to schedule. However, when the timer fires, the way we detect the case of the activity timeout doesn't work: it resets the timer for another two hours, then checks if the old timeout was two hours. But the old timeout returned by timerfd_settime() is not the original value of the timer, but the remaining time. Since the timer has just fired it will essentially always be 0. For now, just remove the mechanism, disarming the timer entirely if there isn't another upcoming event. We'll re-introduce some sort of activity timeout by a different means later. Signed-off-by: David Gibson --- tcp.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/tcp.c b/tcp.c index 0a64892a..f8663369 100644 --- a/tcp.c +++ b/tcp.c @@ -190,9 +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 * - * - ACT_TIMEOUT, in the presence of any event: if no activity is detected on - * either side, the connection is reset - * * - RTT / 2 elapsed after data segment received from tap without having * sent an ACK segment, or zero-sized window advertised to tap/guest (flag * ACK_TO_TAP_DUE): forcibly check if an ACK segment can be sent. @@ -589,7 +586,9 @@ static void tcp_timer_ctl(const struct ctx *c, struct tcp_tap_conn *conn) timeout <<= MAX(exp, 0); it.it_value.tv_sec = MIN(timeout, c->tcp.rto_max); } else { - it.it_value.tv_sec = ACT_TIMEOUT; + /* Disarm */ + it.it_value.tv_sec = 0; + it.it_value.tv_nsec = 0; } if (conn->flags & ACK_TO_TAP_DUE) { @@ -2598,23 +2597,6 @@ void tcp_timer_handler(const struct ctx *c, union epoll_ref ref) tcp_data_from_sock(c, conn); tcp_timer_ctl(c, conn); } - } else { - struct itimerspec new = { { 0 }, { ACT_TIMEOUT, 0 } }; - struct itimerspec old = { { 0 }, { 0 } }; - - /* Activity timeout: if it was already set, reset the - * connection, otherwise, it was a left-over from ACK_TO_TAP_DUE - * or ACK_FROM_TAP_DUE, so just set the long timeout in that - * case. This avoids having to preemptively reset the timer on - * ~ACK_TO_TAP_DUE or ~ACK_FROM_TAP_DUE. - */ - if (timerfd_settime(conn->timer, 0, &new, &old)) - flow_perror(conn, "failed to set timer"); - - if (old.it_value.tv_sec == ACT_TIMEOUT) { - flow_dbg(conn, "activity timeout"); - tcp_rst(c, conn); - } } } -- 2.52.0