[Openvpn-devel,v2] dco: disable DCO if --allow-compress yes/asym was specified

Message ID 20220807095329.28819-1-a@unstable.cc
State Accepted
Headers show
Series [Openvpn-devel,v2] dco: disable DCO if --allow-compress yes/asym was specified | expand

Commit Message

Antonio Quartulli Aug. 6, 2022, 11:53 p.m. UTC
Allowing compression means that we may accept a pushable compress
This scenario can't work with DCO therefore disable it when compression
is allowed.

Signed-off-by: Antonio Quartulli <a@unstable.cc>

Changes from v1:
* improve wording for message
 src/openvpn/dco.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


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

Same functionality as v1, wording as suggested.  Tested, does the job :-)

Client with "--allow-compression yes --comp-lzo" -> 

 2022-08-07 12:20:16 Note: '--allow-compression' is not set to 'no', disabling data channel offload.

Client with "--allow-compression no --comp-lzo" -> 

  Options error: Cannot set comp-lzo to '(null)', allow-compression is set to 'no'

(this error message could use a bit of improvement, though)

Client with "--allow-compression no #--comp-lzo" -> 

 2022-08-07 12:22:15 DCO device tun7 opened

We might find ourselves returning here, and the release notes for 2.6 need
careful tending to ensure the interaction of DCO with "all these options" is
communicated really well.

Your patch has been applied to the master branch.

commit c984d0b17056f87cd580260edd2e89874c601566
Author: Antonio Quartulli
Date:   Sun Aug 7 11:53:29 2022 +0200

     dco: disable DCO if --allow-compress yes/asym was specified

     Signed-off-by: Antonio Quartulli <a@unstable.cc>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20220807095329.28819-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24834.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 c40fe96f..3fd8f82a 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -352,9 +352,11 @@  dco_check_option_conflict(int msglevel, const struct options *o)
 #if defined(USE_COMP)
-    if (o->comp.alg != COMP_ALG_UNDEF)
+    if (o->comp.alg != COMP_ALG_UNDEF
+        || o->comp.flags & COMP_F_ALLOW_ASYM
+        || o->comp.flags & COMP_F_ALLOW_COMPRESS)
-        msg(msglevel, "Note: Using compression disables data channel offload.");
+        msg(msglevel, "Note: '--allow-compression' is not set to 'no', disabling data channel offload.");
         if (o->mode == MODE_SERVER && !(o->comp.flags & COMP_F_MIGRATE))