Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1113?usp=email
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.
When a user issues `bytecount n` on the management interface but the
existing wakeup is more than n seconds ahead, bandwidth logging won’t
run until that original timer fires, delaying logs.
Introduce a flag to detect when the bytecount interval changes and,
when set, recalculate coarse_timer_wakeup so logging fires exactly
n seconds after the command. This guarantees bytecount adheres to the
user-specified interval.
Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602
Signed-off-by: Ralf Lici <[email protected]>
---
M src/openvpn/forward.c
M src/openvpn/manage.c
M src/openvpn/manage.h
3 files changed, 15 insertions(+), 0 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/13/1113/1
diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index a4f260a..192fff4 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -838,6 +838,19 @@
static void
check_coarse_timers(struct context *c)
{
+#ifdef ENABLE_MANAGEMENT
+ /* The 'bytecount' command starts a timer at runtime, but it would not be
+ * processed if coarse_timer_wakeup was previously set to a higher value.
+ * Therefore, if the command has arrived, we reset coarse_timer_wakeup in
+ * to order to update it accordingly.
+ */
+ if (management && management->connection.bytecount_interval_changed)
+ {
+ reset_coarse_timers(c);
+ management->connection.bytecount_interval_changed = false;
+ }
+#endif /* ENABLE_MANAGEMENT */
+
if (now < c->c2.coarse_timer_wakeup)
{
context_reschedule_sec(c, c->c2.coarse_timer_wakeup - now);
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 8836e79..0df78ee 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -503,6 +503,7 @@
man->connection.bytecount_update_seconds = 0;
event_timeout_clear(&man->connection.bytecount_update_interval);
}
+ man->connection.bytecount_interval_changed = true;
msg(M_CLIENT, "SUCCESS: bytecount interval changed");
}
diff --git a/src/openvpn/manage.h b/src/openvpn/manage.h
index eb19a4e..00e3931 100644
--- a/src/openvpn/manage.h
+++ b/src/openvpn/manage.h
@@ -318,6 +318,7 @@
bool state_realtime;
bool log_realtime;
bool echo_realtime;
+ bool bytecount_interval_changed;
int bytecount_update_seconds;
struct event_timeout bytecount_update_interval;
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1113?usp=email
To unsubscribe, or for help writing mail filters, visit
http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602
Gerrit-Change-Number: 1113
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel