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=l6rD3nFw; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 84D905A0625 for ; Fri, 06 Feb 2026 07:17:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1770358661; bh=UWvDEaearmmC80tIU14u/n5bnVzxjk/eHOaw7uEyttY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l6rD3nFwVPcwxrmaPTwh31KyadurN5H39FiythxOcPOm7uJKthjK1Jxy9R/lh717I 3CF9T6UMrWEzpschhfQxXh/nN5CUzGuneMXwfvTFczwJGGh038ljNnpHKpkS4IzOv9 mgB7oPZix4LdeY3cFAc1I1+8shdAcARGAS3m8sz5rGQJGCUGoLZpismsUT9SwBalCi 0GBvSuUSlMWlrqGf/6NuGihGTyN/Ruh5TAnqE0kaBCAbMyQlE6AT4Lr4j9UBatPaJn onVeoUokn6HgMuBqcu3wyU2VayM2D96KlrEiuetBknP2qTUq7Tt00NkV8MGxxFw835 EfVza5RnEEYnA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4f6kQs2Y38z4w9Q; Fri, 06 Feb 2026 17:17:41 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 1/4] tcp: Remove non-working activity timeout mechanism Date: Fri, 6 Feb 2026 17:17:36 +1100 Message-ID: <20260206061739.33648-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260206061739.33648-1-david@gibson.dropbear.id.au> References: <20260206061739.33648-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CFMBO6IFXGJWJSEDFXGY6RKYMFIMIJY6 X-Message-ID-Hash: CFMBO6IFXGJWJSEDFXGY6RKYMFIMIJY6 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.53.0