From: "cron2 (Code Review)" Date: Thu, 29 Jan 2026 17:40:06 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="So26Pr4+x08="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[release/2.6]: tunnel_server_*(): close correct inotify fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: plaisthos , openvpn-devel --So26Pr4+x08= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 99?usp=3Demail ) Change subject: tunnel_server_*(): close correct inotify fd ...................................................................... tunnel_server_*(): close correct inotify fd On a full SIGUSR1 restart of a p2mp server compiled with --enable-async-push, tunnel_server_{udp,tcp}() will try to close and reopen the "inotify" control file descriptor. For whatever reason, the original code referenced the wrong context, always closing fd 0. As a consequence of this, on the second SIGUSR1 restart, the server will close() the first active socket file descriptor, and if there are active DCO clients, the resulting event confusion will lead to an ASSERT(!mi->halt). Fix by closing the correct FD. Add logging. This is a backport of commit 5521872f80313060 to the "old p2mp code" with a separate mudp.c and mtcp.c for UDP and TCP servers, respectively. Github: fixes OpenVPN/openvpn#966 Change-Id: Idcb1421b9f7fcbee9620fd1d45cceab050751373 Signed-off-by: Gert Doering Acked-by: Arne Schwabe Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1499 Message-Id: <20260128150640.13867-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 493.html Signed-off-by: Gert Doering --- M src/openvpn/mtcp.c M src/openvpn/mudp.c 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 96408d1..3e33b15 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -850,7 +850,9 @@ } #ifdef ENABLE_ASYNC_PUSH - close(top->c2.inotify_fd); + msg(D_LOW, "%s: close multi.top.c2.inotify_fd (%d)", + __func__, multi.top.c2.inotify_fd); + close(multi.top.c2.inotify_fd); #endif /* shut down management interface */ diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 0492311..f7c9ffd 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -524,7 +524,9 @@ } #ifdef ENABLE_ASYNC_PUSH - close(top->c2.inotify_fd); + msg(D_LOW, "%s: close multi.top.c2.inotify_fd (%d)", + __func__, multi.top.c2.inotify_fd); + close(multi.top.c2.inotify_fd); #endif /* shut down management interface */ -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1499?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: Idcb1421b9f7fcbee9620fd1d45cceab050751373 Gerrit-Change-Number: 1499 Gerrit-PatchSet: 2 Gerrit-Owner: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --So26Pr4+x08= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

tunnel_server_*(): close correct inotify fd
<= br>On a full SIGUSR1 restart of a p2mp server compiled with
--enable-asy= nc-push, tunnel_server_{udp,tcp}() will try to close and
reopen the &quo= t;inotify" control file descriptor. For whatever reason,
the origi= nal code referenced the wrong context, always closing fd 0.

As a con= sequence of this, on the second SIGUSR1 restart, the server
will close()= the first active socket file descriptor, and if there
are active DCO cl= ients, the resulting event confusion will lead to
an ASSERT(!mi->halt= ).

Fix by closing the correct FD. Add logging.

This is a back= port of commit 5521872f80313060 to the "old p2mp code"
with a = separate mudp.c and mtcp.c for UDP and TCP servers, respectively.

Gi= thub: fixes OpenVPN/openvpn#966

Change-Id: Idcb1421b9f7fcbee9620fd1d= 45cceab050751373
Signed-off-by: Gert Doering <gert@...1296...>
= Acked-by: Arne Schwabe <arne-openvpn@...1227...>
Gerrit URL: https= ://gerrit.openvpn.net/c/openvpn/+/1499
Message-Id: <20260128150640.13= 867-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-deve= l@lists.sourceforge.net/msg35493.html
Signed-off-by: Gert Doering <ge= rt@...1296...>
---
M src/openvpn/mtcp.c
M src/openvpn/mudp.c2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c
ind= ex 96408d1..3e33b15 100644
--- a/src/openvpn/mtcp.c<= br>+++ b/src/openvpn/mtcp.c
@@ -850,7 +850,9 @@
}

#ifdef ENABLE_ASYNC_PU= SH
- close(top->c= 2.inotify_fd);
+ m= sg(D_LOW, "%s: close multi.top.c2.inotify_fd (%d)",
+ __func__, multi.top.c2.in= otify_fd);

+ close= (multi.top.c2.inotify_fd);
#endif
=
/* shut down management interface */
diff --= git a/src/openvpn/mudp.c b/src/openvpn/mudp.c
index 0492311= ..f7c9ffd 100644
--- a/src/openvpn/mudp.c
+= ++ b/src/openvpn/mudp.c
@@ -524,7 +524,9 @@
}

#ifdef ENABLE_ASYNC_PUSH<= br>- close(top->c2.inotify_= fd);
+ msg(D_LOW, = "%s: close multi.top.c2.inotify_fd (%d)",
+ __func__, multi.top.c2.inotify_fd= );
+ close(multi.t= op.c2.inotify_fd);
#endif

/* shut down management interface */

To view, visit change 1499. To unsubscribe, or for help writing mail filte= rs, visit settin= gs.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: Idcb1421b9f7fcbee9620fd1d45c= ceab050751373
Gerrit-Change-Number: 1499
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <gert@...1296...>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --So26Pr4+x08=--