]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
management: stop bytecount on client disconnection
authorRalf Lici <ralf@mandelbit.com>
Tue, 2 Sep 2025 16:35:09 +0000 (18:35 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 2 Sep 2025 17:04:29 +0000 (19:04 +0200)
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 <ralf@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20250902163514.22339-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32765.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/manage.c

index 422aa0bc92b8db2f5db558207841169765cb5556..5b2a7deb81a166b9bbba31d43b0a23c47670b68f 100644 (file)
@@ -500,6 +500,13 @@ man_status(struct management *man, const int version, struct status_output *so)
     }
 }
 
+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)
 {
@@ -511,8 +518,7 @@ man_bytecount(struct management *man, const int update_seconds)
     }
     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
@@ -1992,6 +1998,7 @@ man_reset_client_socket(struct management *man, const bool exiting)
 {
     if (socket_defined(man->connection.sd_cli))
     {
+        man_bytecount_stop(man);
 #ifdef _WIN32
         man_stop_ne32(man);
 #endif