From: "its_Giaan (Code Review)" Date: Tue, 9 Dec 2025 11:23:33 +0000 References: Reply-To: gianmarco@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <869810c3eceb8a94aaaa38a299a9151b561c7ee8-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="6/QIGbXZ7BM="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: Deprecate --fast-io option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --6/QIGbXZ7BM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=3Demail to review the following change. Change subject: Deprecate --fast-io option ...................................................................... Deprecate --fast-io option Recent changes to the event loop revealed that the --fast-io option is now partially broken and may cause "unroutable control packet" issues. As agreed during the last hackathon, this patch turns --fast-io into a no-op and emits a warning when it is used. Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c Signed-off-by: Gianmarco De Gregori --- M doc/man-sections/generic-options.rst M src/openvpn/forward.c M src/openvpn/forward.h M src/openvpn/init.c M src/openvpn/mudp.c M src/openvpn/openvpn.h M src/openvpn/options.c M src/openvpn/options.h 8 files changed, 11 insertions(+), 109 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/25/1425/1 diff --git a/doc/man-sections/generic-options.rst b/doc/man-sections/generi= c-options.rst index 882cf28..e698d9f 100644 --- a/doc/man-sections/generic-options.rst +++ b/doc/man-sections/generic-options.rst @@ -212,7 +212,7 @@ are supported by OpenSSL. --fast-io - Optimize TUN/TAP/UDP I/O writes by avoiding a call to + **DEPRECATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to poll/epoll/select prior to the write operation. The purpose of such a call would normally be to block until the device or socket is ready to accept the write. Such blocking is unnecessary on some platforms which diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 6f1bc0c..eb77a1d 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -2154,13 +2154,12 @@ } /* - * Wait for I/O events. Used for both TCP & UDP sockets - * in point-to-point mode and for UDP sockets in + * Wait for I/O events. Used for UDP sockets in * point-to-multipoint mode. */ void -get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io, cons= t unsigned int flags) +get_io_flags_udp(struct context *c, struct multi_io *multi_io, const unsig= ned int flags) { unsigned int out_socket; @@ -2168,33 +2167,12 @@ multi_io->udp_flags =3D (out_socket << SOCKET_SHIFT); } +/* + * This is the core I/O wait function, used for all I/O waits except + * for the top-level server sockets. + */ void -get_io_flags_udp(struct context *c, struct multi_io *multi_io, const unsig= ned int flags) -{ - multi_io->udp_flags =3D ES_ERROR; - if (c->c2.fast_io && (flags & (IOW_TO_TUN | IOW_TO_LINK | IOW_MBUF))) - { - /* fast path -- only for TUN/TAP/UDP writes */ - unsigned int ret =3D 0; - if (flags & IOW_TO_TUN) - { - ret |=3D TUN_WRITE; - } - if (flags & (IOW_TO_LINK | IOW_MBUF)) - { - ret |=3D SOCKET_WRITE; - } - multi_io->udp_flags =3D ret; - } - else - { - /* slow path - delegate to io_wait_dowork_udp to calculate flags */ - get_io_flags_dowork_udp(c, multi_io, flags); - } -} - -void -io_wait_dowork(struct context *c, const unsigned int flags) +io_wait(struct context *c, const unsigned int flags) { unsigned int out_socket; unsigned int out_tuntap; diff --git a/src/openvpn/forward.h b/src/openvpn/forward.h index 06808b9..7f6f666 100644 --- a/src/openvpn/forward.h +++ b/src/openvpn/forward.h @@ -68,12 +68,9 @@ extern counter_type link_write_bytes_global; -void get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io, - const unsigned int flags); - void get_io_flags_udp(struct context *c, struct multi_io *multi_io, const = unsigned int flags); -void io_wait_dowork(struct context *c, const unsigned int flags); +void io_wait(struct context *c, const unsigned int flags); void pre_select(struct context *c); @@ -382,34 +379,6 @@ return flags; } -/* - * This is the core I/O wait function, used for all I/O waits except - * for the top-level server sockets. - */ -static inline void -io_wait(struct context *c, const unsigned int flags) -{ - if (proto_is_dgram(c->c2.link_sockets[0]->info.proto) && c->c2.fast_io - && (flags & (IOW_TO_TUN | IOW_TO_LINK | IOW_MBUF))) - { - /* fast path -- only for TUN/TAP/UDP writes */ - unsigned int ret =3D 0; - if (flags & IOW_TO_TUN) - { - ret |=3D TUN_WRITE; - } - if (flags & (IOW_TO_LINK | IOW_MBUF)) - { - ret |=3D SOCKET_WRITE; - } - c->c2.event_set_status =3D ret; - } - else - { - /* slow path */ - io_wait_dowork(c, flags); - } -} static inline bool connection_established(struct context *c) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index fc079e1..cd01520 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -4139,34 +4139,6 @@ } } -/* - * Fast I/O setup. Fast I/O is an optimization which only works - * if all of the following are true: - * - * (1) The platform is not Windows - * (2) --proto udp is enabled - * (3) --shaper is disabled - */ -static void -do_setup_fast_io(struct context *c) -{ - if (c->options.fast_io) - { -#ifdef _WIN32 - msg(M_INFO, "NOTE: --fast-io is disabled since we are running on W= indows"); -#else - if (c->options.shaper) - { - msg(M_INFO, "NOTE: --fast-io is disabled since we are using --= shaper"); - } - else - { - c->c2.fast_io =3D true; - } -#endif - } -} - static void do_signal_on_tls_errors(struct context *c) { @@ -4513,12 +4485,6 @@ } #endif - /* should we enable fast I/O? */ - if (c->mode =3D=3D CM_P2P || c->mode =3D=3D CM_TOP) - { - do_setup_fast_io(c); - } - /* should we throw a signal on TLS errors? */ do_signal_on_tls_errors(c); diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index b03e165..bf115e6 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -339,9 +339,7 @@ multi_process_io_udp(struct multi_context *m, struct link_socket *sock) { const unsigned int status =3D m->multi_io->udp_flags; - const unsigned int mpp_flags =3D m->top.c2.fast_io - ? (MPP_CONDITIONAL_PRE_SELECT | MPP= _CLOSE_ON_SIGNAL) - : (MPP_PRE_SELECT | MPP_CLOSE_ON_SI= GNAL); + const unsigned int mpp_flags =3D (MPP_PRE_SELECT | MPP_CLOSE_ON_SIGNAL= ); /* UDP port ready to accept write */ if (status & SOCKET_WRITE) diff --git a/src/openvpn/openvpn.h b/src/openvpn/openvpn.h index a198fcf..3e1ae78 100644 --- a/src/openvpn/openvpn.h +++ b/src/openvpn/openvpn.h @@ -420,9 +420,6 @@ struct env_set *es; bool es_owned; - /* don't wait for TUN/TAP/UDP to be ready to accept write */ - bool fast_io; - /* --ifconfig endpoints to be pushed to client */ bool push_request_received; bool push_ifconfig_defined; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index a3fc19d..41b45cf 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -285,7 +285,6 @@ #if ENABLE_IP_PKTINFO "--multihome : Configure a multi-homed UDP server.\n" #endif - "--fast-io : Optimize TUN/TAP/UDP writes.\n" "--remap-usr1 s : On SIGUSR1 signals, remap signal (s=3D'SIGHUP' or '= SIGTERM').\n" "--persist-tun : Keep tun/tap device open across SIGUSR1 or --ping-r= estart.\n" "--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping= -restart.\n" @@ -1795,8 +1794,6 @@ #endif SHOW_INT(sockflags); - SHOW_BOOL(fast_io); - SHOW_INT(comp.alg); SHOW_INT(comp.flags); @@ -6600,7 +6597,7 @@ else if (streq(p[0], "fast-io") && !p[1]) { VERIFY_PERMISSION(OPT_P_GENERAL); - options->fast_io =3D true; + msg(M_WARN, "DEPRECATED: --fast-io option ignored. "); } else if (streq(p[0], "inactive") && p[1] && !p[3]) { diff --git a/src/openvpn/options.h b/src/openvpn/options.h index 42db9ca..41212fb 100644 --- a/src/openvpn/options.h +++ b/src/openvpn/options.h @@ -406,9 +406,6 @@ int status_file_version; int status_file_update_freq; - /* optimize TUN/TAP/UDP writes */ - bool fast_io; - struct compress_options comp; /* buffer sizes */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1425?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc1c30c83fae14c Gerrit-Change-Number: 1425 Gerrit-PatchSet: 1 Gerrit-Owner: its_Giaan Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --6/QIGbXZ7BM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

its_Giaan would like plaisthos to review this change.

V= iew Change

Deprecate --fast-io option

Recent ch= anges to the event loop revealed that
the --fast-io option is now partia= lly broken and
may cause "unroutable control packet" issues.
As agreed during the last hackathon, this patch
turns --fast-io in= to a no-op and emits a warning
when it is used.

Change-Id: I2c0a0= b55ad56e704d4bd19f1fbc1c30c83fae14c
Signed-off-by: Gianmarco De Gregori = <gianmarco@...2726...>
---
M doc/man-sections/generic-options.r= st
M src/openvpn/forward.c
M src/openvpn/forward.h
M src/openvpn/i= nit.c
M src/openvpn/mudp.c
M src/openvpn/openvpn.h
M src/openvpn/o= ptions.c
M src/openvpn/options.h
8 files changed, 11 insertions(+), 1= 09 deletions(-)

git pull ssh://gerrit.openvpn.ne=
t:29418/openvpn refs/changes/25/1425/1
diff --git a/doc/man-section=
s/generic-options.rst b/doc/man-sections/generic-options.rst
index 882cf28..e698d9f 100644
--- a/doc/man-sections/gene= ric-options.rst
+++ b/doc/man-sections/generic-options.rst<= /span>
@@ -212,7 +212,7 @@
are supported by Ope= nSSL.

--fast-io
- Optimize TUN/TAP/UDP I/O writes by avoiding = a call to
+ **DEPREC= ATED** Optimize TUN/TAP/UDP I/O writes by avoiding a call to
poll/epoll/select prior to the write operation. The purpose of such a<= /span>
call would normally be to block until the device or sock= et is ready to
accept the write. Such blocking is unnece= ssary on some platforms which
diff --git a/src/openvpn/forw= ard.c b/src/openvpn/forward.c
index 6f1bc0c..eb77a1d 100644=
--- a/src/openvpn/forward.c
+++ b/src/open= vpn/forward.c
@@ -2154,13 +2154,12 @@
}

/*
- * Wait for I/O events. Used for both TCP & UDP sockets<= /span>
- * in point-to-point m= ode and for UDP sockets in
+ * Wait for I/O events. Used for UDP sockets in
*= point-to-multipoint mode.
*/
void
-get_io_fl= ags_dowork_udp(struct context *c, struct multi_io *multi_io, const unsigned= int flags)
+get_io_f= lags_udp(struct context *c, struct multi_io *multi_io, const unsigned int f= lags)
{
unsigned int out_socket;


@@ -2168,33 +2167,12 @@
= multi_io->udp_flags =3D (out_socket << SOCKET_SHIFT);
}


+/*
+ * This is t= he core I/O wait function, used for all I/O waits except
+ * for the top-level server sockets.
+ */
= void
-get_io_flags_udp(= struct context *c, struct multi_io *multi_io, const unsigned int flags)
-{
- multi_io->udp_flags =3D ES_ERROR;
- if (c->c2.fast_io= && (flags & (IOW_TO_TUN | IOW_TO_LINK | IOW_MBUF)))
= - {
- /* fast path -- only for TUN/TAP/UDP wri= tes */
- unsigne= d int ret =3D 0;
- = if (flags & IOW_TO_TUN)
- {
- = ret |=3D TUN_WRITE;
- }
- = if (flags & (IOW_TO_LINK | IOW_MBUF))
- {
- ret |=3D SOCKET_WRITE;
- }
- multi_io->udp_flags =3D ret;
- }
- else
- /* sl= ow path - delegate to io_wait_dowork_udp to calculate flags */
- get_io_flags_dowork_udp(c,= multi_io, flags);

- = }
-}
-
-void
-io= _wait_dowork(struct context *c, const unsigned int flags)
+io_wait(struct context *c, const unsi= gned int flags)
{
unsigned int out_so= cket;
unsigned int out_tuntap;
diff --= git a/src/openvpn/forward.h b/src/openvpn/forward.h
index 0= 6808b9..7f6f666 100644
--- a/src/openvpn/forward.h+++ b/src/openvpn/forward.h
@@ -68,12 +68,9 @@


extern counter_type link_write_bytes_global;=

-voi= d get_io_flags_dowork_udp(struct context *c, struct multi_io *multi_io,
- = const unsigned int flags);
-
void get_io_flags_udp(struct context *c, struct = multi_io *multi_io, const unsigned int flags);

= -void io_wait_dowork(struct conte= xt *c, const unsigned int flags);
+void io_wait(struct context *c, const unsigned int flags);

void pre_select(struct context *c);=

@@ -382,34 +379,6 @@
retur= n flags;
}

