Skip to contentSkip to conversation

: FreeBSD DCO support

PATCH In review Kristof Provost 3 participants 11 messages Feb 24, 2022 – Mar 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : FreeBSD DCO support

Hi,

Here's the current version of the patch to add FreeBSD DCO support.

The first patch isn't strictly related to FreeBSD, but fixes what I think is a generic issue. It doesn't manifest with Linux because the Linux DCO driver allows control packets to continue through normal UDP processing. We don't do that in FreeBSD, so it manifests there.

I've had to add a lot of '|| defined(TARGET_FREEBSD)', and I think the code could be a bit cleaner if we'd make these calls conditional only on defined(ENABLE_DCO), and instead expect every DCO implementation to provide them, if only as stubs. I've not done that here.

For those interested in testing, the kernel side of things is under review here: https://reviews.freebsd.org/D34340

Best,
Kristof

#1 lore raw

PATCH 1/2 dco: process DCO control packets

From: Kristof Provost <[email protected]...>

If control packets come in through the DCO interface (i.e. via dco_do_read()) we must process them through process_incoming_link(). This doesn't currently manifest, because Linux passes control packets through the regular socket, not via the DCO netlink interface, but other platforms will not.

---
 src/openvpn/forward.c | 8 ++++++++
 1 file changed, 8 insertions(+)
src/openvpn/forward.c +8 -0
index cd956cb3..c16f32fc 100644
@@ -1104,8 +1104,16 @@ process_incoming_link(struct context *c)
 static void
 process_incoming_dco(struct context *c)
 {
+    struct link_socket_info *lsi = get_link_socket_info(c);
+
     msg(M_INFO, __func__);
     dco_do_read(&c->c1.tuntap->dco);
+
+    c->c2.buf = c->c1.tuntap->dco.dco_packet_in;
+    c->c2.from = lsi->lsa->actual;
+
+    process_incoming_link(c);
+    buf_init(&c->c1.tuntap->dco.dco_packet_in, 0);
 }
 
 /*
Signature · 1 line
2.35.1
#3 lore raw

PATCH 2/2 ovpn-dco: introduce FreeBSD data-channel offload support

In reply to Kristof Provost

From: Kristof Provost <[email protected]...>

Implement data-channel offload for FreeBSD. The implementation and flow is very similar to that of the Linux DCO support.

---
 configure.ac               |  15 +-
 src/openvpn/Makefile.am    |   1 +
 src/openvpn/dco_freebsd.c  | 559 +++++++++++++++++++++++++++++++++++++
 src/openvpn/dco_freebsd.h  |  47 ++++
 src/openvpn/dco_internal.h |   1 +
 src/openvpn/forward.c      |   6 +-
 src/openvpn/mtcp.c         |   6 +-
 src/openvpn/multi.c        |  32 ++-
 src/openvpn/options.c      |   4 +-
 src/openvpn/tun.c          |   8 +-
 src/openvpn/tun.h          |   6 +
 11 files changed, 671 insertions(+), 14 deletions(-)
 create mode 100644 src/openvpn/dco_freebsd.c
 create mode 100644 src/openvpn/dco_freebsd.h
configure.ac +14 -1
index cdfb198e..bf1013cc 100644
@@ -787,7 +787,20 @@ dnl
 			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for Linux])
 			AC_MSG_NOTICE([Enabled ovpn-dco support for Linux])
 		;;
-
+		*-*-freebsd*)
+			DCO_CFLAGS="-I${DCO_SOURCEDIR}"
+			saved_CFLAGS="${CFLAGS}"
+			CFLAGS="${CFLAGS} ${DCO_CFLAGS}"
+			AC_CHECK_HEADERS(
+					 [if_ovpn.h],
+					 ,
+					 [AC_MSG_ERROR([if_ovpn.h is missing (use DCO_SOURCEDIR to set path to it, CFLAGS=${CFLAGS})])]
+					 )
+			CFLAGS=${saved_CFLAGS}
+			LIBS="${LIBS} -lnv"
+			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD])
+			AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD])
+		;;
 		*-mingw*)
 			AC_MSG_NOTICE([NOTE: --enable-dco ignored on Windows because it's always enabled])
 		;;
src/openvpn/Makefile.am +1 -0
index b11c3f9e..c4dbf706 100644
@@ -54,6 +54,7 @@ openvpn_SOURCES = \
 	crypto_openssl.c crypto_openssl.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	dco.c dco.h dco_internal.h \
+	dco_freebsd.c dco_freebsd.h \
 	dco_linux.c dco_linux.h \
 	dco_win.c dco_win.h \
 	dhcp.c dhcp.h \
src/openvpn/dco_freebsd.c new file +559 -0

559 lines not on this page · raw message

src/openvpn/dco_freebsd.h new file +47 -0

47 lines not on this page · raw message

src/openvpn/dco_internal.h +1 -0
index ed1a1cff..80d6821a 100644
@@ -27,6 +27,7 @@
 
 #if defined(ENABLE_DCO)
 
+#include "dco_freebsd.h"
 #include "dco_linux.h"
 #include "dco_win.h"
 
src/openvpn/forward.c +3 -3
index c16f32fc..b26c8e60 100644
@@ -1639,7 +1639,7 @@ process_outgoing_link(struct context *c)
                 socks_preprocess_outgoing_link(c, &to_addr, &size_delta);
 
                 /* Send packet */
