From: "flichtenheld (Code Review)" Date: Fri, 7 Nov 2025 12:11:48 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <1cdc7c6d199846dedc408fc4735749e665fbbfb5-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="OeZZmYsZZ84="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: forward: Change context_reschedule_sec sec argument to time_t List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --OeZZmYsZZ84= 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/+/1356?usp=3Demail to review the following change. Change subject: forward: Change context_reschedule_sec sec argument to time= _t ...................................................................... forward: Change context_reschedule_sec sec argument to time_t This avoids conversions at the caller sites. Since we only replace tv_sec if the new value is smaller the cast to tv_sec_t is also safe. Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35 Signed-off-by: Frank Lichtenheld --- M src/openvpn/forward.c 1 file changed, 8 insertions(+), 7 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/1356/1 diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index cffb310..fbef539 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -33,6 +33,7 @@ #include "mss.h" #include "event.h" #include "occ.h" +#include "otime.h" #include "ping.h" #include "ps.h" #include "dhcp.h" @@ -127,7 +128,7 @@ } static inline void -context_reschedule_sec(struct context *c, int sec) +context_reschedule_sec(struct context *c, time_t sec) { if (sec < 0) { @@ -135,7 +136,7 @@ } if (sec < c->c2.timeval.tv_sec) { - c->c2.timeval.tv_sec =3D sec; + c->c2.timeval.tv_sec =3D (tv_sec_t)sec; c->c2.timeval.tv_usec =3D 0; } } @@ -822,11 +823,6 @@ #endif /* ENABLE_MANAGEMENT */ } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - static void check_coarse_timers(struct context *c) { @@ -1297,6 +1293,11 @@ #endif /* if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARG= ET_FREEBSD)) */ } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + /* * Output: c->c2.buf */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1356?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: master Gerrit-Change-Id: Id9158f477404aac1d6b08b08e672980e5a58dc35 Gerrit-Change-Number: 1356 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --OeZZmYsZZ84= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

forward: Change context_reschedule_sec sec =
argument to time_t

This avoids conversions at the caller sites. Sinc= e we only
replace tv_sec if the new value is smaller the cast
to tv_s= ec_t is also safe.

Change-Id: Id9158f477404aac1d6b08b08e672980e5a58d= c35
Signed-off-by: Frank Lichtenheld <frank@...2641...>
---
= M src/openvpn/forward.c
1 file changed, 8 insertions(+), 7 deletions(-)<= br>
git pull ssh://gerrit.openvpn.net:29418/openvpn =
refs/changes/56/1356/1
diff --git a/src/openvpn/forward.c b/src/ope=
nvpn/forward.c
index cffb310..fbef539 100644
--- a/src/openvpn/forward.c
+++ b/src/openvpn/forward.c
@@ -33,6 +33,7 @@
#include "mss.h"= ;
#include "event.h"
#include &= quot;occ.h"
+#in= clude "otime.h"
#include "ping.h"

#include "ps.h"
#include "dhcp= .h"
@@ -127,7 +128,7 @@
}
<= span>
static inline void
-context_reschedule_sec(struct context *c, int sec)
+context_reschedule_sec(= struct context *c, time_t sec)
{
if (= sec < 0)
{
@@ -135,7 +136,7 @@
}
if (sec < c->c2.timeval.tv_se= c)
{
- c->c2.timeval.tv_sec =3D sec;
+ c->c2.timeval.tv_sec =3D (tv_sec_t)sec;=
c->c2.timeval.tv_usec =3D 0;
= }
}
@@ -822,11 +823,6 @@
#endif /* ENABLE_MANAGEMENT */

}

-#if defined(__GNUC__) || = defined(__clang__)
-#pr= agma GCC diagnostic push
-#endif
-
static void
check_= coarse_timers(struct context *c)
{
@@ -129= 7,6 +1293,11 @@
#endif /* if defined(ENABLE_DCO) &&= ; (defined(TARGET_LINUX) || defined(TARGET_FREEBSD)) */
}<= /span>

+#i= f defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconver= sion"
+#endif
+
/*
* Output: c->c2.buf
*/

To view, visit change 1356. To unsubscribe, or for help w= riting mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Id9158f477404aac1d6b08b08e67= 2980e5a58dc35
Gerrit-Change-Number: 1356
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --OeZZmYsZZ84=--