[Openvpn-devel] [PATCH v2 3/4] Ignore OVPN_DEL_PEER_REASON_USERSPACE to avoid race conditions

2022-12-27 Thread Arne Schwabe
Signed-off-by: Arne Schwabe 
---
 src/openvpn/multi.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 6c6385c6e..50d88f19a 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -3243,10 +3243,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. UUnfortunately, 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
-- 
2.37.1 (Apple Git-137.1)



___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel


[Openvpn-devel] [PATCH v2 3/4] Ignore OVPN_DEL_PEER_REASON_USERSPACE to avoid race conditions

2022-12-26 Thread Arne Schwabe
Signed-off-by: Arne Schwabe 
---
 src/openvpn/multi.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 6c6385c6e..50d88f19a 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -3243,10 +3243,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. UUnfortunately, 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
-- 
2.37.1 (Apple Git-137.1)



___
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel