Skip to contentSkip to conversation

Signal USR1 when connection initialising fails

PATCH In review Arne Schwabe 2 participants 2 messages Nov 30, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Signal USR1 when connection initialising fails

When we fail initialisation the connection (e.g. P2P cipher NCP), we have a non-working connection. Even though previous version would then stay in this state, it does not really make sense to be in this state until the keepalive timeout expires and triggers a USR1 anyway.

---
 src/openvpn/forward.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/openvpn/forward.c +4 -1
index 37340aef5..1b418b1bc 100644
@@ -344,7 +344,10 @@ check_connection_established(struct context *c)
         }
         else
         {
-            do_up(c, false, 0);
+            if (!do_up(c, false, 0))
+            {
+                register_signal(c, SIGUSR1, "connection initialisation failed");
+            }
         }
 
         event_timeout_clear(&c->c2.wait_for_connect);
Signature · 1 line
2.37.1 (Apple Git-137.1)
Acked-by on v1 1/1
#1 lore raw

Lovingly called "the Lala Land patch" - without this, on P2P NCP fail, openvpn goes to lala land, sitting there, knowing it has no way to encrypt a packet for the peer, and happily throwing away all packets (and on a p2p server, being generally unwilling to do anything useful even on reconnect).

With the patch, it restarts the instance (SIGUSR1), and the next "proper" client connection can then succeed.

2022-11-30 21:42:09 us=594531 ERROR: failed to negotiate cipher with peer and --data-ciphers-fallback not enabled. No usable data channel cipher
2022-11-30 21:42:09 us=594617 ERROR: Failed to apply P2P negotiated protocol options
2022-11-30 21:42:09 us=594852 TCP/UDP: Closing socket
2022-11-30 21:42:09 us=594925 Closing TUN/TAP interface

Your patch has been applied to the master branch.

commit 8187bbba5cdfa46fec2595f5f05384fd77eb5714

Author: Arne Schwabe
Date:   Wed Nov 30 17:57:12 2022 +0100
     Signal USR1 when connection initialising fails

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg25596.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering