Skip to contentSkip to conversation

Change in openvpn[master]: Lay the foundation to support both old and new versions of DCO

Openvpn-devel its_Giaan (Code Review) 1 participant 5 messages Jun 6, 2024 – Jul 29, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1717673612000.I6662605b60d4859949970cfe256c55cbcbd4a672@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/662?usp=email

to review the following change.

Change subject: Lay the foundation to support both old and new versions of DCO
......................................................................

Lay the foundation to support both old and new versions of DCO

Added a new abstraction layer based on the struct dco_ops, a structure of function pointers that ensures the appropriate APIs at runtime are used for DCO communication between kernel and user space, selection is based on the available module's family name.

The old version, referred to as "ovpn_dco_v2", and its related commands and functions, will be distinguished with the "v2" suffix.

Change-Id I6662605b60d4859949970cfe256c55cbcbd4a672

---
M CMakeLists.txt
M src/openvpn/Makefile.am
M src/openvpn/dco.c
M src/openvpn/dco.h
M src/openvpn/dco_freebsd.c
M src/openvpn/dco_linux.c
M src/openvpn/dco_linux.h
A src/openvpn/dco_linux_v2.c
M src/openvpn/dco_win.c
M src/openvpn/forward.c

10 files changed, 923 insertions(+), 655 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/62/662/1

CMakeLists.txt +1 -0
index 096837d..732be9e 100644
@@ -398,6 +398,7 @@
     src/openvpn/dco_win.h
     src/openvpn/dco_linux.c
     src/openvpn/dco_linux.h
+    src/openvpn/dco_linux_v2.c
     src/openvpn/dco_freebsd.c
     src/openvpn/dco_freebsd.h
     src/openvpn/dhcp.c
src/openvpn/Makefile.am +1 -0
index 56cce9d..286d3c5 100644
@@ -54,6 +54,7 @@
 	dco.c dco.h dco_internal.h \
 	dco_freebsd.c dco_freebsd.h \
 	dco_linux.c dco_linux.h \
+	dco_linux_v2.c \
 	dco_win.c dco_win.h \
 	dhcp.c dhcp.h \
 	dns.c dns.h \
src/openvpn/dco.c +1 -1
index 78243b1..80184f8 100644
@@ -396,7 +396,7 @@
     /* now that all options have been confirmed to be supported, check
      * if DCO is truly available on the system
      */
-    return dco_available(msglevel);
+    return dco_available(msglevel, NULL);
 }
 
 bool
src/openvpn/dco.h +2 -2
index 50ebb35..fc34da8 100644
@@ -56,7 +56,7 @@
  * @param msglevel      level to print messages to
  * @return              true if ovpn-dco is available, false otherwise
  */
-bool dco_available(int msglevel);
+bool dco_available(int msglevel, dco_context_t *dco);
 
 
 /**
@@ -254,7 +254,7 @@
 typedef void *dco_context_t;
 
 static inline bool
-dco_available(int msglevel)
+dco_available(int msglevel, dco_context_t *dco)
 {
     return false;
 }
src/openvpn/dco_freebsd.c +1 -1
index 7c8b29c..93c0813 100644
@@ -569,7 +569,7 @@
 }
 
 bool
-dco_available(int msglevel)
+dco_available(int msglevel, dco_context_t *dco)
 {
     struct if_clonereq ifcr;
     char *buf = NULL;
src/openvpn/dco_linux.c +129 -629

856 lines not on this page · raw message

src/openvpn/dco_linux.h +128 -0

144 lines not on this page · raw message

src/openvpn/dco_linux_v2.c new file +636 -0

636 lines not on this page · raw message

src/openvpn/dco_win.c +1 -1
index e3ada76..65be766 100644
@@ -357,7 +357,7 @@
 }
 
 bool
-dco_available(int msglevel)
+dco_available(int msglevel, dco_context_t *dco)
 {
     /* try to open device by symbolic name */
     HANDLE h = CreateFile("\\\\.\\ovpn-dco", GENERIC_READ | GENERIC_WRITE,
src/openvpn/forward.c +23 -21

60 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/662?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 662
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: its_Giaan, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/662?usp=email )