-/*
- * This is the core I/O wait function, used for all I/O waits except
- * for the top-level se= rver sockets.
- */
-static inline void<= br>-io_wait(struct context *c, co= nst unsigned int flags)
-{
- if (proto_is_d= gram(c->c2.link_sockets[0]->info.proto) && c->c2.fast_io
- && (fla= gs & (IOW_TO_TUN | IOW_TO_LINK | IOW_MBUF)))
- {
- /* fast path -- only for TUN/TAP/UDP writes */- unsigned int ret =3D 0;=
- if (flags &am= p; IOW_TO_TUN)
- = {
- ret |= =3D TUN_WRITE;
- = }
- if (flags &= amp; (IOW_TO_LINK | IOW_MBUF))
- {
- = ret |=3D SOCKET_WRITE;
- }
- = c->c2.event_set_status =3D ret;
- }
- {
- /* slow path */
- io_wait_dowork(c= , flags);
- }=
-}
static inline bool
connection_established(struct = context *c)
diff --git a/src/openvpn/init.c b/src/openvpn/i= nit.c
index fc079e1..cd01520 100644
--- a/s= rc/openvpn/init.c
+++ b/src/openvpn/init.c
= @@ -4139,34 +4139,6 @@
}
}
=
-/*
<= span style=3D"color: hsl(0, 100%, 40%);">- * Fast I/O setup. Fast I/O is a= n optimization which only works

- * if all of the following are true:
- *
- * (1) The platform is not Windows
- * (2) --proto udp is enabled
- * (3) --shaper is disabled
- */
-static void
-do_setup_fast_io(struct context *c)
-{
- = if (c->options.fast_io)
- {
-#ifdef _= WIN32
- msg(M_IN= FO, "NOTE: --fast-io is disabled since we are running on Windows"= );
-#else
- if (c->options.shaper)
- {
- msg(M_INFO, "NOTE:= --fast-io is disabled since we are using --shaper");

- }
- else
- {
- c->c2.fast_io =3D true;
- }
-#endif
- }<= /span>
-}
-
static void
do_signal_on_tls_errors(struct context *c)