-#ifdef TARGET_LINUX
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
                 if (c->c2.link_socket->info.dco_installed)
                 {
                     size = dco_do_write(&c->c1.tuntap->dco,
@@ -1914,7 +1914,7 @@ io_wait_dowork(struct context *c, const unsigned int flags)
 #ifdef ENABLE_ASYNC_PUSH
     static int file_shift = FILE_SHIFT;
 #endif
-#ifdef TARGET_LINUX
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     static int dco_shift = DCO_SHIFT;    /* Event from DCO linux kernel module */
 #endif
 
@@ -2024,7 +2024,7 @@ io_wait_dowork(struct context *c, const unsigned int flags)
      */
     socket_set(c->c2.link_socket, c->c2.event_set, socket, (void *)&socket_shift, NULL);
     tun_set(c->c1.tuntap, c->c2.event_set, tuntap, (void *)&tun_shift, NULL);
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     if (socket & EVENT_READ && c->c2.did_open_tun)
     {
         dco_event_set(&c->c1.tuntap->dco, c->c2.event_set, (void *)&dco_shift);
src/openvpn/mtcp.c +3 -3
index b4445dbe..43573e5b 100644
@@ -281,7 +281,7 @@ multi_tcp_wait(const struct context *c,
     }
 #endif
     tun_set(c->c1.tuntap, mtcp->es, EVENT_READ, MTCP_TUN, persistent);
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     dco_event_set(&c->c1.tuntap->dco, mtcp->es, MTCP_DCO);
 #endif
 
@@ -400,7 +400,7 @@ multi_tcp_wait_lite(struct multi_context *m, struct multi_instance *mi, const in
 
     tv_clear(&c->c2.timeval); /* ZERO-TIMEOUT */
 
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     if (mi && mi->context.c2.link_socket->info.dco_installed)
     {
         /* If we got a socket that has been handed over to the kernel
@@ -763,7 +763,7 @@ multi_tcp_process_io(struct multi_context *m)
                     multi_tcp_action(m, mi, TA_INITIAL, false);
                 }
             }
-#if defined(ENABLE_DCO) && defined(TARGET_LINUX)
+#if defined(ENABLE_DCO) && (defined(TARGET_LINUX) || defined(TARGET_FREEBSD))
             /* incoming data on DCO? */
             else if (e->arg == MTCP_DCO)
             {
src/openvpn/multi.c +31 -1
index 5054c4dd..908e5d35 100644
@@ -3138,7 +3138,8 @@ multi_signal_instance(struct multi_context *m, struct multi_instance *mi, const
 }
 #endif
 
-#if defined(ENABLE_DCO) && defined(TARGET_LINUX)
+#if defined(ENABLE_DCO)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
 static void
 process_incoming_dco_packet(struct multi_context *m, struct multi_instance *mi,  dco_context_t *dco)
 {
@@ -3166,7 +3167,9 @@ process_incoming_dco_packet(struct multi_context *m, struct multi_instance *mi,
     done:
     buf_init(&dco->dco_packet_in, 0);
 }
+#endif
 
+#if defined(TARGET_LINUX)
 static void
 process_incoming_del_peer(struct multi_context *m, struct multi_instance *mi, dco_context_t *dco)
 {
@@ -3225,6 +3228,33 @@ multi_process_incoming_dco(struct multi_context *m)
     dco->dco_message_peer_id = -1;
     return ret > 0;
 }
+
+#elif defined(TARGET_FREEBSD)
+
+bool
+multi_process_incoming_dco(struct multi_context *m)
+{
+    dco_context_t *dco = &m->top.c1.tuntap->dco;
+
+    struct multi_instance *mi = NULL;
+
+    int ret = dco_do_read(&m->top.c1.tuntap->dco);
+    int peer_id = dco->dco_message_peer_id;
+
+    if ((peer_id >= 0) && (peer_id < m->max_clients) && (m->instances[peer_id]))
+    {
+        mi = m->instances[peer_id];
+        process_incoming_dco_packet(m, mi, dco);
+    }
+    else
+    {
+        msg(D_DCO, "Received packet for peer-id unknown to OpenVPN: %d" , peer_id);
+    }
+
+    dco->dco_message_peer_id = -1;
+    return ret > 0;
+}
+#endif
 #endif
 
 /*
src/openvpn/options.c +2 -2
index 816d8db8..ab0147b0 100644
@@ -3343,7 +3343,7 @@ options_postprocess_mutate(struct options *o)
     }
 
     /* check if any option should force disabling DCO */
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     o->tuntap_options.disable_dco = dco_check_option_conflict(D_DCO, o);
 #endif
 
@@ -5668,7 +5668,7 @@ add_option(struct options *options,
 #endif
     else if (streq(p[0], "disable-dco") || streq(p[0], "dco-disable"))
     {
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
         options->tuntap_options.disable_dco = true;
 #endif
     }
src/openvpn/tun.c +4 -4
index 9d0be713..c89e635c 100644
@@ -1796,7 +1796,7 @@ open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
                                      "/dev/%s%d", dev, i);
                     openvpn_snprintf(dynamic_name, sizeof(dynamic_name),
                                      "%s%d", dev, i);
-#ifdef TARGET_LINUX
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
                     if (!tt->options.disable_dco)
                     {
                         if (open_tun_dco(tt, ctx, dynamic_name) == 0)
@@ -1829,7 +1829,7 @@ open_tun_generic(const char *dev, const char *dev_type, const char *dev_node,
             }
         }
 
-#ifdef TARGET_LINUX
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
         if (!tt->options.disable_dco)
         {
             if (!dynamic_opened)
@@ -2009,7 +2009,7 @@ open_tun(const char *dev, const char *dev_type, const char *dev_node, struct tun
     {
         open_null(tt);
     }
-#if defined(TARGET_LINUX)
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     else if (!tt->options.disable_dco)
     {
         open_tun_generic(dev, dev_type, NULL, true, tt, ctx);
@@ -2265,7 +2265,7 @@ close_tun(struct tuntap *tt, openvpn_net_ctx_t *ctx)
         net_ctx_reset(ctx);
     }
 
-#ifdef TARGET_LINUX
+#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
     if (!tt->options.disable_dco)
     {
         close_tun_dco(tt, ctx);
src/openvpn/tun.h +6 -0
index fee2c61c..4490ae9a 100644
@@ -145,6 +145,12 @@ struct tuntap_options {
     bool disable_dco;
 };
 
+#elif defined(TARGET_FREEBSD)
+
+struct tuntap_options {
+    bool disable_dco;
+};
+
 #else  /* if defined(_WIN32) || defined(TARGET_ANDROID) */
 
 struct tuntap_options {
Signature · 1 line
2.35.1
#4 lore raw

Re: [Openvpn-devel] [PATCH 2/2] ovpn-dco: introduce FreeBSD data-channel offload support

Hi Kristof,

A quick question for you, see below

Quoted 11 lines · Kristof Provost via Openvpn-devel
configure.ac +4 -1
@@ -787,7 +787,20 @@ dnl
  			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for Linux])
  			AC_MSG_NOTICE([Enabled ovpn-dco support for Linux])
  		;;
-
+		*-*-freebsd*)
+			DCO_CFLAGS="-I${DCO_SOURCEDIR}"
+			saved_CFLAGS="${CFLAGS}"
+			CFLAGS="${CFLAGS} ${DCO_CFLAGS}"

configure.ac dnl · line 803

Quoted 10 lines
configure.ac +10 -0
+			AC_CHECK_HEADERS(
+					 [if_ovpn.h],
+					 ,
+					 [AC_MSG_ERROR([if_ovpn.h is missing (use DCO_SOURCEDIR to set path to it, CFLAGS=${CFLAGS})])]
+					 )
+			CFLAGS=${saved_CFLAGS}
+			LIBS="${LIBS} -lnv"
+			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD])
+			AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD])
+		;;

If you double check the latest dco branch, you will see that I have dropped the DCO_SOURCEDIR variable and I have rather switched to "let's include the kernel API header in the openvpn repository all the time and be happy with it".

The idea is that the kernel API will always be backwards compatible, therefore having a stale header will never be a problem. It can be updated when a new feature is implemented in openvpn itself. (a similar approach is taken by hostapd or iw on Linux, where they ship a copy of nl80211.h)

On the other hand, we drastically simplify the configure logic and avoid having to deal with this variable which may have different pitfalls on different platforms.

Do you have any opinion about the above? or shipping a copy of the header with openvpn source code is fine with you?

Regards,

p.s. as a side note, the rest of the code contains some "code style" issues. Nothing major, but wanted to mention it (we can discuss on IRC if you want).

Signature · 1 line
Antonio Quartulli
#8 lore raw
In reply to Kristof Provost

Hi,

Quoted 4 lines · Kristof Provost via Openvpn-devel

I've had to add a lot of '|| defined(TARGET_FREEBSD)', and I think the code could be a bit cleaner if we'd make these calls conditional only on defined(ENABLE_DCO), and instead expect every DCO implementation to provide them, if only as stubs. I've not done that here.

Can you name what new internal APIs would you want to add?
I am also in favor of less ifdefs and have APIs that can be defined as stub or not based on the platform.

A comment for your kernel API:
I have seen you created an API named "OVPN_SET_TIMEOUT", however I'd suggest to name it "OVPN_SET_PEER" (like on Linux and Windows), because the idea is that this call will be used to set any additional/optional per-peer param.

For example, we have been recently working on mssfix, which we may want to set on a per-peer basis (more params may come later).

The SET_PEER call will allow to set all these params (if specified).

What do you think?

Regards,

Signature · 1 line
Antonio Quartulli
#5 lore raw

Re: [Openvpn-devel] [PATCH 2/2] ovpn-dco: introduce FreeBSD data-channel offload support

In reply to Antonio Quartulli
Quoted 29 lines · Antonio Quartulli

Hi Kristof,

A quick question for you, see below

Quoted 11 lines · Kristof Provost via Openvpn-devel
configure.ac +4 -1
@@ -787,7 +787,20 @@ dnl
  			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for Linux])
  			AC_MSG_NOTICE([Enabled ovpn-dco support for Linux])
  		;;
-
+		*-*-freebsd*)
+			DCO_CFLAGS="-I${DCO_SOURCEDIR}"
+			saved_CFLAGS="${CFLAGS}"
+			CFLAGS="${CFLAGS} ${DCO_CFLAGS}"

configure.ac dnl · line 803

Quoted 10 lines
configure.ac +10 -0
+			AC_CHECK_HEADERS(
+					 [if_ovpn.h],
+					 ,
+					 [AC_MSG_ERROR([if_ovpn.h is missing (use DCO_SOURCEDIR to set path to it, CFLAGS=${CFLAGS})])]
+					 )
+			CFLAGS=${saved_CFLAGS}
+			LIBS="${LIBS} -lnv"
+			AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD])
+			AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD])
+		;;

