0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

Added NO_LZO preprocessor flag to disable inclusion of all LZO

functionality (including LZO-Asym) except for LZO stub:

NO_LZO   -- disable all LZO functionality except for stub
HAVE_LZO -- use LZO library for compression/decompression
default  -- use LZO-Asym decompressor (no compression)

Added init_process call to start of test/ovpncli/cli.cpp
This commit is contained in:
James Yonan 2012-09-11 08:45:27 +00:00
parent 930630ee15
commit 1ba895a6a0
3 changed files with 31 additions and 2 deletions

View File

@ -93,7 +93,9 @@ namespace openvpn {
#include <openvpn/compress/compnull.hpp>
#include <openvpn/compress/compstub.hpp>
#ifndef NO_LZO
#include <openvpn/compress/lzoselect.hpp>
#endif
#ifdef HAVE_LZ4
#include <openvpn/compress/lz4.hpp>
#endif
@ -143,10 +145,12 @@ namespace openvpn {
return new CompressStub(frame, stats, false);
case COMP_STUB:
return new CompressStub(frame, stats, true);
#ifndef NO_LZO
case LZO:
return new CompressLZO(frame, stats, false, asym_);
case LZO_SWAP:
return new CompressLZO(frame, stats, true, asym_);
#endif
#ifdef HAVE_LZ4
case LZ4:
return new CompressLZ4(frame, stats, asym_);
@ -172,7 +176,11 @@ namespace openvpn {
return true;
case LZO:
case LZO_SWAP:
#ifndef NO_LZO
return true;
#else
return false;
#endif
case LZ4:
#ifdef HAVE_LZ4
return true;
@ -195,10 +203,12 @@ namespace openvpn {
{
switch (type_)
{
#ifndef NO_LZO
case LZO:
return "IV_LZO=1\n";
case LZO_SWAP:
return "IV_LZO_SWAP=1\n";
#endif
#ifdef HAVE_LZ4
case LZ4:
return "IV_LZ4=1\n";
@ -216,8 +226,12 @@ namespace openvpn {
#ifdef HAVE_SNAPPY
"IV_SNAPPY=1\n"
#endif
#ifndef NO_LZO
"IV_LZO=1\n"
"IV_LZO_SWAP=1\n"
#else
"IV_LZO_STUB=1\n"
#endif
#ifdef HAVE_LZ4
"IV_LZ4=1\n"
#endif
@ -225,8 +239,12 @@ namespace openvpn {
;
case ANY_LZO:
return
#ifndef NO_LZO
"IV_LZO=1\n"
"IV_LZO_SWAP=1\n"
#else
"IV_LZO_STUB=1\n"
#endif
;
default:
return NULL;
@ -296,7 +314,9 @@ namespace openvpn {
static void init_static()
{
#ifndef NO_LZO
CompressLZO::init_static();
#endif
}
private:

View File

@ -8,7 +8,9 @@
#ifndef OPENVPN_COMPRESS_COMPSTUB_H
#define OPENVPN_COMPRESS_COMPSTUB_H
#ifndef NO_LZO
#include <openvpn/compress/lzoselect.hpp>
#endif
namespace openvpn {
@ -17,8 +19,10 @@ namespace openvpn {
public:
CompressStub(const Frame::Ptr& frame, const SessionStats::Ptr& stats, const bool support_swap_arg)
: Compress(frame, stats),
support_swap(support_swap_arg),
lzo(frame, stats, false, true)
support_swap(support_swap_arg)
#ifndef NO_LZO
,lzo(frame, stats, false, true)
#endif
{
}
@ -50,6 +54,7 @@ namespace openvpn {
do_unswap(buf);
case NO_COMPRESS:
break;
#ifndef NO_LZO
// special mode to support older servers that ignore
// compression handshake -- this will handle receiving
// compressed packets even if we didn't ask for them
@ -57,6 +62,7 @@ namespace openvpn {
OPENVPN_LOG_COMPRESS_VERBOSE("CompressStub: handled unsolicited LZO packet");
lzo.decompress_work(buf);
break;
#endif
default:
OPENVPN_LOG_COMPRESS_VERBOSE("CompressStub: unable to handle op=" << int(c));
error(buf);
@ -65,7 +71,9 @@ namespace openvpn {
private:
const bool support_swap;
#ifndef NO_LZO
CompressLZO lzo;
#endif
};
} // namespace openvpn

View File

@ -106,6 +106,7 @@ int main(int argc, char *argv[])
try {
if (argc >= 2)
{
Client::init_process();
Client client;
Config config;
config.content = read_text(argv[1]);