Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2056?usp=email

to review the following change.


Change subject: multi_io: walk the link sockets once in multi_io_wait()
......................................................................

multi_io: walk the link sockets once in multi_io_wait()

multi_io_wait() went over the link sockets twice: first to register
every socket as a listening socket, then, if a UDP socket is configured,
again to arm the UDP ones. The UDP sockets were thus registered twice,
and on Windows the first pass created an FD_ACCEPT event for them.

Walk the sockets once, arming the UDP sockets and registering only the
TCP ones as listening sockets. Drop the mode check as well, since
multi_io_wait() only runs in server mode.

Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Signed-off-by: Gianmarco De Gregori <[email protected]>
---
M src/openvpn/multi_io.c
1 file changed, 8 insertions(+), 18 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/56/2056/1

diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c
index 8fe4487..622a2c5 100644
--- a/src/openvpn/multi_io.c
+++ b/src/openvpn/multi_io.c
@@ -195,30 +195,20 @@
 int
 multi_io_wait(struct multi_context *m)
 {
-    int status, i;
+    int status;
     unsigned int *persistent = &m->multi_io->tun_rwflags;

-    if (!tuntap_is_dco_win(m->top.c1.tuntap))
+    for (int i = 0; i < m->top.c1.link_sockets_num; i++)
     {
-        for (i = 0; i < m->top.c1.link_sockets_num; i++)
+        struct link_socket *sock = m->top.c2.link_sockets[i];
+
+        if (proto_is_dgram(sock->info.proto))
         {
-            socket_set_listen_persistent(m->top.c2.link_sockets[i], 
m->multi_io->es,
-                                         &m->top.c2.link_sockets[i]->ev_arg);
+            multi_io_process_flags(&m->top, m->multi_io->es, sock, 
p2mp_iow_flags(m, sock));
         }
-    }
-
-    if (has_udp_in_local_list(&m->top.options))
-    {
-        for (int i = 0; i < m->top.c1.link_sockets_num; i++)
+        else if (!tuntap_is_dco_win(m->top.c1.tuntap))
         {
-            struct link_socket *sock = m->top.c2.link_sockets[i];
-
-            if ((m->top.options.mode == MODE_SERVER) && 
proto_is_dgram(sock->info.proto))
-            {
-                unsigned int flags = p2mp_iow_flags(m, sock);
-
-                multi_io_process_flags(&m->top, m->multi_io->es, sock, flags);
-            }
+            socket_set_listen_persistent(sock, m->multi_io->es, &sock->ev_arg);
         }
     }


--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2056?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.7
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2056
Gerrit-PatchSet: 1
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to