From: "cron2 (Code Review)" Date: Thu, 5 Mar 2026 09:18:57 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="hiJXesJmmiM="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: management: stop bytecount on client disconnection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ralf_lici Cc: plaisthos , openvpn-devel --hiJXesJmmiM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 33?usp=3Demail ) Change subject: management: stop bytecount on client disconnection ...................................................................... management: stop bytecount on client disconnection When a management interface client requests periodic bytecount notifications, openvpn continues to emit them even after the client has disconnected. Additionally, upon reconnecting, the client starts receiving these notifications without having issued a new bytecount command. Stop the periodic bytecount operation when the management interface client disconnects, preventing unnecessary stats polling when using DCO and ensuring that clients only receive notifications they have explicitly requested. Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa Signed-off-by: Ralf Lici Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533 Message-Id: <20260302163557.18358-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 825.html Signed-off-by: Gert Doering (cherry-picked from fccdb21733d2826bcdc080fdfa93b0283b5231b8) --- M src/openvpn/manage.c 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 0e4afa2..3a2e84e 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -471,6 +471,13 @@ } static void +man_bytecount_stop(struct management *man) +{ + man->connection.bytecount_update_seconds =3D 0; + event_timeout_clear(&man->connection.bytecount_update_interval); +} + +static void man_bytecount(struct management *man, const int update_seconds) { if (update_seconds > 0) @@ -482,8 +489,7 @@ } else { - man->connection.bytecount_update_seconds =3D 0; - event_timeout_clear(&man->connection.bytecount_update_interval); + man_bytecount_stop(man); } msg(M_CLIENT, "SUCCESS: bytecount interval changed"); } @@ -1992,6 +1998,7 @@ { if (socket_defined(man->connection.sd_cli)) { + man_bytecount_stop(man); #ifdef _WIN32 man_stop_ne32(man); #endif -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1533?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa Gerrit-Change-Number: 1533 Gerrit-PatchSet: 2 Gerrit-Owner: ralf_lici Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --hiJXesJmmiM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

management: stop bytecount on client disconnecti=
on

When a management interface client requests periodic bytecountnotifications, openvpn continues to emit them even after the client hasdisconnected. Additionally, upon reconnecting, the client starts
receiv= ing these notifications without having issued a new bytecount
command.
Stop the periodic bytecount operation when the management interfaceclient disconnects, preventing unnecessary stats polling when using DCOand ensuring that clients only receive notifications they have
explici= tly requested.

Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa<= br>Signed-off-by: Ralf Lici <ralf@...2726...>
Acked-by: Arne Schwa= be <arne-openvpn@...1227...>
Gerrit URL: https://gerrit.openvpn.ne= t/c/openvpn/+/1533
Message-Id: <20260302163557.18358-1-gert@...2132...= .>
URL: https://www.mail-archive.com/openvpn-devel@...290...= net/msg35825.html
Signed-off-by: Gert Doering <gert@...1296...>(cherry-picked from fccdb21733d2826bcdc080fdfa93b0283b5231b8)
---
M = src/openvpn/manage.c
1 file changed, 9 insertions(+), 2 deletions(-)
=
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 0e4afa2..3a2e84e 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -471,6 +471,13= @@
}

static void

+man_bytecount_stop(struct= management *man)
+{<= /span>
+ man->connecti= on.bytecount_update_seconds =3D 0;
+ event_timeout_clear(&man->connection.bytecount_up= date_interval);
+}
+
+static void
man_bytecoun= t(struct management *man, const int update_seconds)
{
if (update_seconds > 0)
@@ -482,8 +489,= 7 @@
}
else
= {
- man->conn= ection.bytecount_update_seconds =3D 0;
- event_timeout_clear(&man->connection.byteco= unt_update_interval);
+ man_bytecount_stop(man);
}
= msg(M_CLIENT, "SUCCESS: bytecount interval changed");<= br> }
@@ -1992,6 +1998,7 @@
{=
if (socket_defined(man->connection.sd_cli))
{

+ ma= n_bytecount_stop(man);
#ifdef _WIN32
= man_stop_ne32(man);
#endif

=

To view, visit change 1533. To unsubscribe, or for help writing mail f= ilters, visit se= ttings.

<= div itemscope itemprop=3D"action" itemtype=3D"http://schema.org/ViewAction"= >
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I6bdded6c70596b69428e6a00a40= 5ac3cedc405fa
Gerrit-Change-Number: 1533
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --hiJXesJmmiM=--