From: "flichtenheld (Code Review)" Date: Sun, 22 Sep 2024 14:15:37 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="hD143hGxLEU="; charset=UTF-8 Subject: [Openvpn-devel] [L] Change in openvpn[master]: Remove support for compression on send List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --hD143hGxLEU= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/755?usp=3Demail to review the following change. Change subject: Remove support for compression on send ...................................................................... Remove support for compression on send We can't disable compression support on receive because that would break too many configurations out there. But we can remove the support for compressing outgoing traffic, it was disabled by default anyway. Makes --allow-compression yes is an alias for --allow-compression asym and removes all resulting dead code. Change-Id: I402ba016b75cfcfec4fc8b2b01cc4eca7e2bcc60 Signed-off-by: Frank Lichtenheld --- M Changes.rst M src/openvpn/comp-lz4.c M src/openvpn/comp.h M src/openvpn/dco.c M src/openvpn/lzo.c M src/openvpn/options.c 6 files changed, 19 insertions(+), 269 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/55/755/1 diff --git a/Changes.rst b/Changes.rst index 439352a..b9287ce 100644 --- a/Changes.rst +++ b/Changes.rst @@ -46,6 +46,12 @@ Support for building with OpenSSL 1.0.2 has been removed. The minimum supported OpenSSL version is now 1.1.0. +Compression on send + OpenVPN 2.7 will never compress data before sending. Decompression of + received data is still supported. + ``--allow-compression yes`` is now an alias for + ``--allow-compression asym``. + Overview of changes in 2.6 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D diff --git a/src/openvpn/comp-lz4.c b/src/openvpn/comp-lz4.c index ac020a4..f9eee11 100644 --- a/src/openvpn/comp-lz4.c +++ b/src/openvpn/comp-lz4.c @@ -55,129 +55,11 @@ { } -static bool -do_lz4_compress(struct buffer *buf, - struct buffer *work, - struct compress_context *compctx, - const struct frame *frame) -{ - /* - * In order to attempt compression, length must be at least COMPRESS_T= HRESHOLD. - * and asymmetric compression must be disabled - */ - if (buf->len >=3D COMPRESS_THRESHOLD && (compctx->flags & COMP_F_ALLOW= _COMPRESS)) - { - const size_t ps =3D frame->buf.payload_size; - int zlen_max =3D ps + COMP_EXTRA_BUFFER(ps); - int zlen; - - ASSERT(buf_init(work, frame->buf.headroom)); - ASSERT(buf_safe(work, zlen_max)); - - if (buf->len > ps) - { - dmsg(D_COMP_ERRORS, "LZ4 compression buffer overflow"); - buf->len =3D 0; - return false; - } - - zlen =3D LZ4_compress_default((const char *)BPTR(buf), (char *)BPT= R(work), BLEN(buf), zlen_max); - - if (zlen <=3D 0) - { - dmsg(D_COMP_ERRORS, "LZ4 compression error"); - buf->len =3D 0; - return false; - } - - ASSERT(buf_safe(work, zlen)); - work->len =3D zlen; - - - dmsg(D_COMP, "LZ4 compress %d -> %d", buf->len, work->len); - compctx->pre_compress +=3D buf->len; - compctx->post_compress +=3D work->len; - return true; - } - return false; -} - - static void lz4_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx, const struct frame *frame) { - bool compressed; - if (buf->len <=3D 0) - { - return; - } - - compressed =3D do_lz4_compress(buf, &work, compctx, frame); - - /* On error do_lz4_compress sets buf len to zero, just return */ - if (buf->len =3D=3D 0) - { - return; - } - - /* did compression save us anything? */ - { - uint8_t comp_head_byte =3D NO_COMPRESS_BYTE_SWAP; - if (compressed && work.len < buf->len) - { - *buf =3D work; - comp_head_byte =3D LZ4_COMPRESS_BYTE; - } - - { - uint8_t *head =3D BPTR(buf); - uint8_t *tail =3D BEND(buf); - ASSERT(buf_safe(buf, 1)); - ++buf->len; - - /* move head byte of payload to tail */ - *tail =3D *head; - *head =3D comp_head_byte; - } - } -} - - -static void -lz4v2_compress(struct buffer *buf, struct buffer work, - struct compress_context *compctx, - const struct frame *frame) -{ - bool compressed; - if (buf->len <=3D 0) - { - return; - } - - compressed =3D do_lz4_compress(buf, &work, compctx, frame); - - /* On Error just return */ - if (buf->len =3D=3D 0) - { - return; - } - - /* did compression save us anything? Include 2 byte compression header - * in calculation */ - if (compressed && work.len + 2 < buf->len) - { - ASSERT(buf_prepend(&work, 2)); - uint8_t *head =3D BPTR(&work); - head[0] =3D COMP_ALGV2_INDICATOR_BYTE; - head[1] =3D COMP_ALGV2_LZ4_BYTE; - *buf =3D work; - } - else - { - compv2_escape_data_ifneeded(buf); - } } static void @@ -305,7 +187,7 @@ "lz4v2", lz4v2_compress_init, lz4_compress_uninit, - lz4v2_compress, + lz4_compress, lz4v2_decompress }; #endif /* ENABLE_LZ4 */ diff --git a/src/openvpn/comp.h b/src/openvpn/comp.h index 267f680b..decf0d9 100644 --- a/src/openvpn/comp.h +++ b/src/openvpn/comp.h @@ -33,7 +33,8 @@ /* Compression flags */ #define COMP_F_ADAPTIVE (1<<0) /* COMP_ALG_LZO only */ -#define COMP_F_ALLOW_COMPRESS (1<<1) /* not only downlink is compres= sed but also uplink */ +/*Removed */ +/*#define COMP_F_ALLOW_COMPRESS (1<<1) / * not only downlink is comp= ressed but also uplink * / */ #define COMP_F_SWAP (1<<2) /* initial command byte is swap= ped with last byte in buffer to preserve payload alignment */ #define COMP_F_ADVERTISE_STUBS_ONLY (1<<3) /* tell server that we only sup= port compression stubs */ #define COMP_F_ALLOW_STUB_ONLY (1<<4) /* Only accept stub compression= , even with COMP_F_ADVERTISE_STUBS_ONLY diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 7f0d53d..49f08d6 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -413,8 +413,7 @@ #if defined(USE_COMP) if (o->comp.alg !=3D COMP_ALG_UNDEF - || o->comp.flags & COMP_F_ALLOW_ASYM - || o->comp.flags & COMP_F_ALLOW_COMPRESS) + || o->comp.flags & COMP_F_ALLOW_ASYM) { msg(msglevel, "Note: '--allow-compression' is not set to 'no', dis= abling data channel offload."); diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c index bab2d78..a3cf3c1 100644 --- a/src/openvpn/lzo.c +++ b/src/openvpn/lzo.c @@ -39,54 +39,6 @@ #include "memdbg.h" -/** - * Perform adaptive compression housekeeping. - * - * @param ac the adaptive compression state structure. - * - * @return - */ -static bool -lzo_adaptive_compress_test(struct lzo_adaptive_compress *ac) -{ - const bool save =3D ac->compress_state; - const time_t local_now =3D now; - - if (!ac->compress_state) - { - if (local_now >=3D ac->next) - { - if (ac->n_total > AC_MIN_BYTES - && (ac->n_total - ac->n_comp) < (ac->n_total / (100 / AC_S= AVE_PCT))) - { - ac->compress_state =3D true; - ac->next =3D local_now + AC_OFF_SEC; - } - else - { - ac->next =3D local_now + AC_SAMP_SEC; - } - dmsg(D_COMP, "lzo_adaptive_compress_test: comp=3D%d total=3D%d= ", ac->n_comp, ac->n_total); - ac->n_total =3D ac->n_comp =3D 0; - } - } - else - { - if (local_now >=3D ac->next) - { - ac->next =3D local_now + AC_SAMP_SEC; - ac->n_total =3D ac->n_comp =3D 0; - ac->compress_state =3D false; - } - } - - if (ac->compress_state !=3D save) - { - dmsg(D_COMP_LOW, "Adaptive compression state %s", (ac->compress_st= ate ? "OFF" : "ON")); - } - - return !ac->compress_state; -} static inline void lzo_adaptive_compress_data(struct lzo_adaptive_compress *ac, int n_total, = int n_comp) @@ -118,92 +70,13 @@ compctx->wu.lzo.wmem =3D NULL; } -static inline bool -lzo_compression_enabled(struct compress_context *compctx) -{ - if (!(compctx->flags & COMP_F_ALLOW_COMPRESS)) - { - return false; - } - else - { - if (compctx->flags & COMP_F_ADAPTIVE) - { - return lzo_adaptive_compress_test(&compctx->wu.lzo.ac); - } - else - { - return true; - } - } -} - static void lzo_compress(struct buffer *buf, struct buffer work, struct compress_context *compctx, const struct frame *frame) { - lzo_uint zlen =3D 0; - int err; - bool compressed =3D false; - - if (buf->len <=3D 0) - { - return; - } - - /* - * In order to attempt compression, length must be at least COMPRESS_T= HRESHOLD, - * and our adaptive level must give the OK. - */ - if (buf->len >=3D COMPRESS_THRESHOLD && lzo_compression_enabled(compct= x)) - { - const size_t ps =3D frame->buf.payload_size; - ASSERT(buf_init(&work, frame->buf.headroom)); - ASSERT(buf_safe(&work, ps + COMP_EXTRA_BUFFER(ps))); - - if (buf->len > ps) - { - dmsg(D_COMP_ERRORS, "LZO compression buffer overflow"); - buf->len =3D 0; - return; - } - - err =3D LZO_COMPRESS(BPTR(buf), BLEN(buf), BPTR(&work), &zlen, com= pctx->wu.lzo.wmem); - if (err !=3D LZO_E_OK) - { - dmsg(D_COMP_ERRORS, "LZO compression error: %d", err); - buf->len =3D 0; - return; - } - - ASSERT(buf_safe(&work, zlen)); - work.len =3D zlen; - compressed =3D true; - - dmsg(D_COMP, "LZO compress %d -> %d", buf->len, work.len); - compctx->pre_compress +=3D buf->len; - compctx->post_compress +=3D work.len; - - /* tell adaptive level about our success or lack thereof in gettin= g any size reduction */ - if (compctx->flags & COMP_F_ADAPTIVE) - { - lzo_adaptive_compress_data(&compctx->wu.lzo.ac, buf->len, work= .len); - } - } - - /* did compression save us anything ? */ - if (compressed && work.len < buf->len) - { - uint8_t *header =3D buf_prepend(&work, 1); - *header =3D LZO_COMPRESS_BYTE; - *buf =3D work; - } - else - { - uint8_t *header =3D buf_prepend(buf, 1); - *header =3D NO_COMPRESS_BYTE; - } + uint8_t *header =3D buf_prepend(buf, 1); + *header =3D NO_COMPRESS_BYTE; } static void diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 649f48b..4745ddf 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -5715,17 +5715,10 @@ { if (comp_non_stub_enabled(info)) { - /* - * Check if already displayed the strong warning and enabled full - * compression - */ - if (!(info->flags & COMP_F_ALLOW_COMPRESS)) - { - msg(M_WARN, "WARNING: Compression for receiving enabled. " - "Compression has been used in the past to break encryption= . " - "Sent packets are not compressed unless \"allow-compressio= n yes\" " - "is also set."); - } + msg(M_WARN, "WARNING: Compression for receiving enabled. " + "Compression has been used in the past to break encryption. " + "Compression support is deprecated and we recommend to disable= " + "it completely."); } } @@ -8435,18 +8428,14 @@ } else if (streq(p[1], "asym")) { - options->comp.flags &=3D ~COMP_F_ALLOW_COMPRESS; options->comp.flags |=3D COMP_F_ALLOW_ASYM; } else if (streq(p[1], "yes")) { - msg(M_WARN, "WARNING: Compression for sending and receiving en= abled. Compression has " - "been used in the past to break encryption. Allowing compr= ession allows " - "attacks that break encryption. Using \"--allow-compressio= n yes\" is " - "strongly discouraged for common usage. See --compress in = the manual " - "page for more information "); + msg(M_WARN, "DEPRECATED OPTION: \"--allow-compression yes\" ha= s been removed. " + "We will use \"asym\" mode instead. See the manual page fo= r more information."); - options->comp.flags |=3D COMP_F_ALLOW_COMPRESS; + options->comp.flags |=3D COMP_F_ALLOW_ASYM; } else { -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/755?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I402ba016b75cfcfec4fc8b2b01cc4eca7e2bcc60 Gerrit-Change-Number: 755 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --hD143hGxLEU= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

