From: "ralf_lici (Code Review)" Date: Mon, 16 Feb 2026 13:54:47 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="NoUru1YBW84="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: management: resync timer on bytecount interval change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --NoUru1YBW84= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/1531?usp=3Demail to review the following change. Change subject: management: resync timer on bytecount interval change ...................................................................... management: resync timer on bytecount interval change coarse_timer_wakeup tracks when the next timer-driven task will occur. If a user issues `bytecount n` via the management interface, but the next scheduled wakeup is more than n seconds away, bandwidth logging will be delayed until that timer fires. To ensure timely logging, reset the timer whenever a new `bytecount` command is received. This guarantees that logging begins exactly n seconds after the command, matching the user-defined interval. Change-Id: Ibea20c0f2c3df9f1f6509d662ab2b5fb4ce5e18d Signed-off-by: Ralf Lici --- M src/openvpn/manage.c 1 file changed, 23 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/31/1531/1 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 0e4afa2..6efe2d1 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -42,6 +42,7 @@ #include "manage.h" #include "openvpn.h" #include "dco.h" +#include "multi.h" #include "memdbg.h" @@ -485,6 +486,28 @@ man->connection.bytecount_update_seconds =3D 0; event_timeout_clear(&man->connection.bytecount_update_interval); } + + /* The newly received bytecount interval may be sooner than the existi= ng + * coarse timer wakeup. Reset the timer to ensure it fires at the corr= ect, + * earlier time. + */ + if (man->persist.callback.arg) + { + struct context *c; + + if (man->settings.flags & MF_SERVER) + { + struct multi_context *m =3D man->persist.callback.arg; + c =3D &m->top; + } + else + { + c =3D man->persist.callback.arg; + } + + reset_coarse_timers(c); + } + msg(M_CLIENT, "SUCCESS: bytecount interval changed"); } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1531?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: Ibea20c0f2c3df9f1f6509d662ab2b5fb4ce5e18d Gerrit-Change-Number: 1531 Gerrit-PatchSet: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --NoUru1YBW84= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

ralf_lici would like plaisthos to review this change.

V= iew Change

management: resync timer on bytecount inter=
val change

coarse_timer_wakeup tracks when the next timer-driven tas= k will occur.
If a user issues `bytecount n` via the management interfac= e, but the
next scheduled wakeup is more than n seconds away, bandwidth = logging
will be delayed until that timer fires.

To ensure timely = logging, reset the timer whenever a new `bytecount`
command is received.= This guarantees that logging begins exactly n
seconds after the command= , matching the user-defined interval.

Change-Id: Ibea20c0f2c3df9f1f6= 509d662ab2b5fb4ce5e18d
Signed-off-by: Ralf Lici <ralf@...2726...><= br>---
M src/openvpn/manage.c
1 file changed, 23 insertions(+), 0 del= etions(-)

git pull ssh://gerrit.openvpn.net:2941=
8/openvpn refs/changes/31/1531/1
diff --git a/src/openvpn/manage.c =
b/src/openvpn/manage.c
index 0e4afa2..6efe2d1 100644=
--- a/src/openvpn/manage.c
+++ b/src/openvpn/mana= ge.c
@@ -42,6 +42,7 @@
#include "mana= ge.h"
#include "openvpn.h"
= #include "dco.h"
+#include "multi.h"

#in= clude "memdbg.h"

@@ -485,6 +486= ,28 @@
man->connection.bytecount_update_seconds= =3D 0;
event_timeout_clear(&man->connectio= n.bytecount_update_interval);
}
+
+ /* The newly received bytecount interval may be sooner t= han the existing
+ = * coarse timer wakeup. Reset the timer to ensure it fires at the correct,=
+ * earlier time= .
+ */
= + if (man->persist.callba= ck.arg)
+ {=
+ struct context *c;=
+
+ if (man->settings.flags &am= p; MF_SERVER)
+ = {
+ stru= ct multi_context *m =3D man->persist.callback.arg;
+ c =3D &m->top;<= br>+ }
+ else
+ {
+ c =3D man->persist.callback.arg;=
+ }
+
+ reset_coarse_timers(c);
+ }
+
msg(M_CLIENT, "SUCCESS: byte= count interval changed");
}
<= br>

To view, visit change 1531. To unsubscribe, or for= help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Ibea20c0f2c3df9f1f6509d662ab= 2b5fb4ce5e18d
Gerrit-Change-Number: 1531
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --NoUru1YBW84=--