[Openvpn-devel,v3] FreeBSD DCO: repair incoming "delete peer" notifications in p2p client mode

Message ID 20251107141333.12056-1-gert@greenie.muc.de
State New
Headers show
Series [Openvpn-devel,v3] FreeBSD DCO: repair incoming "delete peer" notifications in p2p client mode | expand

Commit Message

Gert Doering Nov. 7, 2025, 2:13 p.m. UTC
commit 4a48841da2 introduced a workaround for spurious DCO notifications
"with no useful content" on Linux - namely, ignoring dco_message_type==0
in forward.c, process_incoming_dco(), "because Linux has no message
type 0 anyway".

Each DCO platform uses its own enum for these notification messages
*inside* OpenVPN (which might not have the best design decision ever),
and FreeBSD had OVPN_CMD_DEL_PEER in the enum on "position 0"...

Fix by changing the enum to start with 1.  Tested with DEL_PEER in p2p
client and DEL_PEER & FLOAT in p2mp server mode.

v2:
  introduce OVPN_CMD_NO_MESSAGE in position 0, and a comment explaining why.
  A future commit can then clean up forward.c and dco_linux.c to use the
  constant, and not "magic 0 which happens to be in there after CLEAR()".

Github: fixes OpenVPN/openvpn#881

Change-Id: I991d6053776efed771bc1a3880acb80b55959cbc
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1353
---

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/+/1353
This mail reflects revision 3 of this Change.

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

Comments

Gert Doering Nov. 7, 2025, 4:31 p.m. UTC | #1
Thanks for the review.  Tested on FreeBSD 14.3 with DCO.

As it says in the commit, we might want to make the other DCO backends
use "OVPN_CMD_NO_MESSAGE" as well, instead of "defaulting to 0", but
that's for another day.

Patch has been applied to the master branch.

commit c4fe7813d8b8eba99549a7b5e9499a31f91c8109
Author: Gert Doering
Date:   Fri Nov 7 15:13:27 2025 +0100

     FreeBSD DCO: repair incoming 'delete peer' notifications in p2p client mode

     Signed-off-by: Gert Doering <gert@greenie.muc.de>
     Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1353
     Message-Id: <20251107141333.12056-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34237.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/dco_freebsd.h b/src/openvpn/dco_freebsd.h
index 0797b82..5e2a552 100644
--- a/src/openvpn/dco_freebsd.h
+++ b/src/openvpn/dco_freebsd.h
@@ -33,6 +33,8 @@ 
 
 enum ovpn_message_type_t
 {
+    /* message type #0 is treated as magic number by process_incoming_dco() */
+    OVPN_CMD_NO_MESSAGE = 0,
     OVPN_CMD_DEL_PEER,
     OVPN_CMD_PACKET,
     OVPN_CMD_SWAP_KEYS,