From: "cron2 (Code Review)" Date: Mon, 14 Apr 2025 18:05:27 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., gianmarco@...2726..., openvpn-devel@lists.sourceforge.net, frank@...2641..., lstipakov@...277... Message-ID: <5a1600084b608d47667b2084fed6dc9c75e646b0-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="u4vxPTCv+/w="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Fix dco_win and multisocket interaction List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: its_Giaan Cc: stipa , flichtenheld , plaisthos , openvpn-devel --u4vxPTCv+/w= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/93= 5?usp=3Demail ) Change subject: Fix dco_win and multisocket interaction ...................................................................... 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 openvpn/OpenVPN#720 Change-Id: I719b1aa2d2f4d63dc9c18d8e313fba339e3e4b0c Signed-off-by: Gianmarco De Gregori Acked-by: Lev Stipakov Message-Id: <20250410215037.11878-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg31= 419.html Signed-off-by: Gert Doering --- M src/openvpn/forward.c M src/openvpn/mtcp.c M src/openvpn/multi_io.c 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index af1d008..0b8b262 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2072,7 +2072,7 @@ /* * Calculate the flags based on the provided 'flags' argument. */ - if (flags & IOW_WAIT_SIGNAL) + if ((c->options.mode !=3D MODE_SERVER) && (flags & IOW_WAIT_SIGNAL)) { wait_signal(es, (void *)err_shift); } diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 1d62ea6..86c5160 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -181,7 +181,8 @@ if (mi) { - if (defer || mbuf_defined(mi->tcp_link_out_deferred)) + if ((defer && !proto_is_dgram(mi->context.c2.link_sockets[0]->info= .proto)) + || mbuf_defined(mi->tcp_link_out_deferred)) { /* save to queue */ struct buffer *buf =3D &mi->context.c2.to_link; diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c index f1751ff..f4ca4df 100644 --- a/src/openvpn/multi_io.c +++ b/src/openvpn/multi_io.c @@ -176,10 +176,13 @@ int status, i; unsigned int *persistent =3D &m->multi_io->tun_rwflags; - for (i =3D 0; i < m->top.c1.link_sockets_num; i++) + if (!tuntap_is_dco_win(m->top.c1.tuntap)) { - socket_set_listen_persistent(m->top.c2.link_sockets[i], m->multi_i= o->es, - &m->top.c2.link_sockets[i]->ev_arg); + for (i =3D 0; i < m->top.c1.link_sockets_num; i++) + { + socket_set_listen_persistent(m->top.c2.link_sockets[i], m->mul= ti_io->es, + &m->top.c2.link_sockets[i]->ev_ar= g); + } } if (has_udp_in_local_list(&m->top.options)) @@ -202,7 +205,8 @@ } #endif tun_set(m->top.c1.tuntap, m->multi_io->es, EVENT_READ, MULTI_IO_TUN, p= ersistent); -#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD) +#if defined(ENABLE_DCO) \ + && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TARGET= _WIN32)) dco_event_set(&m->top.c1.tuntap->dco, m->multi_io->es, MULTI_IO_DCO); #endif @@ -535,7 +539,8 @@ multi_io_action(m, mi, TA_INITIAL, false); } } -#if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBS= D)) +#if defined(ENABLE_DCO) \ + && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || define= d(TARGET_WIN32)) /* incoming data on DCO? */ else if (e->arg =3D=3D MULTI_IO_DCO) { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/935?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I719b1aa2d2f4d63dc9c18d8e313fba339e3e4b0c Gerrit-Change-Number: 935 Gerrit-PatchSet: 5 Gerrit-Owner: its_Giaan Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel Gerrit-MessageType: merged --u4vxPTCv+/w= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

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 openvpn/OpenVPN#720

Change-Id: I719b1aa2d2f4d63dc9c18= d8e313fba339e3e4b0c
Signed-off-by: Gianmarco De Gregori <gianmarco@...1186...= .2726...>
Acked-by: Lev Stipakov <lstipakov@...277...>
Messa= ge-Id: <20250410215037.11878-1-gert@...1296...>
URL: https://www.m= ail-archive.com/openvpn-devel@lists.sourceforge.net/msg31419.html
Signed= -off-by: Gert Doering <gert@...1296...>
---
M src/openvpn/forwa= rd.c
M src/openvpn/mtcp.c
M src/openvpn/multi_io.c
3 files changed= , 13 insertions(+), 7 deletions(-)

diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c
index af1d008..0b8b262 100644
--- a/src/openvpn/forward.= c
+++ b/src/openvpn/forward.c
@@ -2072,7 +2= 072,7 @@
/*
* Calculate the flag= s based on the provided 'flags' argument.
*/<= /span>
- if (flags & IO= W_WAIT_SIGNAL)
+ i= f ((c->options.mode !=3D MODE_SERVER) && (flags & IOW_WAIT_S= IGNAL))
{
wait_signal(es, (vo= id *)err_shift);
}
diff --git a/src/op= envpn/mtcp.c b/src/openvpn/mtcp.c
index 1d62ea6..86c5160 10= 0644
--- a/src/openvpn/mtcp.c
+++ b/src/ope= nvpn/mtcp.c
@@ -181,7 +181,8 @@
if (mi)
{
- if (defer || mbuf_defined(mi->tcp_link_out_= deferred))
+ i= f ((defer && !proto_is_dgram(mi->context.c2.link_sockets[0]->= info.proto))
+ = || mbuf_defined(mi->tcp_link_out_deferred))
= {
/* save to queue */
= struct buffer *buf =3D &mi->context.c2.to_link;
diff --git a/src/openvpn/multi_io.c b/src/openvpn/multi_io.c

<= span>index f1751ff..f4ca4df 100644
--- a/src/openvpn/multi_= io.c
+++ b/src/openvpn/multi_io.c
@@ -176,1= 0 +176,13 @@
int status, i;
unsig= ned int *persistent =3D &m->multi_io->tun_rwflags;

- for (i =3D 0; = i < m->top.c1.link_sockets_num; i++)
+ if (!tuntap_is_dco_win(m->top.c1.tuntap))

{
- = socket_set_listen_persistent(m->top.c2.link_sockets[i], m->mult= i_io->es,
- = &m->top.c2.link_sockets[i]->ev_arg);<= /span>
+ for (i =3D 0= ; i < m->top.c1.link_sockets_num; i++)
+ {
+ socket_set_listen_persistent(m->top.c2.link_s= ockets[i], m->multi_io->es,
+ &m->top.c2.li= nk_sockets[i]->ev_arg);
+ }
}

= if (has_udp_in_local_list(&m->top.options))
@@ -= 202,7 +205,8 @@
}
#endif
tun_set(m->top.c1.tuntap, m->multi_io->es, EVENT_READ, MU= LTI_IO_TUN, persistent);

+#if defined(ENABLE_DCO) \
+ && (defined(TARGET_LI= NUX) || defined(TARGET_FREEBSD) || defined(TARGET_WIN32))
= dco_event_set(&m->top.c1.tuntap->dco, m->multi_io->es, = MULTI_IO_DCO);
#endif

@@= -535,7 +539,8 @@
multi_io_action(m, m= i, TA_INITIAL, false);
}
= }
-#if defi= ned(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD= ))
+#if defined(ENABL= E_DCO) \
+ = && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD) || defined(TA= RGET_WIN32))
/* incoming data on DCO? */
else if (e->arg =3D=3D MULTI_IO_DCO)
<= span> {


To view, visit change 935. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I719b1aa2d2f4d63dc9c18d8e313= fba339e3e4b0c
Gerrit-Change-Number: 935
Gerrit-PatchSet: 5
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-MessageType: merged
--u4vxPTCv+/w=--