]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
multi-socket: do not return tuntap flags on server-side
authorGianmarco De Gregori <gianmarco@mandelbit.com>
Mon, 24 Nov 2025 17:58:27 +0000 (18:58 +0100)
committerGert Doering <gert@greenie.muc.de>
Mon, 24 Nov 2025 18:43:29 +0000 (19:43 +0100)
Tuntap flags are already handled within
multi_io_process_io() so return them by
multi_io_process_flags() would be redoundant,
since we need them only for tun_set().

While at it, removed part of the I/O process
from multi_process_io_udp() since those are
also handled within multi_io_process_io(),
removed the FILE_CLOSED and FILE_SHIFT
defines since we now handle that kind of
event in multi_io_process_io() through
the MULTI_IO_FILE_CLOSE_WRITE define.

Change-Id: I6a5110a0583b8b33496b06d9c27c1084df38e842
Signed-off-by: Gianmarco De Gregori <gianmarco@mandelbit.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1364
Message-Id: <20251124175832.21352-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34650.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/event.h
src/openvpn/forward.c
src/openvpn/mudp.c

index f6aa9c4dc8745dbb815cea7f64448674080502a2..c2c63f6972e1c92c509ccae2a3ea65180cb3920c 100644 (file)
@@ -68,8 +68,6 @@
 #define MANAGEMENT_SHIFT 6
 #define MANAGEMENT_READ  (1 << (MANAGEMENT_SHIFT + READ_SHIFT))
 #define MANAGEMENT_WRITE (1 << (MANAGEMENT_SHIFT + WRITE_SHIFT))
-#define FILE_SHIFT       8
-#define FILE_CLOSED      (1 << (FILE_SHIFT + READ_SHIFT))
 #define DCO_SHIFT        10
 #define DCO_READ         (1 << (DCO_SHIFT + READ_SHIFT))
 #define DCO_WRITE        (1 << (DCO_SHIFT + WRITE_SHIFT))
index a6d339487cb26e1a4170b0fd75be31de2e4398f3..ccb84043803977c1b53b838bb73d6a58e6d31d01 100644 (file)
@@ -2170,10 +2170,10 @@ multi_io_process_flags(struct context *c, struct event_set *es, const unsigned i
 void
 get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io, const unsigned int flags)
 {
-    unsigned int out_socket, out_tuntap;
+    unsigned int out_socket;
 
-    multi_io_process_flags(c, multi_io->es, flags, &out_socket, &out_tuntap);
-    multi_io->udp_flags = out_socket | out_tuntap;
+    multi_io_process_flags(c, multi_io->es, flags, &out_socket, NULL);
+    multi_io->udp_flags = (out_socket << SOCKET_SHIFT);
 }
 
 void
index 31134bea88e0eeda86e69b00ac9bbe35d126b813..b03e165e45e3dc3ae599e7d35a4a2e1566aabc29 100644 (file)
@@ -333,7 +333,7 @@ multi_process_outgoing_link(struct multi_context *m, const unsigned int mpp_flag
 }
 
 /*
- * Process an I/O event.
+ * Process a UDP socket event.
  */
 void
 multi_process_io_udp(struct multi_context *m, struct link_socket *sock)
@@ -343,50 +343,11 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock)
                                        ? (MPP_CONDITIONAL_PRE_SELECT | MPP_CLOSE_ON_SIGNAL)
                                        : (MPP_PRE_SELECT | MPP_CLOSE_ON_SIGNAL);
 
-#ifdef MULTI_DEBUG_EVENT_LOOP
-    char buf[16];
-    buf[0] = 0;
-    if (status & SOCKET_READ)
-    {
-        strcat(buf, "SR/");
-    }
-    else if (status & SOCKET_WRITE)
-    {
-        strcat(buf, "SW/");
-    }
-    else if (status & TUN_READ)
-    {
-        strcat(buf, "TR/");
-    }
-    else if (status & TUN_WRITE)
-    {
-        strcat(buf, "TW/");
-    }
-    else if (status & FILE_CLOSED)
-    {
-        strcat(buf, "FC/");
-    }
-    printf("IO %s\n", buf);
-#endif /* ifdef MULTI_DEBUG_EVENT_LOOP */
-
-#ifdef ENABLE_MANAGEMENT
-    if (status & (MANAGEMENT_READ | MANAGEMENT_WRITE))
-    {
-        ASSERT(management);
-        management_io(management);
-    }
-#endif
-
     /* UDP port ready to accept write */
     if (status & SOCKET_WRITE)
     {
         multi_process_outgoing_link(m, mpp_flags);
     }
-    /* TUN device ready to accept write */
-    else if (status & TUN_WRITE)
-    {
-        multi_process_outgoing_tun(m, mpp_flags);
-    }
     /* Incoming data on UDP port */
     else if (status & SOCKET_READ)
     {
@@ -396,35 +357,6 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock)
             multi_process_incoming_link(m, NULL, mpp_flags, sock);
         }
     }
-    /* Incoming data on TUN device */
-    else if (status & TUN_READ)
-    {
-        read_incoming_tun(&m->top);
-        if (!IS_SIG(&m->top))
-        {
-            multi_process_incoming_tun(m, mpp_flags);
-        }
-    }
-#ifdef ENABLE_ASYNC_PUSH
-    /* INOTIFY callback */
-    else if (status & FILE_CLOSED)
-    {
-        multi_process_file_closed(m, mpp_flags);
-    }
-#endif
-#if defined(ENABLE_DCO)
-    else if (status & DCO_READ)
-    {
-        if (!IS_SIG(&m->top))
-        {
-            bool ret = true;
-            while (ret)
-            {
-                ret = multi_process_incoming_dco(m);
-            }
-        }
-    }
-#endif
 
     m->multi_io->udp_flags = ES_ERROR;
 }