[Openvpn-devel,v1] openvpnserv: don't stop if the next pipe instance cannot be created

Message ID 20261129185742.26723-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] openvpnserv: don't stop if the next pipe instance cannot be created |

Commit Message

Gert Doering Nov. 29, 2026, 6:57 p.m. UTC
  From: Heiko Hund <heiko@ist.eigentlich.net>

If creating the next client pipe instance failed, the service stopped.

Drop the client and keep listening on the current instance instead.
Handing it to a worker would leave no instance to listen on.

Change-Id: Ib65ceb898d23777663c32241156d597918a24ffb
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2114
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2114
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <frank@lichtenheld.com>
  

Patch

diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c
index bffc9da..37e8667 100644
--- a/src/openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive.c
@@ -4087,6 +4087,16 @@ 
         {
             /* Client connected, spawn a worker thread for it */
             HANDLE next_pipe = CreateClientPipeInstance();
+            if (next_pipe == INVALID_HANDLE_VALUE)
+            {
+                /*
+                 * Drop the client and keep listening on this instance. Handing
+                 * it over would leave no instance to listen on.
+                 */
+                DisconnectNamedPipe(pipe);
+                ResetOverlapped(&overlapped);
+                continue;
+            }
 
             /* Avoid exceeding WaitForMultipleObjects MAXIMUM_WAIT_OBJECTS */
             if (handle_count + 1 > MAXIMUM_WAIT_OBJECTS)