From: "cron2 (Code Review)" Date: Sat, 28 Feb 2026 09:38:46 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, antonio@...2726... Message-ID: <3f9d7aa9998dad965c1c2d28e4a1851335fc8365-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="rk14wyx71SM="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: dco_freebsd: use AF_LOCAL sockets for ioctl() communication with DCO ... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: plaisthos , openvpn-devel --rk14wyx71SM= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/15= 51?usp=3Demail ) Change subject: dco_freebsd: use AF_LOCAL sockets for ioctl() communication= with DCO driver ...................................................................... dco_freebsd: use AF_LOCAL sockets for ioctl() communication with DCO driver DCO FreeBSD uses ioctl() calls for userland -> driver communication, on a socket() file descriptor. The original code uses AF_INET sockets, which fails if using a kernel compiled without IPv4 support. The kernel side ioctl() handling does not differentiate between AF_INET, AF_INET6 and AF_LOCAL sockets, and only the latter are guaranteed to be present. While add it, add a clear message if the socket() call in dco_available() fails (it will lead to disabling of DCO). FreeBSD PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D286263 Reported-by: Marek Zarychta Change-Id: I84fe7a11391eafde3660d25a3c99094a0c525f3d Signed-off-by: Gert Doering Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1551 Message-Id: <20260227224745.3175-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 795.html Signed-off-by: Gert Doering --- M src/openvpn/dco_freebsd.c 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index ee3a5d0..718cd8b 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -205,7 +205,7 @@ return -1; } - dco->fd =3D socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + dco->fd =3D socket(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (dco->fd !=3D -1) { dco->open =3D true; @@ -715,9 +715,10 @@ * loaded, or built into the kernel. */ (void)kldload("if_ovpn"); - fd =3D socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + fd =3D socket(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0); if (fd < 0) { + msg(M_WARN | M_ERRNO, "%s: socket() failed, disabling data channel= offload", __func__); return false; } -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1551?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I84fe7a11391eafde3660d25a3c99094a0c525f3d Gerrit-Change-Number: 1551 Gerrit-PatchSet: 2 Gerrit-Owner: cron2 Gerrit-Reviewer: ordex Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --rk14wyx71SM= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

dco_freebsd: use AF_LOCAL sockets for ioctl() co=
mmunication with DCO driver

DCO FreeBSD uses ioctl() calls for userl= and -> driver communication, on
a socket() file descriptor. The orig= inal code uses AF_INET sockets,
which fails if using a kernel compiled w= ithout IPv4 support.

The kernel side ioctl() handling does not diffe= rentiate between AF_INET,
AF_INET6 and AF_LOCAL sockets, and only the la= tter are guaranteed to be
present.

While add it, add a clear mess= age if the socket() call in dco_available()
fails (it will lead to disab= ling of DCO).

FreeBSD PR: https://bugs.freebsd.org/bugzilla/show_bug= .cgi?id=3D286263
Reported-by: Marek Zarychta <zarychtam@...2997...>= ;

Change-Id: I84fe7a11391eafde3660d25a3c99094a0c525f3d
Signed-off= -by: Gert Doering <gert@...1296...>
Acked-by: Antonio Quartulli &l= t;antonio@...2726...>
Gerrit URL: https://gerrit.openvpn.net/c/openvp= n/+/1551
Message-Id: <20260227224745.3175-1-gert@...1296...>
UR= L: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg3579= 5.html
Signed-off-by: Gert Doering <gert@...1296...>
---
M s= rc/openvpn/dco_freebsd.c
1 file changed, 3 insertions(+), 2 deletions(-)=

diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c
index ee3a5d0..718cd8b 100644
--- a/src/openvpn/= dco_freebsd.c
+++ b/src/openvpn/dco_freebsd.c
@@ -205,7 +205,7 @@
return -1;
= }

+ dco->fd =3D socket(= AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (dco->f= d !=3D -1)
{
dco->open =3D= true;
@@ -715,9 +715,10 @@
* loaded,= or built into the kernel. */
(void)kldload("if_o= vpn");

- fd =3D socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0);+ fd =3D socket(AF_LOCAL, S= OCK_DGRAM | SOCK_CLOEXEC, 0);
if (fd < 0) {
+ = msg(M_WARN | M_ERRNO, "%s: socket() failed, disabling data channel o= ffload", __func__);
return false;
<= span> }


To view, = visit ch= ange 1551. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I84fe7a11391eafde3660d25a3c9= 9094a0c525f3d
Gerrit-Change-Number: 1551
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <gert@...1296...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --rk14wyx71SM=--