Skip to content

Commit 9d551f9

Browse files
itsGiaancron2
authored andcommitted
Fix dco_win and multisocket interaction
The recent introduction of the multisocket support did not account for some Windows-specific DCO paths. This patch restores correct behavior on Windows. Key changes: - Add WIN32 guards around DCO-specifc code. - Disable wait_signal() when running in server mode, as it conflicts with the event engine since Windows handles signals as I/Os. - Ensure correct socket handling for TCP vs UDP. Github: closes #720 Change-Id: I719b1aa2d2f4d63dc9c18d8e313fba339e3e4b0c Signed-off-by: Gianmarco De Gregori <[email protected]> Acked-by: Lev Stipakov <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg31419.html Signed-off-by: Gert Doering <[email protected]>
1 parent 3c62125 commit 9d551f9

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/openvpn/forward.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2072,7 +2072,7 @@ multi_io_process_flags(struct context *c, struct event_set *es,
20722072
/*
20732073
* Calculate the flags based on the provided 'flags' argument.
20742074
*/
2075-
if (flags & IOW_WAIT_SIGNAL)
2075+
if ((c->options.mode != MODE_SERVER) && (flags & IOW_WAIT_SIGNAL))
20762076
{
20772077
wait_signal(es, (void *)err_shift);
20782078
}

src/openvpn/mtcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ multi_tcp_process_outgoing_link(struct multi_context *m, bool defer, const unsig
181181

182182
if (mi)
183183
{
184-
if (defer || mbuf_defined(mi->tcp_link_out_deferred))
184+
if ((defer && !proto_is_dgram(mi->context.c2.link_sockets[0]->info.proto))
185+
|| mbuf_defined(mi->tcp_link_out_deferred))
185186
{
186187
/* save to queue */
187188
struct buffer *buf = &mi->context.c2.to_link;

src/openvpn/multi_io.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ multi_io_wait(struct multi_context *m)
176176
int status, i;
177177
unsigned int *persistent = &m->multi_io->tun_rwflags;
178178

179-
for (i = 0; i < m->top.c1.link_sockets_num; i++)
179+
if (!tuntap_is_dco_win(m->top.c1.tuntap))
180180
{
181-
socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_io->es,
182-
&m->top.c2.link_sockets[i]->ev_arg);
181+
for (i = 0; i < m->top.c1.link_sockets_num; i++)
182+
{
183+
socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_io->es,
184+
&m->top.c2.link_sockets[i]->ev_arg);
185+
}
183186
}
184187

185188
if (has_udp_in_local_list(&m->top.options))
@@ -202,7 +205,8 @@ multi_io_wait(struct multi_context *m)
202205
}
203206
#endif
204207
tun_set(m->top.c1.tuntap, m->multi_io->es, EVENT_READ, MULTI_IO_TUN, persistent);
205-
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
208+
#if defined(ENABLE_DCO) \
209+
&& (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32))
206210
dco_event_set(&m->top.c1.tuntap->dco, m->multi_io->es, MULTI_IO_DCO);
207211
#endif
208212

@@ -535,7 +539,8 @@ multi_io_process_io(struct multi_context *m)
535539
multi_io_action(m, mi, TA_INITIAL, false);
536540
}
537541
}
538-
#if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))
542+
#if defined(ENABLE_DCO) \
543+
&& (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32))
539544
/* incoming data on DCO? */
540545
else if (e->arg == MULTI_IO_DCO)
541546
{

0 commit comments

Comments
 (0)