If you double check the latest dco branch, you will see that I have dropped the DCO_SOURCEDIR variable and I have rather switched to "let's include the kernel API header in the openvpn repository all the time and be happy with it".

Quoted 6 lines

The idea is that the kernel API will always be backwards compatible, therefore having a stale header will never be a problem. It can be updated when a new feature is implemented in openvpn itself. (a similar approach is taken by hostapd or iw on Linux, where they ship a copy of nl80211.h)

On the other hand, we drastically simplify the configure logic and avoid having to deal with this variable which may have different pitfalls on different platforms.

Do you have any opinion about the above? or shipping a copy of the header with openvpn source code is fine with you?

It’s not really too relevant either way for FreeBSD, because the header contains very little information. It’s mostly only the ioctl numbers. There are no structures shared between the kernel and user land. Instead we use nvlists (name/value pair serialisation).

Theoretically I’d prefer to use the OS header, but I can certainly see the upside of not having that dependency. We’ll always have to do the runtime check (dco_available()) anyway, so I can certainly live with that.

Quoted 2 lines

p.s. as a side note, the rest of the code contains some "code style" issues. Nothing major, but wanted to mention it (we can discuss on IRC if you want).

I’m happy to fix that. Do you have a rough list of what’s wrong?
https://community.openvpn.net/openvpn/wiki/CodeStyle is the authoritative style guide, right?

Best regards,
Kristof

#6 lore raw

Re: [Openvpn-devel] [PATCH 2/2] ovpn-dco: introduce FreeBSD data-channel offload support

Hi,

Quoted 1 line · Kristof Provost

It’s not really too relevant either way for FreeBSD, because the header contains very little information. It’s mostly only the ioctl numbers. There are no structures shared between the kernel and user land. Instead we use nvlists (name/value pair serialisation).

Yeah, quite similar to the linux header actually - netlink is indeed a list of attribute/value airs. The Linux header contains also the attribute names (as they are encoded into an int and must not change once defined).

Quoted 7 lines

Theoretically I’d prefer to use the OS header, but I can certainly see the upside of not having that dependency. We’ll always have to do the runtime check (dco_available()) anyway, so I can certainly live with that.

Quoted 2 lines

p.s. as a side note, the rest of the code contains some "code style" issues. Nothing major, but wanted to mention it (we can discuss on IRC if you want).

I’m happy to fix that. Do you have a rough list of what’s wrong?
https://community.openvpn.net/openvpn/wiki/CodeStyle is the authoritative style guide, right?

Correct. Not everything might be there, so feel free to ask for any clarification on IRC. Your code is already pretty clean actually. Some things I have seen:
- We tend to avoid "if (a == NULL)" (or "!= 0") in favor of just "if (a)";
- We avoid spaces after the cast operator;
- we always use brackets {} for one-line blocks;

Regards,

Signature · 1 line
Antonio Quartulli
#9 lore raw
In reply to Antonio Quartulli
Quoted 9 lines · Antonio Quartulli
Quoted 4 lines · Kristof Provost via Openvpn-devel

I've had to add a lot of '|| defined(TARGET_FREEBSD)', and I think the code could be a bit cleaner if we'd make these calls conditional only on defined(ENABLE_DCO), and instead expect every DCO implementation to provide them, if only as stubs. I've not done that here.

Can you name what new internal APIs would you want to add?
I am also in favor of less ifdefs and have APIs that can be defined as stub or not based on the platform.

We’ve got a significant number of cases where we call DCO functions for Linux & FreeBSD but not for Windows.
One example is the call to dco_event_state() in multi_tcp_wait() and io_wait_doword().
If windows provided an implementation for that, even if it did no work, we could replace ‘#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)’ with an ‘#ifdef ENABLE_DCO’. If we provided a stub implementation for the DCO functions even for non-DCO builds we wouldn’t need any ‘#ifdef’ at all.

Quoted 9 lines

A comment for your kernel API:
I have seen you created an API named "OVPN_SET_TIMEOUT", however I'd suggest to name it "OVPN_SET_PEER" (like on Linux and Windows), because the idea is that this call will be used to set any additional/optional per-peer param.

For example, we have been recently working on mssfix, which we may want to set on a per-peer basis (more params may come later).