Remove support for compression on send

We can't di= sable compression support on receive because
that would break too many c= onfigurations out there. But
we can remove the support for compressing o= utgoing traffic,
it was disabled by default anyway.

Makes --allow= -compression yes is an alias for
--allow-compression asym and removes al= l resulting dead code.

Change-Id: I402ba016b75cfcfec4fc8b2b01cc4eca7= e2bcc60
Signed-off-by: Frank Lichtenheld <frank@...2641...>
---=
M Changes.rst
M src/openvpn/comp-lz4.c
M src/openvpn/comp.h
M = src/openvpn/dco.c
M src/openvpn/lzo.c
M src/openvpn/options.c
6 fi= les changed, 19 insertions(+), 269 deletions(-)

git pull ssh://ge=
rrit.openvpn.net:29418/openvpn refs/changes/55/755/1
diff --git a/C=
hanges.rst b/Changes.rst
index 439352a..b9287ce 100644
--- a/Changes.rst
+++ b/Changes.rst
<= span>@@ -46,6 +46,12 @@

Support for building with Open= SSL 1.0.2 has been removed. The minimum
supported Open= SSL version is now 1.1.0.

+Compression on send
+ OpenVPN 2.7 will never compress data before sen= ding. Decompression of
+ ``--allow-compression yes`` is now an alias for
+ ``--allow-compress= ion asym``.
+<= br> Overview of changes in 2.6
=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=
diff --git a/src/openvpn/comp-lz4.c b/src/openvpn/comp-lz4= .c
index ac020a4..f9eee11 100644
--- a/src/= openvpn/comp-lz4.c
+++ b/src/openvpn/comp-lz4.c
<= span>@@ -55,129 +55,11 @@

