From: "cron2 (Code Review)" Date: Tue, 2 Sep 2025 16:11:53 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, ralf@...2726..., frank@...2641..., lstipakov@...277... Message-ID: <9176195c7878be8b3b541806cb6dbf535bb9a974-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="pnI0gPsoIgw="; 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: ralf_lici , plaisthos , flichtenheld , stipa Cc: openvpn-devel --pnI0gPsoIgw= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#6) to the change originally created by= ralf_lici. ( http://gerrit.openvpn.net/c/openvpn/+/1113?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by cron2 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 Acked-by: Gert Doering Message-Id: <20250902160050.18640-1-gert@...1296...> URL: https://sourceforge.net/p/openvpn/mailman/message/59228306/ Signed-off-by: Gert Doering --- M src/openvpn/manage.c 1 file changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/1113/6 diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 52b0e5e..422aa0b 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -514,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: 6 Gerrit-Owner: ralf_lici Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: newpatchset --pnI0gPsoIgw= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 uploaded patch set #6 to the change originally cr= eated by ralf_lici.

View Change

The following approvals got outdate= d and were removed: Code-Review+2 by cron2

management: resync timer on bytecount interval chang=
e

coarse_timer_wakeup tracks when the next timer-driven task will oc= cur.
If a user issues `bytecount n` via the management interface, but th= e
next scheduled wakeup is more than n seconds away, bandwidth loggingwill be delayed until that timer fires.

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

Change-Id: Ic0035d52e0ea123398318870d2f= 4d21af927a602
Signed-off-by: Ralf Lici <ralf@...2726...>
Acked-= by: Gert Doering <gert@...1296...>
Message-Id: <20250902160050.= 18640-1-gert@...1296...>
URL: https://sourceforge.net/p/openvpn/mailm= an/message/59228306/
Signed-off-by: Gert Doering <gert@...1296...>=
---
M src/openvpn/manage.c
1 file changed, 22 insertions(+), 0 de= letions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/c=
hanges/13/1113/6
diff --git a/src/openvpn/manage.c b/src/openvpn/ma=
nage.c
index 52b0e5e..422aa0b 100644
--- a/= src/openvpn/manage.c
+++ b/src/openvpn/manage.c
<= span>@@ -514,6 +514,28 @@
man->connection.bytec= ount_update_seconds =3D 0;
event_timeout_clear(&am= p;man->connection.bytecount_update_interval);
}
+
+ /* The newly received bytecount inter= val may be sooner than the existing
+ * coarse timer wakeup. Reset the timer to ensure it fi= res at the correct,
+= * earlier time.
= + */
+ if (man= ->persist.callback.arg)
+ {
+ = struct context *c;
+=
+ if (man->= ;settings.flags & MF_SERVER)
+ {
+ c =3D &= ;m->top;
+ = }
+ else
+ {
+ c =3D man->persist.c= allback.arg;

+ = }
+
+ reset_coarse_timers(c);
+ }
+
msg(M_CLIENT, &q= uot;SUCCESS: bytecount interval changed");
}

To view, visit change 1113. To un= subscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic0035d52e0ea123398318870d2f= 4d21af927a602
Gerrit-Change-Number: 1113
Gerrit-PatchSet: 6
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: cron2 <gert@...1296...>=
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-MessageType: newpatchset
--pnI0gPsoIgw=--