The SET_PEER call will allow to set all these params (if specified).

What do you think?

I think I renamed it because I found the ‘SET_PEER’ name to be easy to confuse with ‘NEW_PEER’, but I’m happy to align to other platforms.

Best regards,
Kristof

#7 lore raw

Re: [Openvpn-devel] [PATCH 2/2] ovpn-dco: introduce FreeBSD data-channel offload support

In reply to Antonio Quartulli
Quoted 5 lines · Antonio Quartulli
Quoted 4 lines · Kristof Provost

Theoretically I’d prefer to use the OS header, but I can certainly see the upside of not having that dependency. We’ll always have to do the runtime check (dco_available()) anyway, so I can certainly live with that.

Quoted 2 lines

p.s. as a side note, the rest of the code contains some "code style" issues. Nothing major, but wanted to mention it (we can discuss on IRC if you want).

Quoted 9 lines
Quoted 2 lines

I’m happy to fix that. Do you have a rough list of what’s wrong?
https://community.openvpn.net/openvpn/wiki/CodeStyle is the authoritative style guide, right?

Correct. Not everything might be there, so feel free to ask for any clarification on IRC. Your code is already pretty clean actually. Some things I have seen:
- We tend to avoid "if (a == NULL)" (or "!= 0") in favor of just "if (a)";
- We avoid spaces after the cast operator;
- we always use brackets {} for one-line blocks;

Thanks!

Most of those are probably because I’m used to FreeBSD’s style (https://www.freebsd.org/cgi/man.cgi?query=style&apropos=0&sektion=0&manpath=FreeBSD+13.0-RELEASE+and+Ports&arch=default&format=html), but consistency is important.

I’ll update the patch (and also address the SET_TIMEOUT thing) soon. I’ve got a bit of travel coming up, so I’m not quite sure when it’ll be though.

Best regards,
Kristof

#10 lore raw
In reply to Kristof Provost

Am 08.03.22 um 15:45 schrieb Kristof Provost via Openvpn-devel:

Quoted 7 lines · Antonio Quartulli
Quoted 6 lines · Kristof Provost via Openvpn-devel
Quoted 4 lines

I've had to add a lot of '|| defined(TARGET_FREEBSD)', and I think the code could be a bit cleaner if we'd make these calls conditional only on defined(ENABLE_DCO), and instead expect every DCO implementation to provide them, if only as stubs. I've not done that here.

Quoted 6 lines
Quoted 3 lines

Can you name what new internal APIs would you want to add?
I am also in favor of less ifdefs and have APIs that can be defined as stub or not based on the platform.

We’ve got a significant number of cases where we call DCO functions for Linux & FreeBSD but not for Windows.
One example is the call to dco_event_state() in multi_tcp_wait() and io_wait_doword().
If windows provided an implementation for that, even if it did no work, we could replace ‘#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)’ with an ‘#ifdef ENABLE_DCO’. If we provided a stub implementation for the DCO functions even for non-DCO builds we wouldn’t need any ‘#ifdef’ at all.

A lot of these calls might be because of the missing multi support on Windows. Maybe we can also have a DCO_MULTI instead. BUt stub functions might also work.

Arne

#2 lore raw

Re: [Openvpn-devel] [PATCH 1/2] dco: process DCO control packets

In reply to Kristof Provost

Hi Kristof,

Quoted 7 lines · Kristof Provost via Openvpn-devel

From: Kristof Provost <[email protected]...>

If control packets come in through the DCO interface (i.e. via dco_do_read()) we must process them through process_incoming_link(). This doesn't currently manifest, because Linux passes control packets through the regular socket, not via the DCO netlink interface, but other platforms will not.

This is an interesting catch - actually also ovpn-dco on Linux is expected to send control packets over netlink.

However, due to a little glitch packets were still sent over the UDP socket (this is expected only for the initial handshake).

Once this bug has been fixed, I could see that indeed process_incoming_dco() wasn't operating as it should and this patch was required.

I have squashed a modified version of this patch directly in my dco branch as it is needed to make ovpn-dco work.

Thanks a lot!

Best Regards,

Signature · 1 line
Antonio Quartulli