From: Arne Schwabe Date: Tue, 27 Dec 2022 02:24:03 +0000 (+0100) Subject: Ignore OVPN_DEL_PEER_REASON_USERSPACE to avoid race conditions X-Git-Tag: v2.7_alpha1~616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ad66b0c2950c0d7674a5867085fef8115f61d11;p=thirdparty%2Fopenvpn.git Ignore OVPN_DEL_PEER_REASON_USERSPACE to avoid race conditions Signed-off-by: Arne Schwabe Acked-by: Gert Doering 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 --- diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 92e63dd26..3658e1d51 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -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