{
}
<= span>
-static bool
-do_lz4_compress(struct bu= ffer *buf,
- = struct buffer *work,
- struct compress_context *compctx,
- const struct frame *frame)<= /span>
-{
- /*
- * In order to attempt compression, length must be at= least COMPRESS_THRESHOLD.
- * and asymmetric compression must be disabled
- */
- if (buf->len >=3D COMPRESS_THRESHOLD &&am= p; (compctx->flags & COMP_F_ALLOW_COMPRESS))
- {
- const size_t ps =3D frame->buf.payload_size;
- int zlen_max =3D = ps + COMP_EXTRA_BUFFER(ps);
- int zlen;
-
- ASSERT(buf_= init(work, frame->buf.headroom));
- ASSERT(buf_safe(work, zlen_max));
-
- if (buf->len > ps)
- {
- dmsg(D_COMP_ERRORS, "LZ4 compression buffer o= verflow");
- = buf->len =3D 0;
- }
-
- zlen =3D LZ4_compr= ess_default((const char *)BPTR(buf), (char *)BPTR(work), BLEN(buf), zlen_ma= x);
-
- if (zlen <=3D 0)
<= span style=3D"color: hsl(0, 100%, 40%);">- {

- dmsg(D_COMP_ERRORS, "LZ4 c= ompression error");
- return false;
- }
-
- ASSERT(bu= f_safe(work, zlen));
- = work->len =3D zlen;
-
-
- dmsg(D_COMP, "LZ4 com= press %d -> %d", buf->len, work->len);

- compctx->pre_compress +=3D buf-&= gt;len;
- compct= x->post_compress +=3D work->len;
- return true;
- }
-= return false;
-}
-
-
static void
lz4_compress(struct buffer *buf, struct buffer work,

= struct compress_context *compctx,
= const struct frame *frame)
{
- bool compressed;
- if (buf->len <=3D 0)
- {
- return;
- }
-
- compressed =3D do_lz4_= compress(buf, &work, compctx, frame);
-
- = /* On error do_lz4_compress sets buf len to zero, just return */<= br>- if (buf->len =3D=3D 0)=
- {
- return;

- }
-
- /= * did compression save us anything? */
- {
= - uint8_t comp_head_byte =3D NO_COMPRESS_BYTE_SWAP;
- if (compressed && work= .len < buf->len)
= - {
- = *buf =3D work;
- = comp_head_byte =3D LZ4_COMPRESS_BYTE;
- }
-
- {
- uint8_t *he= ad =3D BPTR(buf);
- = uint8_t *tail =3D BEND(buf);
- ASSERT(buf_safe(buf, 1));
- ++buf->len;
-
- /* move head byte of payload to tail */<= br>- *tail =3D *head;<= /span>
- *head =3D = comp_head_byte;
- = }
- }
-}

