Skip to contentSkip to conversation

Change in openvpn[release/2.6]: management: stop bytecount on client disconnection

Openvpn-devel In review ralf_lici (Code Review) 2 participants 6 messages Feb 16 – Mar 5 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1771250081000.I6bdded6c70596b69428e6a00a405ac3cedc405fa@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1533?usp=email

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 I6bdded6c70596b69428e6a00a405ac3cedc405fa

---
M src/openvpn/manage.c

1 file changed, 9 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1533/1

src/openvpn/manage.c +9 -2
index 4ed0393..48b87e9 100644
@@ -472,6 +472,13 @@
 }
 
 static void
+man_bytecount_stop(struct management *man)
+{
+    man->connection.bytecount_update_seconds = 0;
+    event_timeout_clear(&man->connection.bytecount_update_interval);
+}
+
+static void
 man_bytecount(struct management *man, const int update_seconds)
 {
     if (update_seconds > 0)
@@ -483,8 +490,7 @@
     }
     else
     {
-        man->connection.bytecount_update_seconds = 0;
-        event_timeout_clear(&man->connection.bytecount_update_interval);
+        man_bytecount_stop(man);
     }
 
     /* The newly received bytecount interval may be sooner than the existing
@@ -2011,6 +2017,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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa
Gerrit-Change-Number: 1533
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: ralf_lici.

plaisthos has posted comments on this change by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1533?usp=email )

Change subject: management: stop bytecount on client disconnection
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1533?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa
Gerrit-Change-Number: 1533
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: ralf_lici <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Mar 2026 16:16:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 management: stop bytecount on client disconnection

In reply to a message not in the archive

From: Ralf Lici <[email protected]...>

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/manage.c +9 -2
index 4ed0393..48b87e9 100644
@@ -472,6 +472,13 @@
 }
 
 static void
+man_bytecount_stop(struct management *man)
+{
+    man->connection.bytecount_update_seconds = 0;
+    event_timeout_clear(&man->connection.bytecount_update_interval);
+}
+
+static void
 man_bytecount(struct management *man, const int update_seconds)
 {
     if (update_seconds > 0)
@@ -483,8 +490,7 @@
     }
     else
     {
-        man->connection.bytecount_update_seconds = 0;
-        event_timeout_clear(&man->connection.bytecount_update_interval);
+        man_bytecount_stop(man);
     }
 
     /* The newly received bytecount interval may be sooner than the existing
@@ -2011,6 +2017,7 @@
 {
     if (socket_defined(man->connection.sd_cli))
     {
+        man_bytecount_stop(man);
 #ifdef _WIN32
         man_stop_ne32(man);
 #endif
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: management: stop bytecount on client disconnection

This is a pretty direct backport of commit fccdb21733d2, which is easy enough, and has been thoroughly tested in master (= I did not explicitly test this again, beyond "buildbots are all green"). I assume that this is a prerequisite patch for more DCO/bytecount fix backports to come :-)

Your patch has been applied to the release/2.6 branch.

commit ea8185ca76b5ba1b9247e1445f2805948ed09a34 (release/2.6)

Author: Ralf Lici
Date:   Mon Mar 2 17:35:51 2026 +0100
     management: stop bytecount on client disconnection

     Signed-off-by: Ralf Lici <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35825.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1533?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35825.html

(cherry-picked from fccdb21733d2826bcdc080fdfa93b0283b5231b8)
---
M src/openvpn/manage.c

1 file changed, 9 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1533/2

src/openvpn/manage.c +9 -2
index 0e4afa2..3a2e84e 100644
@@ -471,6 +471,13 @@
 }
 
 static void
+man_bytecount_stop(struct management *man)
+{
+    man->connection.bytecount_update_seconds = 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 = 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I6bdded6c70596b69428e6a00a405ac3cedc405fa
Gerrit-Change-Number: 1533
Gerrit-PatchSet: 2
Gerrit-Owner: ralf_lici <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1533?usp=email )

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

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1533
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35825.html

(cherry-picked from fccdb21733d2826bcdc080fdfa93b0283b5231b8)
---
M src/openvpn/manage.c

1 file changed, 9 insertions(+), 2 deletions(-)
src/openvpn/manage.c +9 -2
index 0e4afa2..3a2e84e 100644
@@ -471,6 +471,13 @@
 }
 
 static void
+man_bytecount_stop(struct management *man)
+{
+    man->connection.bytecount_update_seconds = 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 = 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=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

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 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>