Skip to contentSkip to conversation

Change in openvpn[master]: events: Make sure rwflags are treated as unsigned

Openvpn-devel In review flichtenheld (Code Review) 2 participants 8 messages Jul 24, 2025 – Sep 14, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1753360288000.I0272b709b907545de05bfded03a649b259ce5af6@...2715...

#1 lore raw

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/+/1107?usp=email

to review the following change.

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

events: Make sure rwflags are treated as unsigned

event_set_return.rwflags is already unsigned, make sure the flags are as well to avoid spurious conversion warnings.

Change-Id I0272b709b907545de05bfded03a649b259ce5af6

---
M src/openvpn/event.h

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1107/1

src/openvpn/event.h +2 -2
index 389f80d..eddff4d 100644
@@ -36,8 +36,8 @@
 #define WRITE_SHIFT     1
 
 #define EVENT_UNDEF     4
-#define EVENT_READ      (1 << READ_SHIFT)
-#define EVENT_WRITE     (1 << WRITE_SHIFT)
+#define EVENT_READ      (1u << READ_SHIFT)
+#define EVENT_WRITE     (1u << WRITE_SHIFT)
 
 /* event flags returned by io_wait.
  *

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1107?usp=email

to look at the new patch set (#4).

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

events: Make sure rwflags are treated as unsigned

event_set_return.rwflags is already unsigned, make sure the flags are as well to avoid spurious conversion warnings.

Change-Id I0272b709b907545de05bfded03a649b259ce5af6

---
M src/openvpn/event.h

1 file changed, 2 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1107/4

src/openvpn/event.h +2 -2
index 8422996..8a89a25 100644
@@ -35,8 +35,8 @@
 #define WRITE_SHIFT 1
 
 #define EVENT_UNDEF 4
-#define EVENT_READ  (1 << READ_SHIFT)
-#define EVENT_WRITE (1 << WRITE_SHIFT)
+#define EVENT_READ  (1u << READ_SHIFT)
+#define EVENT_WRITE (1u << WRITE_SHIFT)
 
 /* event flags returned by io_wait.
  *

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1107?usp=email )

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

Patch Set 9:

This change is ready for review.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 28 Aug 2025 12:50:02 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1107?usp=email )

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

Patch Set 10: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 10
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 14 Sep 2025 13:51:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#5 lore raw

PATCH v10 1/1 events: Make sure rwflags are treated as unsigned

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

event_set_return.rwflags is already unsigned, make sure the flags are as well to avoid spurious conversion warnings.

Requires to change rwflags in proxy_connection struct as well since those use the same flags.

Change-Id I0272b709b907545de05bfded03a649b259ce5af6

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1107
This mail reflects revision 10 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/event.h +2 -2
index 8422996..8a89a25 100644
@@ -35,8 +35,8 @@
 #define WRITE_SHIFT 1
 
 #define EVENT_UNDEF 4
-#define EVENT_READ  (1 << READ_SHIFT)
-#define EVENT_WRITE (1 << WRITE_SHIFT)
+#define EVENT_READ  (1u << READ_SHIFT)
+#define EVENT_WRITE (1u << WRITE_SHIFT)
 
 /* event flags returned by io_wait.
  *
src/openvpn/ps.c +8 -7
index eae03e3..b4199c3 100644
@@ -70,7 +70,7 @@
     struct proxy_connection *counterpart;
     struct buffer buf;
     bool buffer_initial;
-    int rwflags;
+    unsigned int rwflags;
     int sd;
     char *jfn;
 };
@@ -391,12 +391,12 @@
 }
 
 static inline void
-proxy_connection_io_requeue(struct proxy_connection *pc, const int rwflags_new,
+proxy_connection_io_requeue(struct proxy_connection *pc, const unsigned int rwflags_new,
                             struct event_set *es)
 {
     if (socket_defined(pc->sd) && pc->rwflags != rwflags_new)
     {
-        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", (int)pc->sd,
+        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%u", (int)pc->sd,
          * rwflags_new);*/
         event_ctl(es, pc->sd, rwflags_new, (void *)pc);
         pc->rwflags = rwflags_new;