Change subject: Lay the foundation to support both old and new versions of DCO
......................................................................

Patch Set 1: Code-Review-1

(4 comments)

Patchset:

PS1:
A few small nitpicks

File src/openvpn/dco_linux.h:

http://gerrit.openvpn.net/c/openvpn/+/662/comment/23d9dd04_2e8af958 :
PS1, Line 129: * @param nl_msg the message to use
"The"

http://gerrit.openvpn.net/c/openvpn/+/662/comment/e8c66910_d887f4a2 :
PS1, Line 174: * extended in the future if we need to lookup more than one mcast id. "can be extended" ?

File src/openvpn/forward.c:

http://gerrit.openvpn.net/c/openvpn/+/662/comment/7b654a13_31b82c62 :
PS1, Line 1233: int cmd_del_peer = OVPN_CMD_DEL_PEER;
Why is this indirection required?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/662?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 662
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Comment-Date: Wed, 26 Jun 2024 16:58:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

its_Giaan has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/662?usp=email )

Change subject: Lay the foundation to support both old and new versions of DCO
......................................................................

Patch Set 1:

(3 comments)

File src/openvpn/dco_linux.h:

http://gerrit.openvpn.net/c/openvpn/+/662/comment/86f99d7c_43678f20 :
PS1, Line 129: * @param nl_msg the message to use

Quoted 1 line

"The"

Acknowledged

http://gerrit.openvpn.net/c/openvpn/+/662/comment/88a96579_919aab40 :
PS1, Line 174: * extended in the future if we need to lookup more than one mcast id.

Quoted 1 line

"can be extended" ?

Acknowledged

File src/openvpn/forward.c:

http://gerrit.openvpn.net/c/openvpn/+/662/comment/2f02c26a_4ad35d7f :
PS1, Line 1233: int cmd_del_peer = OVPN_CMD_DEL_PEER;

Quoted 1 line

Why is this indirection required?

Because with the next commit that will introduce support for dco_v3, the commands will be completely different (the names will be shared between dco_v3 linux and bsd while dco_v2 will use the *current* commands with the addition of the acronym v2 (i.e. OVPN_V2_CMD_GET_PEER) and since the commands that will be used will change based on the platform and the version of dco loaded, that differentiation must be made via #if defined

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/662?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 662
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 27 Jun 2024 08:44:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, its_Giaan, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/662?usp=email )

Change subject: Lay the foundation to support both old and new versions of DCO
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
Summing up the intermediate discussions on IRC

13:32 <@cron2> ordex, gianm: wrt https://gerrit.openvpn.net/c/openvpn/+/662 -
do I remember correctly that we went for "we will at some point do a cut-over, and who wants to use dco_v2 needs to use 2.6, and master will only support dco_v3 / ovpn"?
13:32 <@ordex> Giaan: ^
13:33 <@ordex> cron2: correct
13:33 <@ordex> that's the final decision
13:33 <@cron2> in that case, I think 662 can be abandoned and we'll see a new
patch that does the renaming + code change, but no if() and no function pointers :-)
13:33 <@ordex> so we don't need abstraction layers or function pointers anymore 13:33 <@cron2> \o/
13:33 <@ordex> correct
13:33 <@ordex> Giaan will publish that patch later on, once v3 will be ready
for dev use

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/662?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 662
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: its_Giaan <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 29 Jul 2024 11:33:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

cron2 has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/662?usp=email )

Change subject: Lay the foundation to support both old and new versions of DCO
......................................................................

Abandoned

it was decided that DCO_v2 and DCO_v3 (aka "in upstream kernel" or "ovpn") will not be supported at the same time, so this infrastructure is no longer needed or desirable --
To view, visit http://gerrit.openvpn.net/c/openvpn/+/662?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 662
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon