From patchwork Fri Aug 29 13:19:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4379 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:664d:b0:671:5a2c:6455 with SMTP id eu13csp356047mac; Fri, 29 Aug 2025 06:20:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHV5wGdh7SyicqhjtGLQtzfHlBO+ConKtBh2ZSaHAz7qDSa9UyZnI7PjL26Yleoh4egKBPTSovKHo=@openvpn.net X-Google-Smtp-Source: AGHT+IE31olUn3duyVyG1b0StesSln5W4Jh6NZ7fLP5dA+4hph0GGQWBLbYoIHuNWuykcNc0KaaJ X-Received: by 2002:a05:6870:178a:b0:315:bd97:e377 with SMTP id 586e51a60fabf-315bd97e6bdmr807726fac.9.1756473632468; Fri, 29 Aug 2025 06:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1756473632; cv=none; d=google.com; s=arc-20240605; b=PD/2OAmuLNoAatAv6k+zu7dlUF9l2ZY0PgBEJUy0gOkjOttH5rsc9v+UF3bhjmFJUY 7mkCzUzNJVu/DspSo7aGMd+4jQdM9w8dXDcMR/i3zPJw4XBRtn/GB4oFnL4qgid0+KJU GP4RNLUhafjp6Q47FZIGbAna9Yc3TTwcpSbkZfFcJ7O1D0sd2HKuaOjblZjjGkfyhC37 8GsRs1QwAIITb6Pjo5q9Dd2AsGeWcG/sCWo0UEkezKxLLURZOWvCwo13cpt4uOwuB2oC 8lCwEOawryWcE9kK2uZJL9NahpXIoDJOcFkGlHL2p8at2Cs2icyFDfKcj02lTp8uRZE1 GnmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=PF1NfZl7A9lVxF7GxZJYEvYTprFCkr8iDuLhD1MS6TY=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=FXJRCKuybsWdPN5Z4QZr/gN07Sq8MXH4d/Np4QFwb7Qa8dJrv9TnOa60dkwu7nXxYD 6sHfnUig3Ri9BQHu0630nWDQDH0Z0RL0NpJTjdICJRnufU0huKjFipVyczEOWAw9s4PT VNc5HgW2SbXnVoqDNpPamKa3jPiA4OXblVoLY/vIsntxHaipCIWsUUBAFaITQ0acwYej UvRqMiQLZwUPdJY/2le2CPykOcXj7ElM1wdQFGnqMgTM3rF31wEoaXN7UhzUbSd/Mj/c PCicfuQx1kPtsIyjzobnYp6hLPWZhMqIY84h0mlx3fKLelOj0OrnuRQ2NJ/mwM1nVHAh a7Ug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=LEOiCB3E; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=UI9DOJqg; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="V5/vJOzB"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-315affb089dsi777155fac.378.2025.08.29.06.20.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Aug 2025 06:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=LEOiCB3E; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=UI9DOJqg; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="V5/vJOzB"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PF1NfZl7A9lVxF7GxZJYEvYTprFCkr8iDuLhD1MS6TY=; b=LEOiCB3EGoeX/J3M6XZ1YTlKoL M9+JmOjjbTfp4ufzFNdZme3F08BNzNpfyYuxe/2qpY6tkTcbWL1/wH/LoGDT1IYlaPq6VuyqDlrHN qPe6eGAbqT+ONy6g19lyWqiMtsg/4j1YRwLtXV7Q8MxhQUo98S4JftQzv81pnbdiWKlw=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1urz1l-0000oh-8y; Fri, 29 Aug 2025 13:20:25 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1urz1g-0000oW-W8 for openvpn-devel@lists.sourceforge.net; Fri, 29 Aug 2025 13:20:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=z1MpY0ktnvU/8PDcHd0gPZzX8ZsF/90QBgwrsc6KrNw=; b=UI9DOJqgHvxsdehZaHJVqkVEYW H5Q9CQUVHqDej5wNXc4K4XOEnGDeRSud1Cu99+iSj/VmI9FJnBUZM9x5KcEa//fhGkPFuDgE2BK8y 1Ipa7NajvXkKCxZurg25xy9dXmd9IGpS1nlk7mHBN1VNfT1wxE8F4gqGSJ1tfXz5fbOI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=z1MpY0ktnvU/8PDcHd0gPZzX8ZsF/90QBgwrsc6KrNw=; b=V5/vJOzBTfR8pVrcQnNtlm+TQ6 xSKAbqhm5gO1lqpcFzNDxiLavC3eGSro47mALR02SVCg1J0eNVsjSk+jfVXu/ddHDzqEjfC5LU6Q0 Yju7J0P3IY99gCIjgwOyvh8zSRZ6zD+sH3CCHriQJ1S5idNCvO12omPHBKyXilx5LZeY=; Received: from [193.149.48.143] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1urz1f-0001S4-Ic for openvpn-devel@lists.sourceforge.net; Fri, 29 Aug 2025 13:20:20 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 57TDK74Y017582 for ; Fri, 29 Aug 2025 15:20:07 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 57TDK7Xg017581 for openvpn-devel@lists.sourceforge.net; Fri, 29 Aug 2025 15:20:07 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 29 Aug 2025 15:19:58 +0200 Message-ID: <20250829132006.17550-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Ralf Lici coarse_timer_wakeup tracks when the next timer-driven task will occur. When a user issues `bytecount n` on the management interface but the existing wakeup is more than n seconds ahead, bandwidth logg [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_DNSWL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to DNSWL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#DnsBlocklists-dnsbl-block for more information. [193.149.48.143 listed in list.dnswl.org] 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URI: openvpn.net] 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1urz1f-0001S4-Ic Subject: [Openvpn-devel] [PATCH v2] management: resync timer on bytecount interval change X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1841796095702215311?= X-GMAIL-MSGID: =?utf-8?q?1841796095702215311?= From: Ralf Lici coarse_timer_wakeup tracks when the next timer-driven task will occur. When a user issues `bytecount n` on the management interface but the existing wakeup is more than n seconds ahead, bandwidth logging won’t run until that original timer fires, delaying logs. Introduce a flag to detect when the bytecount interval changes and, when set, recalculate coarse_timer_wakeup so logging fires exactly n seconds after the command. This guarantees bytecount adheres to the user-specified interval. Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602 Signed-off-by: Ralf Lici Acked-by: Lev Stipakov --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1113 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Lev Stipakov diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index dfc6708..1c9b4f8 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -838,6 +838,19 @@ static void check_coarse_timers(struct context *c) { +#ifdef ENABLE_MANAGEMENT + /* The 'bytecount' command starts a timer at runtime, but it would not be + * processed if coarse_timer_wakeup was previously set to a higher value. + * Therefore, if the command has arrived, we reset coarse_timer_wakeup in + * to order to update it accordingly. + */ + if (management && management->connection.bytecount_interval_changed) + { + reset_coarse_timers(c); + management->connection.bytecount_interval_changed = false; + } +#endif /* ENABLE_MANAGEMENT */ + if (now < c->c2.coarse_timer_wakeup) { context_reschedule_sec(c, c->c2.coarse_timer_wakeup - now); diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 8836e79..0df78ee 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -503,6 +503,7 @@ man->connection.bytecount_update_seconds = 0; event_timeout_clear(&man->connection.bytecount_update_interval); } + man->connection.bytecount_interval_changed = true; msg(M_CLIENT, "SUCCESS: bytecount interval changed"); } diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h index eb19a4e..00e3931 100644 --- a/src/openvpn/manage.h +++ b/src/openvpn/manage.h @@ -318,6 +318,7 @@ bool state_realtime; bool log_realtime; bool echo_realtime; + bool bytecount_interval_changed; int bytecount_update_seconds; struct event_timeout bytecount_update_interval;