@@ -656,7 +656,7 @@
  * Decide how the receipt of an EAGAIN status should affect our next IO queueing.
  */
 static bool
-proxy_connection_io_status(const int status, int *rwflags_pc, int *rwflags_cp)
+proxy_connection_io_status(const int status, unsigned int *rwflags_pc, unsigned int *rwflags_cp)
 {
     switch (status)
     {
@@ -687,12 +687,13 @@
  * in the proxied connection.
  */
 static int
-proxy_connection_io_dispatch(struct proxy_connection *pc, const int rwflags, struct event_set *es)
+proxy_connection_io_dispatch(struct proxy_connection *pc, const unsigned int rwflags,
+                             struct event_set *es)
 {
     const int max_transfer_per_iteration = 10000;
     struct proxy_connection *cp = pc->counterpart;
-    int rwflags_pc = pc->rwflags;
-    int rwflags_cp = cp->rwflags;
+    unsigned int rwflags_pc = pc->rwflags;
+    unsigned int rwflags_cp = cp->rwflags;
 
     ASSERT(pc->defined && cp->defined && cp->counterpart == pc);
 
#6 lore raw

[Openvpn-devel] [PATCH applied] Re: events: Make sure rwflags are treated as unsigned

Straightforward enough... and still passes all t_client tests related to proxy connections. Good enough :-)

Your patch has been applied to the master branch.

commit e15bb6338308caa6d6123b411db4054d76e58c32

Author: Frank Lichtenheld
Date:   Sun Sep 14 15:51:20 2025 +0200
     events: Make sure rwflags are treated as unsigned

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     URL: https://gerrit.openvpn.net/c/openvpn/+/1107
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg32918.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#7 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#11) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1107?usp=email )

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

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

events: Make sure rwflags are treated as unsigned

event_set_return.rwflags is already unsigned, make sure the flags are as well to avoid spurious conversion warnings.

Requires to change rwflags in proxy_connection struct as well since those use the same flags.

Change-Id I0272b709b907545de05bfded03a649b259ce5af6

URL: https://gerrit.openvpn.net/c/openvpn/+/1107
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32918.html

---
M src/openvpn/event.h
M src/openvpn/ps.c

2 files changed, 10 insertions(+), 9 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/07/1107/11

src/openvpn/event.h +2 -2
index 8422996..8a89a25 100644
@@ -35,8 +35,8 @@
 #define WRITE_SHIFT 1
 
 #define EVENT_UNDEF 4
-#define EVENT_READ  (1 << READ_SHIFT)
-#define EVENT_WRITE (1 << WRITE_SHIFT)
+#define EVENT_READ  (1u << READ_SHIFT)
+#define EVENT_WRITE (1u << WRITE_SHIFT)
 
 /* event flags returned by io_wait.
  *
src/openvpn/ps.c +8 -7
index e95a33b..a10df2e 100644
@@ -70,7 +70,7 @@
     struct proxy_connection *counterpart;
     struct buffer buf;
     bool buffer_initial;
-    int rwflags;
+    unsigned int rwflags;
     int sd;
     char *jfn;
 };
@@ -387,12 +387,12 @@
 }
 
 static inline void
-proxy_connection_io_requeue(struct proxy_connection *pc, const int rwflags_new,
+proxy_connection_io_requeue(struct proxy_connection *pc, const unsigned int rwflags_new,
                             struct event_set *es)
 {
     if (socket_defined(pc->sd) && pc->rwflags != rwflags_new)
     {
-        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", (int)pc->sd,
+        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%u", (int)pc->sd,
          * rwflags_new);*/
         event_ctl(es, pc->sd, rwflags_new, (void *)pc);
         pc->rwflags = rwflags_new;
@@ -652,7 +652,7 @@
  * Decide how the receipt of an EAGAIN status should affect our next IO queueing.
  */
 static bool
-proxy_connection_io_status(const int status, int *rwflags_pc, int *rwflags_cp)
+proxy_connection_io_status(const int status, unsigned int *rwflags_pc, unsigned int *rwflags_cp)
 {
     switch (status)
     {
@@ -683,12 +683,13 @@
  * in the proxied connection.
  */
 static int
-proxy_connection_io_dispatch(struct proxy_connection *pc, const int rwflags, struct event_set *es)
+proxy_connection_io_dispatch(struct proxy_connection *pc, const unsigned int rwflags,
+                             struct event_set *es)
 {
     const int max_transfer_per_iteration = 10000;
     struct proxy_connection *cp = pc->counterpart;
-    int rwflags_pc = pc->rwflags;
-    int rwflags_cp = cp->rwflags;
+    unsigned int rwflags_pc = pc->rwflags;
+    unsigned int rwflags_cp = cp->rwflags;
 
     ASSERT(pc->defined && cp->defined && cp->counterpart == pc);
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 11
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#8 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1107?usp=email )

Change subject: events: Make sure rwflags are treated as unsigned
......................................................................

events: Make sure rwflags are treated as unsigned

event_set_return.rwflags is already unsigned, make sure the flags are as well to avoid spurious conversion warnings.

Requires to change rwflags in proxy_connection struct as well since those use the same flags.

Change-Id I0272b709b907545de05bfded03a649b259ce5af6

URL: https://gerrit.openvpn.net/c/openvpn/+/1107
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32918.html

---
M src/openvpn/event.h
M src/openvpn/ps.c

2 files changed, 10 insertions(+), 9 deletions(-)
src/openvpn/event.h +2 -2
index 8422996..8a89a25 100644
@@ -35,8 +35,8 @@
 #define WRITE_SHIFT 1
 
 #define EVENT_UNDEF 4
-#define EVENT_READ  (1 << READ_SHIFT)
-#define EVENT_WRITE (1 << WRITE_SHIFT)
+#define EVENT_READ  (1u << READ_SHIFT)
+#define EVENT_WRITE (1u << WRITE_SHIFT)
 
 /* event flags returned by io_wait.
  *
src/openvpn/ps.c +8 -7
index e95a33b..a10df2e 100644
@@ -70,7 +70,7 @@
     struct proxy_connection *counterpart;
     struct buffer buf;
     bool buffer_initial;
-    int rwflags;
+    unsigned int rwflags;
     int sd;
     char *jfn;
 };
@@ -387,12 +387,12 @@
 }
 
 static inline void
-proxy_connection_io_requeue(struct proxy_connection *pc, const int rwflags_new,
+proxy_connection_io_requeue(struct proxy_connection *pc, const unsigned int rwflags_new,
                             struct event_set *es)
 {
     if (socket_defined(pc->sd) && pc->rwflags != rwflags_new)
     {
-        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%d", (int)pc->sd,
+        /*dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: requeue[%d] rwflags=%u", (int)pc->sd,
          * rwflags_new);*/
         event_ctl(es, pc->sd, rwflags_new, (void *)pc);
         pc->rwflags = rwflags_new;
@@ -652,7 +652,7 @@
  * Decide how the receipt of an EAGAIN status should affect our next IO queueing.
  */
 static bool
-proxy_connection_io_status(const int status, int *rwflags_pc, int *rwflags_cp)
+proxy_connection_io_status(const int status, unsigned int *rwflags_pc, unsigned int *rwflags_cp)
 {
     switch (status)
     {
@@ -683,12 +683,13 @@
  * in the proxied connection.
  */
 static int
-proxy_connection_io_dispatch(struct proxy_connection *pc, const int rwflags, struct event_set *es)
+proxy_connection_io_dispatch(struct proxy_connection *pc, const unsigned int rwflags,
+                             struct event_set *es)
 {
     const int max_transfer_per_iteration = 10000;
     struct proxy_connection *cp = pc->counterpart;
-    int rwflags_pc = pc->rwflags;
-    int rwflags_cp = cp->rwflags;
+    unsigned int rwflags_pc = pc->rwflags;
+    unsigned int rwflags_cp = cp->rwflags;
 
     ASSERT(pc->defined && cp->defined && cp->counterpart == pc);
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1107?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: I0272b709b907545de05bfded03a649b259ce5af6
Gerrit-Change-Number: 1107
Gerrit-PatchSet: 11
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged