From patchwork Tue Sep 2 16:00:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4391 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:2a1c:b0:671:5a2c:6455 with SMTP id k28csp1910168maz; Tue, 2 Sep 2025 09:01:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXRzQX8LxZBiOH0oOdBKH2/tHp6OXGRzwnyqYYX6VkcMzegddMuBZYB3DC7NOLna2aXKVIp3By5K70=@openvpn.net X-Google-Smtp-Source: AGHT+IGA6s2zPTy5EGsV89LgZ8jJYJ+Qjxyb6cVj6zW7Ti9EB5ZYjbjPsj9WPTXHj8YcRzrIiD6B X-Received: by 2002:a05:6870:1ecb:b0:30b:7a64:d67b with SMTP id 586e51a60fabf-31963065037mr6508453fac.5.1756828866150; Tue, 02 Sep 2025 09:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1756828866; cv=none; d=google.com; s=arc-20240605; b=dcprJZtiU3MpkuOemTnAPb4ICoHa5O8ZUm4bLVsEmQRasKtpZrfPwRNfmgk0aFO+hf Esydny0HvUDiZCpe+MU/ML1ThZ4eolQJ/5lx7gg2/hPGsMADngxr8QoOg3b2AM6Clirt BzZm1ctybuvwTLlp31gl5p/UjVP5gDp+n4G7YAMzH2tFsLFV2zfXMoNaIiKj81yoE1sf bMZxbuonC2FACG7Yd5tGrZM034qrZHP03aShxE0x1qPEf6fU5rnhLua5PKgfAY+sqjji 7sOnG+PPNTjZnl0r0ULidkuevMCGqdiC7SEDIskcEaHPNLJPouaZiN3K2t0P7ytaq1Se h+pw== 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=IKN4ub389JRWBmDs7nZS2TZh2aUW5ln87jIfCVhXUYY=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=lUeIFDOc/SiVvMEMtGs8EbqC0jXDB4oUN4mE3gu1TGKdVXVbizGlDlxmNl0Keh3joi z8QnSIu/MUd/sNUg/Zn/7mXyZluApD/6xk7Uw66YRntp3My16hJDnieulshXCWCU/iAx nVqc1UfUB2Cuv2VNmTHaYY7x/GlY/qK2bS/DA0vJLVuPWbEn7RZUytrghMyidgqtv58d VXGTVw1nWm5zqunVQ+heT2ZagjT8tWW57n7QUTXn2nd9NFszwoFonYdld0EEmsaqoXae TFMDoWB2YTqZVKXjj/GOKDRvtuf7ix2HkSyNLQm+DfPskItABv+L5u2y+qL5MsRN//HY mDPw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=gqJAVaRJ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ix1qvBzV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ONaPlZ6f; 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-319b5ff7fc9si478388fac.179.2025.09.02.09.01.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Sep 2025 09:01:05 -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=gqJAVaRJ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Ix1qvBzV; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=ONaPlZ6f; 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=IKN4ub389JRWBmDs7nZS2TZh2aUW5ln87jIfCVhXUYY=; b=gqJAVaRJ+FiM5JiUY5T85QmueW j50rffP1WgYtJY3BrdvHwgMsKbAaMrxXsjbFKO+VlI+XJO2J0FQ0S58OygwsbAAZEpZ5hc91bC6ab /WCtFZPRQ3k9TkvOPGWWizXbfL9pCRlq9c8w4d04amKZqh9jS+e5FSu1VdFkCkGiBDXY=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1utTRM-0006u0-93; Tue, 02 Sep 2025 16:01:00 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1utTRL-0006tu-7K for openvpn-devel@lists.sourceforge.net; Tue, 02 Sep 2025 16:00:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: 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=OdJfviJMbGNzvB9grFXbV7KmPIFNQ8HpL8IzF2/r6cY=; b=Ix1qvBzVqqhOUeV2Q8SS903Kgm uQbpxSCzIPwZDzLvId5GT78iGp8g0XC/5Q+HGJv1i9JCrgHBEZoJRqp2D8CFBTaV2I7kjN0hmzlrk F0Q1yWfaLTUhxDkCiPnuV49VddATcescdsxuxn7RSBvhsZsoDDkTqLLPjm71OAdHprNI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: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=OdJfviJMbGNzvB9grFXbV7KmPIFNQ8HpL8IzF2/r6cY=; b=ONaPlZ6fpXp15TZkM/GtRCE1Rl rq67dPDqGUf9Nwoz5HJu3hix25PGo1Y6l97Uc3wMO4CQDkQXHS/n6IJKFHZ9Ny7N6yy9WQKIiYybz Xjh2RBtUpEZlFFxlRj5AnPY03l+BwpEV8HU9Hm3AdfooJwqJbmdKFrtNTwWM49e6oQgA=; 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 1utTRK-0005er-3f for openvpn-devel@lists.sourceforge.net; Tue, 02 Sep 2025 16:00:59 +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 582G0pAS018658 for ; Tue, 2 Sep 2025 18:00:51 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 582G0pWf018657 for openvpn-devel@lists.sourceforge.net; Tue, 2 Sep 2025 18:00:51 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 2 Sep 2025 18:00:44 +0200 Message-ID: <20250902160050.18640-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-1.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. If a user issues `bytecount n` via the management interface, but the next scheduled wakeup is more than n seconds away, bandwidth [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1utTRK-0005er-3f Subject: [Openvpn-devel] [PATCH v5] 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?1842168584202439801?= From: Ralf Lici coarse_timer_wakeup tracks when the next timer-driven task will occur. If a user issues `bytecount n` via the management interface, but the next scheduled wakeup is more than n seconds away, bandwidth logging will be delayed until that timer fires. To ensure timely logging, reset the timer whenever a new `bytecount` command is received. This guarantees that logging begins exactly n seconds after the command, matching the user-defined interval. Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602 Signed-off-by: Ralf Lici Acked-by: Gert Doering --- 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 5 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index aed04f5..53a3e4e 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -41,6 +41,7 @@ #include "manage.h" #include "openvpn.h" #include "dco.h" +#include "multi.h" #include "memdbg.h" @@ -513,6 +514,28 @@ man->connection.bytecount_update_seconds = 0; event_timeout_clear(&man->connection.bytecount_update_interval); } + + /* The newly received bytecount interval may be sooner than the existing + * coarse timer wakeup. Reset the timer to ensure it fires at the correct, + * earlier time. + */ + if (man->persist.callback.arg) + { + struct context *c; + + if (man->settings.flags & MF_SERVER) + { + struct multi_context *m = man->persist.callback.arg; + c = &m->top; + } + else + { + c = man->persist.callback.arg; + } + + reset_coarse_timers(c); + } + msg(M_CLIENT, "SUCCESS: bytecount interval changed"); }