]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Ignore OVPN_DEL_PEER_REASON_USERSPACE to avoid race conditions
authorArne Schwabe <arne@rfc2549.org>
Tue, 27 Dec 2022 02:24:03 +0000 (03:24 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 27 Dec 2022 15:56:43 +0000 (16:56 +0100)
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221227022404.3468137-3-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25820.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 6ad66b0c2950c0d7674a5867085fef8115f61d11)

src/openvpn/multi.c

index 92e63dd26acdd8c6958fab774d11392ac293d280..3658e1d51920375f2de809687cf8b1d5d94f9cbb 100644 (file)
@@ -3235,10 +3235,19 @@ process_incoming_del_peer(struct multi_context *m, struct multi_instance *mi,
             break;
 
         case OVPN_DEL_PEER_REASON_USERSPACE:
-            /* This very likely ourselves but might be another process, so
-             * still process it */
-            reason = "ovpn-dco: userspace request";
-            break;
+            /* We assume that is ourselves. Unfortunately, sometimes these
+             * events happen with enough delay that they can have an order of
+             *
+             * dco_del_peer x
+             * [new client connecting]
+             * dco_new_peer x
+             * event from dco_del_peer arrives.
+             *
+             * if we do not ignore this we get desynced with the kernel
+             * since we assume the peer-id is free again. The other way would
+             * be to send a dco_del_peer again
+             */
+            return;
     }
 
     /* When kernel already deleted the peer, the socket is no longer