Skip to contentSkip to conversation

Remove support for snappy compression.

PATCH In review Gert Doering 2 participants 3 messages Oct 10, 2015 – Oct 11, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove support for snappy compression.

LZ4 is using less CPU at similar performance, and it is easier to build and support for binary installs (as it does not require C++ and a C++ runtime). Since it was never supported in any formally released OpenVPN version, just drop it again.

This leaves in the compression opcode for Snappy for documentation purposes.

trac #617

---
 configure.ac            |  48 ------------
 doc/openvpn.8           |   6 +-
 src/openvpn/Makefile.am |   3 -
 src/openvpn/comp.c      |  11 ---
 src/openvpn/comp.h      |  11 +--
 src/openvpn/init.c      |   6 +-
 src/openvpn/options.c   |  10 ---
 src/openvpn/snappy.c    | 189 ------------------------------------------------
 src/openvpn/snappy.h    |  39 ----------
 src/openvpn/syshead.h   |   2 +-
 10 files changed, 9 insertions(+), 316 deletions(-)
 delete mode 100644 src/openvpn/snappy.c
 delete mode 100644 src/openvpn/snappy.h
configure.ac +0 -48
index 2e651d8..77b4915 100644
@@ -66,12 +66,6 @@ AC_ARG_ENABLE(
 	[enable_lzo="yes"]
 )
 
-AC_ARG_ENABLE(snappy,
-	[  --disable-snappy        Disable Snappy compression support],
-	[enable_snappy="$enableval"],
-	[enable_snappy="yes"]
-)
-
 AC_ARG_ENABLE(lz4,
 	[  --disable-lz4           Disable LZ4 compression support],
 	[enable_lz4="$enableval"],
@@ -952,45 +946,6 @@ if test "${have_lzo}" = "yes"; then
 fi
 
 dnl
-dnl check for Snappy library
-dnl
-
-AC_ARG_VAR([SNAPPY_CFLAGS], [C compiler flags for snappy])
-AC_ARG_VAR([SNAPPY_LIBS], [linker flags for snappy])
-if test "$enable_snappy" = "yes" && test "$enable_comp_stub" = "no"; then
-    AC_CHECKING([for Snappy Library and Header files])
-    havesnappylib=1
-
-    # if SNAPPY_LIBS is set, we assume it will work, otherwise test
-    if test -z "${SNAPPY_LIBS}"; then
-	AC_CHECK_LIB(snappy, snappy_compress,
-	    [ SNAPPY_LIBS="-lsnappy" ],
-	    [
-	        AC_MSG_RESULT([Snappy library not found.])
-	        havesnappylib=0
-	    ])
-    fi
-
-    saved_CFLAGS="${CFLAGS}"
-    CFLAGS="${CFLAGS} ${SNAPPY_CFLAGS}"
-    AC_CHECK_HEADERS(snappy-c.h,
-       ,
-       [
-	   AC_MSG_RESULT([Snappy headers not found.])
-	   havesnappylib=0
-       ])
-
-    if test $havesnappylib = 0 ; then
-	AC_MSG_RESULT([Snappy library available from http://code.google.com/p/snappy/])
-        AC_MSG_ERROR([Or try ./configure --disable-snappy OR ./configure --enable-comp-stub])
-    fi
-    OPTIONAL_SNAPPY_CFLAGS="${SNAPPY_CFLAGS}"
-    OPTIONAL_SNAPPY_LIBS="${SNAPPY_LIBS}"
-    AC_DEFINE(ENABLE_SNAPPY, 1, [Enable Snappy compression library])
-    CFLAGS="${saved_CFLAGS}"
-fi
-
-dnl
 dnl check for LZ4 library
 dnl
 
@@ -1154,7 +1109,6 @@ if test "${enable_lzo}" = "yes"; then
 fi
 if test "${enable_comp_stub}" = "yes"; then
 	test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and lzo enabled (use --disable-lzo)])
-	test "${enable_snappy}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and snappy enabled (use --disable-snappy)])
 	test "${enable_lz4}" = "yes" && AC_MSG_ERROR([Cannot have both comp stub and LZ4 enabled (use --disable-lz4)])
 	AC_DEFINE([ENABLE_COMP_STUB], [1], [Enable compression stub capability])
 fi
@@ -1220,8 +1174,6 @@ AC_SUBST([OPTIONAL_CRYPTO_CFLAGS])
 AC_SUBST([OPTIONAL_CRYPTO_LIBS])
 AC_SUBST([OPTIONAL_LZO_CFLAGS])
 AC_SUBST([OPTIONAL_LZO_LIBS])
-AC_SUBST([OPTIONAL_SNAPPY_CFLAGS])
-AC_SUBST([OPTIONAL_SNAPPY_LIBS])
 AC_SUBST([OPTIONAL_LZ4_CFLAGS])
 AC_SUBST([OPTIONAL_LZ4_LIBS])
 AC_SUBST([OPTIONAL_SYSTEMD_LIBS])
doc/openvpn.8 +3 -3
index 829b09c..3a86409 100644
@@ -2495,9 +2495,9 @@ Enable a compression algorithm.
 
 The
 .B algorithm
-parameter may be "snappy", "lzo", "lz4", or empty.  Snappy, LZO and LZ4
-are different compression algorithms, with Snappy generally
-offering the best performance while LZ4 is faster with less CPU usage.
+parameter may be "lzo", "lz4", or empty.  LZO and LZ4
+are different compression algorithms, with LZ4 generally
+offering the best performance with least CPU usage.
 For backwards compatibility with OpenVPN versions before 2.4, use "lzo"
 (which is identical to the older option "\-\-comp\-lzo yes").
 
src/openvpn/Makefile.am +0 -3
index d089f50..c840f16 100644
@@ -26,7 +26,6 @@ AM_CFLAGS = \
 	$(TAP_CFLAGS) \
 	$(OPTIONAL_CRYPTO_CFLAGS) \
 	$(OPTIONAL_LZO_CFLAGS) \
-	$(OPTIONAL_SNAPPY_CFLAGS) \
 	$(OPTIONAL_LZ4_CFLAGS) \
 	$(OPTIONAL_PKCS11_HELPER_CFLAGS)
 if WIN32
@@ -102,7 +101,6 @@ openvpn_SOURCES = \
 	session_id.c session_id.h \
 	shaper.c shaper.h \
 	sig.c sig.h \
-	snappy.c snappy.h \
 	socket.c socket.h \
 	socks.c socks.h \
 	ssl.c ssl.h  ssl_backend.h \
@@ -121,7 +119,6 @@ openvpn_LDADD = \
 	$(top_builddir)/src/compat/libcompat.la \
 	$(SOCKETS_LIBS) \
 	$(OPTIONAL_LZO_LIBS) \
-	$(OPTIONAL_SNAPPY_LIBS) \
 	$(OPTIONAL_LZ4_LIBS) \
 	$(OPTIONAL_PKCS11_HELPER_LIBS) \
 	$(OPTIONAL_CRYPTO_LIBS) \
src/openvpn/comp.c +0 -11
index 4ac589f..706ad7e 100644
@@ -58,14 +58,6 @@ comp_init(const struct compress_options *opt)
       (*compctx->alg.compress_init)(compctx);
       break;
 #endif
-#ifdef ENABLE_SNAPPY
-    case COMP_ALG_SNAPPY:
-      ALLOC_OBJ_CLEAR (compctx, struct compress_context);
-      compctx->flags = opt->flags;
-      compctx->alg = snappy_alg;
-      (*compctx->alg.compress_init)(compctx);
-      break;
-#endif
 #ifdef ENABLE_LZ4
     case COMP_ALG_LZ4:
       ALLOC_OBJ_CLEAR (compctx, struct compress_context);
@@ -129,9 +121,6 @@ comp_generate_peer_info_string(const struct compress_options *opt, struct buffer
 #if defined(ENABLE_LZ4)
 	  buf_printf (out, "IV_LZ4=1\n");
 #endif
-#if defined(ENABLE_SNAPPY)
-	  buf_printf (out, "IV_SNAPPY=1\n");
-#endif
 #if defined(ENABLE_LZO)
 	  buf_printf (out, "IV_LZO=1\n");
 	  lzo_avail = true;
src/openvpn/comp.h +2 -9
index bfa25fd..716b1c0 100644
@@ -24,7 +24,7 @@
 
 /*
  * Generic compression support.  Currently we support
- * Snappy, LZO 2 and LZ4.
+ * LZO 2 and LZ4.
  */
 #ifndef OPENVPN_COMP_H
 #define OPENVPN_COMP_H
@@ -40,7 +40,7 @@
 #define COMP_ALG_UNDEF  0
 #define COMP_ALG_STUB   1 /* support compression command byte and framing without actual compression */
 #define COMP_ALG_LZO    2 /* LZO algorithm */
-#define COMP_ALG_SNAPPY 3 /* Snappy algorithm */
+#define COMP_ALG_SNAPPY 3 /* Snappy algorithm (no longer supported) */
 #define COMP_ALG_LZ4    4 /* LZ4 algorithm */
 
 /* Compression flags */
@@ -101,10 +101,6 @@ struct compress_alg
 #include "lzo.h"
 #endif
 
-#ifdef ENABLE_SNAPPY
-#include "snappy.h"
-#endif
-
 #ifdef ENABLE_LZ4
 #include "comp-lz4.h"
 #endif
@@ -127,9 +123,6 @@ union compress_workspace_union
 #ifdef ENABLE_LZO
   struct lzo_compress_workspace lzo;
 #endif
-#ifdef ENABLE_SNAPPY
-  struct snappy_workspace snappy;
-#endif
 #ifdef ENABLE_LZ4
   struct lz4_workspace lz4;
 #endif
src/openvpn/init.c +3 -3
index c32a809..5dd8781 100644
@@ -2379,11 +2379,11 @@ do_init_frame (struct context *c)
     {
       comp_add_to_extra_frame (&c->c2.frame);
 
-#if !defined(ENABLE_SNAPPY) && !defined(ENABLE_LZ4)
+#if !defined(ENABLE_LZ4)
       /*
        * Compression usage affects buffer alignment when non-swapped algs
        * such as LZO is used.
-       * Newer algs like Snappy and comp-stub with COMP_F_SWAP don't need
+       * Newer algs like LZ4 and comp-stub with COMP_F_SWAP don't need
        * any special alignment because of the control-byte swap approach.
        * LZO alignment (on the other hand) is problematic because
        * the presence of the control byte means that either the output of
@@ -2394,7 +2394,7 @@ do_init_frame (struct context *c)
        * dispatch if packet is uncompressed) at the cost of requiring
        * decryption output to be written to an unaligned buffer, so
        * it's more of a tradeoff than an optimal solution and we don't
-       * include it when we are doing a modern build with Snappy or LZ4.
+       * include it when we are doing a modern build with LZ4.
        * Strictly speaking, on the server it would be better to execute
        * this code for every connection after we decide the compression
        * method, but currently the frame code doesn't appear to be
src/openvpn/options.c +0 -10
index 7906f46..3c3d48c 100644
@@ -80,9 +80,6 @@ const char title_string[] =
 #ifdef ENABLE_LZO
   " [LZO]"
 #endif
-#ifdef ENABLE_SNAPPY
-  " [SNAPPY]"
-#endif
 #ifdef ENABLE_LZ4
   " [LZ4]"
 #endif
@@ -6293,13 +6290,6 @@ add_option (struct options *options,
 	      options->comp.flags = 0;
 	    }
 #endif
-#if defined(ENABLE_SNAPPY)
-	  else if (streq (p[1], "snappy"))
-	    {
-	      options->comp.alg = COMP_ALG_SNAPPY;
-	      options->comp.flags = COMP_F_SWAP;
-	    }
-#endif
 #if defined(ENABLE_LZ4)
 	  else if (streq (p[1], "lz4"))
 	    {
src/openvpn/snappy.c deleted +0 -189

189 lines not on this page · raw message

src/openvpn/snappy.h deleted +0 -39
deleted file mode 100644
index 361a631..0000000
@@ -1,39 +0,0 @@
-/*
- *  OpenVPN -- An application to securely tunnel IP networks
- *             over a single UDP port, with support for SSL/TLS-based
- *             session authentication and key exchange,
- *             packet encryption, packet authentication, and
- *             packet compression.
- *
- *  Copyright (C) 2002-2012 OpenVPN Technologies, Inc. <[email protected]...>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2
- *  as published by the Free Software Foundation.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program (see the file COPYING included with this
- *  distribution); if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef OPENVPN_SNAPPY_H
-#define OPENVPN_SNAPPY_H
-
-#if defined(ENABLE_SNAPPY)
-
-#include "buffer.h"
-
-extern const struct compress_alg snappy_alg;
-
-struct snappy_workspace
-{
-};
-
-#endif /* ENABLE_SNAPPY */
-#endif
src/openvpn/syshead.h +1 -1
index 3aa5c5f..7e77b6c 100644
@@ -710,7 +710,7 @@ socket_defined (const socket_descriptor_t sd)
 /*
  * Compression support
  */
-#if defined(ENABLE_SNAPPY) || defined(ENABLE_LZO) || defined(ENABLE_LZ4) || \
+#if defined(ENABLE_LZO) || defined(ENABLE_LZ4) || \
     defined(ENABLE_COMP_STUB)
 #define USE_COMP
 #endif
Signature · 1 line
2.5.3
#1 lore raw

Am 10.10.15 um 18:34 schrieb Gert Doering:

Quoted 9 lines

LZ4 is using less CPU at similar performance, and it is easier to build and support for binary installs (as it does not require C++ and a C++ runtime). Since it was never supported in any formally released OpenVPN version, just drop it again.

This leaves in the compression opcode for Snappy for documentation purposes.

trac #617

ACK from me. Snappy is probably not used outside from testscripts.

Arne