diff options
author | Gert Doering <gert@greenie.muc.de> | 2014-01-01 22:57:58 +0100 |
---|---|---|
committer | Gert Doering <gert@greenie.muc.de> | 2014-01-06 12:18:53 +0100 |
commit | 40efb6359aff0e4805c0439acd6e899c687ef058 (patch) | |
tree | ff119c7a017fa18f939f76e0f2577ef9a94f8d1d /src/openvpn/comp.c | |
parent | 56ab21091c0f1e07d0a6ef7815160f6ae072498d (diff) | |
download | openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.gz openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.tar.xz openvpn-40efb6359aff0e4805c0439acd6e899c687ef058.zip |
Implement LZ4 compression.
Implement LZ4 compression, similar to the existing snappy / push-peer-info
model: a LZ4 capable client will send IV_LZ4=1 to the server, and the
algorithm is selected by pushing "compress lz4" back.
LZ4 does not compress as well as LZO or Snappy, but needs far less CPU
and is much faster, thus better suited for mobile devices. See
https://code.google.com/p/lz4/ for more details.
LZ4 include and library path can be specified by specifying LZ4_LIBS=...
and LZ4_CFLAGS=... on the configure command line.
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1388613479-22377-1-git-send-email-gert@greenie.muc.de>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8153
Diffstat (limited to 'src/openvpn/comp.c')
-rw-r--r-- | src/openvpn/comp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/openvpn/comp.c b/src/openvpn/comp.c index 9692257..4ac589f 100644 --- a/src/openvpn/comp.c +++ b/src/openvpn/comp.c @@ -66,6 +66,14 @@ comp_init(const struct compress_options *opt) (*compctx->alg.compress_init)(compctx); break; #endif +#ifdef ENABLE_LZ4 + case COMP_ALG_LZ4: + ALLOC_OBJ_CLEAR (compctx, struct compress_context); + compctx->flags = opt->flags; + compctx->alg = lz4_alg; + (*compctx->alg.compress_init)(compctx); + break; +#endif } return compctx; } @@ -118,6 +126,9 @@ comp_generate_peer_info_string(const struct compress_options *opt, struct buffer bool lzo_avail = false; if (!(opt->flags & COMP_F_ADVERTISE_STUBS_ONLY)) { +#if defined(ENABLE_LZ4) + buf_printf (out, "IV_LZ4=1\n"); +#endif #if defined(ENABLE_SNAPPY) buf_printf (out, "IV_SNAPPY=1\n"); #endif |