From: "cron2 (Code Review)" Date: Tue, 2 Sep 2025 17:07:17 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="eF+VjRD62J4="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: management: stop bytecount on client disconnection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ralf_lici Cc: plaisthos , flichtenheld , openvpn-devel --eF+VjRD62J4= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/11= 67?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: I1474d232278433d097baf85352dfc9a79853bad1 Signed-off-by: Ralf Lici Acked-by: Gert Doering Message-Id: <20250902163514.22339-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32= 765.html Signed-off-by: Gert Doering --- 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 422aa0b..5b2a7de 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -501,6 +501,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) @@ -511,8 +518,7 @@ } else { - man->connection.bytecount_update_seconds =3D 0; - event_timeout_clear(&man->connection.bytecount_update_interval); + man_bytecount_stop(man); } /* The newly received bytecount interval may be sooner than the existi= ng @@ -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/+/1167?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I1474d232278433d097baf85352dfc9a79853bad1 Gerrit-Change-Number: 1167 Gerrit-PatchSet: 2 Gerrit-Owner: ralf_lici Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --eF+VjRD62J4= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

management: stop bytecount on client disconne=
ction

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
rec= eiving these notifications without having issued a new bytecount
command= .

Stop the periodic bytecount operation when the management interfac= e
client disconnects, preventing unnecessary stats polling when using DC= O
and ensuring that clients only receive notifications they have
expl= icitly requested.

Change-Id: I1474d232278433d097baf85352dfc9a79853ba= d1
Signed-off-by: Ralf Lici <ralf@...2726...>
Acked-by: Gert Do= ering <gert@...1296...>
Message-Id: <20250902163514.22339-1-ger= t@...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1096...= ourceforge.net/msg32765.html
Signed-off-by: Gert Doering <gert@...1826...= 6...>
---
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 422aa0b..5b2a7de 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -501,6 +501,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)
@@ -511,8 +518,= 7 @@
}
else
= {
- man->conn= ection.bytecount_update_seconds =3D 0;
- event_timeout_clear(&man->connection.byteco= unt_update_interval);
+ man_bytecount_stop(man);
}
=
/* The newly received bytecount interval may be soone= r than the existing
@@ -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 change 1167. To unsubscribe, or for help writin= g mail filters, visit settin= gs.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1474d232278433d097baf85352d= fc9a79853bad1
Gerrit-Change-Number: 1167
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--eF+VjRD62J4=--