{@@ -4513,12 +4485,6 @@
}
#end= if

- = /* should we enable fast I/O? */
- if (c->mode =3D=3D CM_P2P || c->mode =3D=3D CM_TOP)=
- {
- do_setup_fast_io(c);
- }
-
/* should we throw a sig= nal on TLS errors? */
do_signal_on_tls_errors(c);

diff --git a/src/openvpn/mudp.c b/src/openvpn= /mudp.c
index b03e165..bf115e6 100644
--- a= /src/openvpn/mudp.c
+++ b/src/openvpn/mudp.c
@@ -339,9 +339,7 @@

multi_process_io_udp(struct multi_co= ntext *m, struct link_socket *sock)
{
= const unsigned int status =3D m->multi_io->udp_flags;
- const unsigned int mpp_flags =3D= m->top.c2.fast_io

-= ? (MPP_CONDITIONAL_PRE_SELECT | MPP_= CLOSE_ON_SIGNAL)
- = : (MPP_PRE_SELECT | MPP_CLOSE_ON_SIGNAL);=
+ const unsigned = int mpp_flags =3D (MPP_PRE_SELECT | MPP_CLOSE_ON_SIGNAL);
=
/* UDP port ready to accept write */
= if (status & SOCKET_WRITE)
diff --git a/src/openvp= n/openvpn.h b/src/openvpn/openvpn.h
index a198fcf..3e1ae78 = 100644
--- a/src/openvpn/openvpn.h
+++ b/sr= c/openvpn/openvpn.h
@@ -420,9 +420,6 @@
= struct env_set *es;
bool es_owned;
=
- /* don't wait= for TUN/TAP/UDP to be ready to accept write */
- bool fast_io;
-
/* --ifconfig endpoints to be p= ushed to client */
bool push_request_received;<= br> bool push_ifconfig_defined;
diff --git a/src/= openvpn/options.c b/src/openvpn/options.c
index a3fc19d..41= b45cf 100644
--- a/src/openvpn/options.c
++= + b/src/openvpn/options.c
@@ -285,7 +285,6 @@
#if ENABLE_IP_PKTINFO

"--multihome : Conf= igure a multi-homed UDP server.\n"
#endif
<= span style=3D"color: hsl(0, 100%, 40%);">- "--fast-io : Optim= ize TUN/TAP/UDP writes.\n"

"--remap-usr1 s = : On SIGUSR1 signals, remap signal (s=3D'SIGHUP' or 'SIGTERM= 9;).\n"
"--persist-tun : Keep tun/tap devi= ce open across SIGUSR1 or --ping-restart.\n"
&quo= t;--persist-remote-ip : Keep remote IP address across SIGUSR1 or --ping-res= tart.\n"
@@ -1795,8 +1794,6 @@
#endif=
SHOW_INT(sockflags);

- SHOW_BOOL(fast_io);

-
SHOW_INT(com= p.alg);
SHOW_INT(comp.flags);
=
@@ -6600,7 +6597,7 @@
else if (streq(p[0], &= quot;fast-io") && !p[1])
{
VERIFY_PERMISSION(OPT_P_GENERAL);
- options->fast_io =3D true;
+ msg(M_WARN, "DEPRECAT= ED: --fast-io option ignored. ");
}
else if (streq(p[0], "inactive") && p[1] &&am= p; !p[3])
{
diff --git a/src/openvpn/o= ptions.h b/src/openvpn/options.h
index 42db9ca..41212fb 100= 644
--- a/src/openvpn/options.h
+++ b/src/o= penvpn/options.h
@@ -406,9 +406,6 @@
i= nt status_file_version;
int status_file_update_freq;

- /= * optimize TUN/TAP/UDP writes */
- bool fast_io;
-
struct compress_options comp;
=
/* buffer sizes */

=

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2c0a0b55ad56e704d4bd19f1fbc= 1c30c83fae14c
Gerrit-Change-Number: 1425
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <gianmarco@...2786...= ..>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --6/QIGbXZ7BM=--