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 1 message Jun 6, 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.1717660653000.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/+/661?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
M src/openvpn/ovpn_dco_linux.h

11 files changed, 1,082 insertions(+), 813 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/61/661/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

src/openvpn/ovpn_dco_linux.h +159 -158

411 lines not on this page · raw message

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6662605b60d4859949970cfe256c55cbcbd4a672
Gerrit-Change-Number: 661
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]...>