]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
events: Make sure rwflags are treated as unsigned
authorFrank Lichtenheld <frank@lichtenheld.com>
Sun, 14 Sep 2025 13:51:20 +0000 (15:51 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 14 Sep 2025 17:29:00 +0000 (19:29 +0200)
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
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
URL: https://gerrit.openvpn.net/c/openvpn/+/1107
Message-Id: <20250914135128.19621-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32918.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/event.h
src/openvpn/ps.c

index 84229967c247b94f9627d31a0d7663e99cbd111c..8a89a258013ca8d7b86ff94e29a5478a775cd04b 100644 (file)
@@ -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.
  *
index e95a33bcbb0ecf907f2174d3cb408878c36f37b6..a10df2efb4f465799d84edc00ec46ef8c4ff8299 100644 (file)
@@ -70,7 +70,7 @@ struct proxy_connection
     struct proxy_connection *counterpart;
     struct buffer buf;
     bool buffer_initial;
-    int rwflags;
+    unsigned int rwflags;
     int sd;
     char *jfn;
 };
@@ -387,12 +387,12 @@ proxy_list_close(struct proxy_connection **list)
 }
 
 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 @@ proxy_connection_io_xfer(struct proxy_connection *pc, const int max_transfer)
  * 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 @@ proxy_connection_io_status(const int status, int *rwflags_pc, int *rwflags_cp)
  * 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);