From: "ralf_lici (Code Review)" Date: Mon, 1 Sep 2025 19:21:53 +0000 In-Reply-To: References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="9CxX8BUzgjg="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: management: resync timer on bytecount interval change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld , stipa Cc: openvpn-devel --9CxX8BUzgjg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos, ralf_lici, stipa. Hello flichtenheld, plaisthos, stipa, I'd like you to reexamine a change. Please visit http://gerrit.openvpn.net/c/openvpn/+/1113?usp=3Demail to look at the new patch set (#3). The following approvals got outdated and were removed: Code-Review+2 by stipa The change is no longer submittable: Code-Review and checks~ChecksSubmitRul= e are unsatisfied now. 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: Ic0035d52e0ea123398318870d2f4d21af927a602 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/13/1113/3 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index aed04f5..53a3e4e 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -41,6 +41,7 @@ #include "manage.h" #include "openvpn.h" #include "dco.h" +#include "multi.h" #include "memdbg.h" @@ -513,6 +514,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/+/1113?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: Ic0035d52e0ea123398318870d2f4d21af927a602 Gerrit-Change-Number: 1113 Gerrit-PatchSet: 3 Gerrit-Owner: ralf_lici Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: ralf_lici Gerrit-Attention: stipa Gerrit-MessageType: newpatchset --9CxX8BUzgjg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos, ralf_lici, stipa.

ralf_lici uploaded patch set #3 to this change.

<= a href=3D"http://gerrit.openvpn.net/c/openvpn/+/1113?usp=3Demail">View Chan= ge

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

The change is no longer submittable: Code-Revi= ew and checks~ChecksSubmitRule are unsatisfied now.

management: resync time=
r on bytecount interval change

coarse_timer_wakeup tracks when the n= ext timer-driven task will occur.
If a user issues `bytecount n` via the= management interface, but the
next scheduled wakeup is more than n seco= nds away, bandwidth logging
will be delayed until that timer fires.
<= br>To ensure timely logging, reset the timer whenever a new `bytecount`
= command is received. This guarantees that logging begins exactly n
secon= ds after the command, matching the user-defined interval.

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

git pull ssh://gerrit.openvpn.net:2=
9418/openvpn refs/changes/13/1113/3
diff --git a/src/openvpn/manage=
.c b/src/openvpn/manage.c
index aed04f5..53a3e4e 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/m= anage.c
@@ -41,6 +41,7 @@
#include "m= anage.h"
#include "openvpn.h"
#include "dco.h"

+#include "multi.h"

= #include "memdbg.h"

@@ -513,6 += 514,28 @@
man->connection.bytecount_update_seco= nds =3D 0;
event_timeout_clear(&man->connec= tion.bytecount_update_interval);
}
+
+ /* The newly received bytecount interval may be sooner= than the existing
+ = * coarse timer wakeup. Reset the timer to ensure it fires at the correc= t,
+ * earlier ti= me.
+ */+ if (man->persist.call= back.arg)
+ {
+ struct context *= c;
+
+ if (man->settings.flags &= amp; MF_SERVER)
+ = {
+ st= ruct 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: byt= ecount interval changed");
}
=

To view, visit change 1113. To unsubscribe, or fo= r help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic0035d52e0ea123398318870d2f= 4d21af927a602
Gerrit-Change-Number: 1113
Gerrit-PatchSet: 3
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: ralf_lici <ralf@...2804...= .>
Gerrit-Attention: stipa <lstipakov@...1663...= .>
Gerrit-MessageType: newpatchset
--9CxX8BUzgjg=--