From: "ralf_lici (Code Review)" Date: Tue, 2 Sep 2025 16:30:56 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <9ad8de35b31ba42d39d6f2ff5b5bbb30b6c6c576-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="dwqEtkaZUFk="; 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: plaisthos , flichtenheld Cc: openvpn-devel --dwqEtkaZUFk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld, plaisthos. Hello plaisthos, flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1167?usp=3Demail to review the following change. 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 --- M src/openvpn/manage.c 1 file changed, 9 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/67/1167/1 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: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --dwqEtkaZUFk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

ralf_lici would like plaisthos and flichtenheld to review this change.

V= iew Change

management: stop bytecount on client disconnection

Wh= en a management interface client requests periodic bytecount
notificatio= ns, openvpn continues to emit them even after the client has
disconnecte= d. Additionally, upon reconnecting, the client starts
receiving these no= tifications without having issued a new bytecount
command.

Stop t= he periodic bytecount operation when the management interface
client dis= connects, preventing unnecessary stats polling when using DCO
and ensuri= ng that clients only receive notifications they have
explicitly requeste= d.

Change-Id: I1474d232278433d097baf85352dfc9a79853bad1
Signed-of= f-by: Ralf Lici <ralf@...2726...>
---
M src/openvpn/manage.c1 file changed, 9 insertions(+), 2 deletions(-)

git pull ssh://g=
errit.openvpn.net:29418/openvpn refs/changes/67/1167/1
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 @@
<= span> }

static void
+man_bytecount_stop(struct management *ma= n)
+{
+ man->connection.bytecount_up= date_seconds =3D 0;
+= event_timeout_clear(&man->connection.bytecount_update_interval);=
+}
+
+static void
man_bytecount(struct manage= ment *man, const int update_seconds)
{
= if (update_seconds > 0)
@@ -511,8 +518,7 @@
= }
else
{
- man->connection.bytecoun= t_update_seconds =3D 0;
- event_timeout_clear(&man->connection.bytecount_update_inte= rval);
+ man_b= ytecount_stop(man);
}

/* The newly received bytecount interval may be sooner than the exis= ting
@@ -1992,6 +1998,7 @@
{
if (socket_defined(man->connection.sd_cli))
= {
+ man_bytec= ount_stop(man);
#ifdef _WIN32
man= _stop_ne32(man);
#endif

<= p>To view, visit change 1167. To unsubscribe, or for help writing mail filters= , visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1474d232278433d097baf85352d= fc9a79853bad1
Gerrit-Change-Number: 1167
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--dwqEtkaZUFk=--