-
-=
-static void-lz4v2_compress(struct buffer *b= uf, struct buffer work,
- struct compress_context *compctx,
- const struct frame *frame)
-{
- bool compressed;
- if (buf->len <=3D 0)
- {
- return;
- }
-<= /span>
- compressed =3D do_= lz4_compress(buf, &work, compctx, frame);
-
- if (buf->len =3D=3D 0)
- {
- return;
- = }
-
- /* did compression save us anything= ? Include 2 byte compression header
- * in calculation */
- if (compressed && work.len + 2 < buf->l= en)
- {
- ASSERT(buf_prepend(&wo= rk, 2));

- uint8= _t *head =3D BPTR(&work);
- head[0] =3D COMP_ALGV2_INDICATOR_BYTE;
- head[1] =3D COMP_ALGV2_LZ4_BYTE;
- *buf =3D work;<= /span>
- }
- else
- {
- compv2_escape_data_ifneeded(buf);
- }
}

static void
@@ -305,7 +187,7 @@
"lz4v2",

lz4v2_compress_init,<= br> lz4_compress_uninit,
- lz4v2_compress,
+ lz4_compress,
lz4v2_decompress=
};
#endif /* ENABLE_LZ4 */
diff= --git a/src/openvpn/comp.h b/src/openvpn/comp.h
index 267f= 680b..decf0d9 100644
--- a/src/openvpn/comp.h
+++ b/src/openvpn/comp.h

@@ -33,7 +33,8 @@

/* Compression flags */
#define COMP= _F_ADAPTIVE (1<<0) /* COMP_ALG_LZO only */
-#define COMP_F_ALLOW_COMPRESS = (1<<1) /* not only downlink is compressed but also uplink */
+/*Removed */
+/*#define COMP_F_ALLOW_COMPRESS = (1<<1) / * not only downlink is compressed but also uplink * / */<= /span>
#define COMP_F_SWAP (1<<2) /* initia= l command byte is swapped with last byte in buffer to preserve payload alig= nment */
#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3) = /* tell server that we only support compression stubs */
#= define COMP_F_ALLOW_STUB_ONLY (1<<4) /* Only accept stub compres= sion, even with COMP_F_ADVERTISE_STUBS_ONLY
diff --git a/sr= c/openvpn/dco.c b/src/openvpn/dco.c
index 7f0d53d..49f08d6 = 100644
--- a/src/openvpn/dco.c
+++ b/src/op= envpn/dco.c
@@ -413,8 +413,7 @@
#if defined(USE_COMP)
if (o->comp.alg !=3D = COMP_ALG_UNDEF
- = || o->comp.flags & COMP_F_ALLOW_ASYM
- || o->comp.flags & COMP_F_ALLOW_COMPR= ESS)
+ || o-&g= t;comp.flags & COMP_F_ALLOW_ASYM)
{
msg(msglevel, "Note: '--allow-compression' is not s= et to 'no', disabling data channel offload.");


diff --git a/src/openvpn/lzo.c b/src/openvpn/lzo.c
index bab2d78..a3cf3c1 100644
--- a/src/openvpn/= lzo.c
+++ b/src/openvpn/lzo.c
@@ -39,54 +39= ,6 @@

#include "memdbg.h"

-/**
- * Perform adaptive compre= ssion housekeeping.
- *=
- * @param ac the adap= tive compression state structure.
- *
- * @ret= urn
- */
-static bool

-lzo_adaptive_compress_test(struct lzo_adaptive= _compress *ac)
-{
- const bool save =3D ac-= >compress_state;
- = const time_t local_now =3D now;
-
- if (!= ac->compress_state)
= - {
- if (loc= al_now >=3D ac->next)
- {
- = if (ac->n_total > AC_MIN_BYTES
- && (ac->n_total - ac->n_= comp) < (ac->n_total / (100 / AC_SAVE_PCT)))
- {
- ac->compress_state =3D true;=
- ac->next = =3D local_now + AC_OFF_SEC;
- }
- = else
- = {
- = ac->next =3D local_now + AC_SAMP_SEC;
- }
- dmsg(D_COMP, "lzo_adaptive_compress_test: comp= =3D%d total=3D%d", ac->n_comp, ac->n_total);
- ac->n_total =3D ac->n_c= omp =3D 0;
- }
- }
- else
- {
- if (local_now >=3D ac->next)
- {
- ac->next =3D local_now + AC_SAMP_SEC;=
- ac->n_total = =3D ac->n_comp =3D 0;
- }
- }
-
- if (ac->compress= _state !=3D save)
- = {
- dmsg(D_COMP_= LOW, "Adaptive compression state %s", (ac->compress_state ? &q= uot;OFF" : "ON"));
- }
-
- return !ac->compre= ss_state;
-}
=
static inline void
lzo_adaptive_c= ompress_data(struct lzo_adaptive_compress *ac, int n_total, int n_comp)
@@ -118,92 +70,13 @@
compctx->wu.lzo.w= mem =3D NULL;
}

-static inline bool
-lzo_compression_enabled(struct compress_context *= compctx)
-{
<= span style=3D"color: hsl(0, 100%, 40%);">- if (!(compctx->flags &= COMP_F_ALLOW_COMPRESS))

- retur= n false;
- }<= br>- else
- {
- if (compctx->flags & COMP_F_ADAPTIVE)
- {
- return lzo_adaptive_compres= s_test(&compctx->wu.lzo.ac);
- }
- else
- = {
- return = true;
- }=
- }
-}
-
static void
lzo_compress(str= uct buffer *buf, struct buffer work,
struct c= ompress_context *compctx,
const struct frame = *frame)
{
- lzo_uint zlen =3D 0;
- int err;
- = bool compressed =3D false;
-
- if (buf-&= gt;len <=3D 0)
- = {
- return;
- }
-
- /*
- = * In order to attempt compression, length must be at least COMPRESS_THRES= HOLD,
- * and our a= daptive level must give the OK.
- */
- = if (buf->len >=3D COMPRESS_THRESHOLD && lzo_compression_enabl= ed(compctx))
- {
- const size_t ps = =3D frame->buf.payload_size;
- ASSERT(buf_init(&work, frame->buf.headroom));
- ASSERT(buf_safe(&a= mp;work, ps + COMP_EXTRA_BUFFER(ps)));
-
- = if (buf->len > ps)
- {
- = dmsg(D_COMP_ERRORS, "LZO compression buffer overflow");
- buf->len = =3D 0;
- ret= urn;
- }<= br>-
- err =3D LZO_COMPRESS(BPTR(buf), BLEN(buf),= BPTR(&work), &zlen, compctx->wu.lzo.wmem);
- if (err !=3D LZO_E_OK)
<= span style=3D"color: hsl(0, 100%, 40%);">- {

- dmsg(D_COMP_ERRORS, "LZO c= ompression error: %d", err);
- buf->len =3D 0;
- return;
- }
-
- ASSERT= (buf_safe(&work, zlen));
- work.len =3D zlen;
- compressed =3D true;
-
- = dmsg(D_COMP, "LZO compress %d -> %d", buf->len, work.= len);
- compctx-= >pre_compress +=3D buf->len;
- compctx->post_compress +=3D work.len;
-

- /* tell adaptive level about our success or lack= thereof in getting any size reduction */
- if (compctx->flags & COMP_F_ADAPTIVE)
- {
- lzo_adaptive_compress_da= ta(&compctx->wu.lzo.ac, buf->len, work.len);

- }
- }
-
- /* did compr= ession save us anything ? */
- if (compressed && work.len < buf->len)
<= span style=3D"color: hsl(0, 100%, 40%);">- {

- uint8_t *header =3D buf_prepend(&work= , 1);
- *header = =3D LZO_COMPRESS_BYTE;
= - *buf =3D work;
- }
- else
- {
- uint8_t *header =3D buf_prepend(buf= , 1);
- *header = =3D NO_COMPRESS_BYTE;
-= }
+ uint8_t *h= eader =3D buf_prepend(buf, 1);
+ *header =3D NO_COMPRESS_BYTE;
}
<= span>

static void
diff --git a/src/openvp= n/options.c b/src/openvpn/options.c
index 649f48b..4745ddf = 100644
--- a/src/openvpn/options.c
+++ b/sr= c/openvpn/options.c
@@ -5715,17 +5715,10 @@
{

if (comp_non_stub_enabled(info))
= {
- /*
- * Check if already= displayed the strong warning and enabled full
- * compression
- */
- if (!(info->flags & COMP_F_ALLOW_COMPRESS))<= /span>
- {
- msg(M_WARN, "WARN= ING: Compression for receiving enabled. "

- "Compression has been used in= the past to break encryption. "
- "Sent packets are not compressed unles= s \"allow-compression yes\" "
- "is also set.");- }
+ msg(M_WARN, "WARNING: Compre= ssion for receiving enabled. "
+ "Compression has been used in the past to = break encryption. "
+ "Compression support is deprecated and we recommend t= o disable "
+ = "it completely.");
}
}


@@ -8435,18 +8428,14 @@
}

else if (streq(p[1], "asym&quo= t;))
{
- options->comp.flags &=3D ~COMP_F_ALLOW_COMPRES= S;
options->comp.flags |=3D COMP_F_ALLOW_AS= YM;
}
else if (streq(p[1]= , "yes"))
{
- msg(M_WARN, "WARNING: Compression= for sending and receiving enabled. Compression has "
- "been used in the= past to break encryption. Allowing compression allows "
- "attacks that = break encryption. Using \"--allow-compression yes\" is "
- "str= ongly discouraged for common usage. See --compress in the manual "
- "pag= e for more information ");
+ msg(M_WARN, "DEPRECATED OPTION: \"--allow= -compression yes\" has been removed. "
+ "We will use \"asym\= " mode instead. See the manual page for more information.");

- = options->comp.flags |=3D COMP_F_ALLOW_COMPRESS;
+ options->comp.flags |=3D = COMP_F_ALLOW_ASYM;
}
else=
{

To view, vi= sit chang= e 755. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I402ba016b75cfcfec4fc8b2b01c= c4eca7e2bcc60
Gerrit-Change-Number: 755
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--hD143hGxLEU=--