[Openvpn-devel] disable DCO if no --dev was specified

Message ID 20220801150812.32561-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel] disable DCO if no --dev was specified | expand

Commit Message

Antonio Quartulli Aug. 1, 2022, 5:08 a.m. UTC
The DCO logic is uanble to proceed without --dev argument, therefore
just disable DCO if no --dev was specified by the user.

Right now, calling openvpn with DCO enabled (default) and no --dev
specified leads to a crash, because --dev is assumed to always be there.

Reported-by: Frank Lichtenheld <frank@lichtenheld.com>
Signed-off-by: Antonio Quartulli <a@unstable.cc>
 src/openvpn/dco.c | 5 +++++
 1 file changed, 5 insertions(+)


Gert Doering Aug. 1, 2022, 5:39 a.m. UTC | #1
Acked-by: Gert Doering <gert@greenie.muc.de>

The broken bit was added quite a few patches ago, but wasn't caught by
my testing, because it needed --enable-dco *and* DCO-in-kernel - otherwise,
the DCO paths would disable themselves, and not crash :-)

Tested on ubuntu 20 with DCO kernel support - without this,

  $ openvpn --test-crypto

segfaults - with the patch, it complains :-)

Your patch has been applied to the master branch.

commit b8b0a95efff0184cebacc43a6e751fa8f9092cd8
Author: Antonio Quartulli
Date:   Mon Aug 1 17:08:12 2022 +0200

     disable DCO if no --dev was specified

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220801150812.32561-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24772.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index b3fd135f..a3a081b2 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -109,6 +109,11 @@  dco_check_option_conflict(int msglevel, const struct options *o)
         return false;
+    if (!o->dev)
+    {
+        return false;
+    }
     if (!dco_check_option_conflict_platform(msglevel, o))
         return false;