Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2045?usp=email )

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]>
Acked-by: Razvan Cojocaru <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2045
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg40223.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/multi_io.c
1 file changed, 7 insertions(+), 17 deletions(-)




diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c
index 56216d4..fb4810b 100644
--- a/src/openvpn/multi_io.c
+++ b/src/openvpn/multi_io.c
@@ -168,27 +168,17 @@
     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 (int 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/+/2045?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f49f40e49af8503f5c08c5575ffc9a8b4c9aa20
Gerrit-Change-Number: 2045
Gerrit-PatchSet: 2
Gerrit-Owner: Gianmarco De Gregori <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Răzvan Cojocaru <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to