From: "reynir (Code Review)" Date: Mon, 22 Apr 2024 11:05:22 +0000 References: Reply-To: reynir@...2756..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="b790fOSZAlA="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: Only schedule_exit() once List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --b790fOSZAlA= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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/+/555?usp=3Demail to review the following change. Change subject: Only schedule_exit() once ...................................................................... Only schedule_exit() once If an exit has already been scheduled we should not schedule it again. Otherwise, the exit signal is never emitted if the peer reschedules the exit before the timeout occurs. Change-Id: I9457f005f4ba970502e6b667d9dc4299a588d661 Signed-off-by: Reynir Bj=C3=B6rnsson --- M src/openvpn/forward.c 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/555/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 8d10f25..70f8e9d 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -519,6 +519,11 @@ void schedule_exit(struct context *c, const int n_seconds, const int signal) { + /* don't reschedule if already scheduled; we drop the new signal, but = it + * only ever seems to be SIGTERM anyway. */ + if (event_timeout_defined(&c->c2.scheduled_exit)) { + return; + } tls_set_single_session(c->c2.tls_multi); update_time(); reset_coarse_timers(c); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/555?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: I9457f005f4ba970502e6b667d9dc4299a588d661 Gerrit-Change-Number: 555 Gerrit-PatchSet: 1 Gerrit-Owner: reynir Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --b790fOSZAlA= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld, plaisthos.

reynir would like plaisthos and flichtenheld to review = this change.

Vi= ew Change

Only schedule_exit() once

If an exit has already been = scheduled we should not schedule it again.
Otherwise, the exit signal is= never emitted if the peer reschedules the
exit before the timeout occur= s.

Change-Id: I9457f005f4ba970502e6b667d9dc4299a588d661
Signed-of= f-by: Reynir Bj=C3=B6rnsson <reynir@...2756...>
---
M src/openv= pn/forward.c
1 file changed, 5 insertions(+), 0 deletions(-)

g=
it pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/555/1
<= pre style=3D"font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index 8d10f25..70f8e9d 100644
--- a/src/openvpn/forward.c=
+++ b/src/openvpn/forward.c
@@ -519,6 +519= ,11 @@
void
schedule_exit(struct context = *c, const int n_seconds, const int signal)
{
+ /* don't reschedule if al= ready scheduled; we drop the new signal, but it
+ * only ever seems to be SIGTERM anyway. */=
+ if (event_timeo= ut_defined(&c->c2.scheduled_exit)) {
+ return;
+ }
tls_set_single_session(c->= ;c2.tls_multi);
update_time();
re= set_coarse_timers(c);

To view, visit change 555<= /a>. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9457f005f4ba970502e6b667d9d= c4299a588d661
Gerrit-Change-Number: 555
Gerrit-PatchSet: 1
Gerrit-Owner: reynir <reynir@...2756...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--b790fOSZAlA=--