[LZO="yes"]
)
+AC_ARG_ENABLE(lzo-stub,
+ [ --enable-lzo-stub Don't compile LZO compression support but still allow limited interoperability with LZO-enabled peers],
+ [LZO_STUB="$enableval"],
+ [LZO_STUB="no"]
+)
+
AC_ARG_ENABLE(crypto,
[ --disable-crypto Disable OpenSSL crypto support],
[CRYPTO="$enableval"],
dnl check for LZO library
dnl
-if test "$LZO" = "yes"; then
+if test "$LZO" = "yes" && test "$LZO_STUB" = "no"; then
LZO_H=""
AC_CHECKING([for LZO Library and Header files])
AC_CHECK_HEADER(lzo/lzo1x.h,
else
AC_MSG_RESULT([LZO headers were not found])
AC_MSG_RESULT([LZO library available from http://www.oberhumer.com/opensource/lzo/])
- AC_MSG_ERROR([Or try ./configure --disable-lzo])
+ AC_MSG_ERROR([Or try ./configure --disable-lzo OR ./configure --enable-lzo-stub])
fi
fi
+dnl enable multi-client mode
+if test "$LZO_STUB" = "yes"; then
+ AC_DEFINE(LZO_STUB, 1, [Enable LZO stub capability])
+fi
+
dnl
dnl check for OpenSSL-crypto library
dnl
#include "memdbg.h"
+#ifndef LZO_STUB
+
static bool
lzo_adaptive_compress_test (struct lzo_adaptive_compress *ac)
{
ac->n_comp += n_comp;
}
+#endif /* LZO_STUB */
+
void lzo_adjust_frame_parameters (struct frame *frame)
{
/* Leave room for our one-byte compressed/didn't-compress prefix byte. */
{
CLEAR (*lzowork);
- lzowork->wmem_size = LZO_WORKSPACE;
lzowork->flags = flags;
+#ifndef LZO_STUB
+ lzowork->wmem_size = LZO_WORKSPACE;
if (lzo_init () != LZO_E_OK)
msg (M_FATAL, "Cannot initialize LZO compression library");
lzowork->wmem = (lzo_voidp) lzo_malloc (lzowork->wmem_size);
check_malloc_return (lzowork->wmem);
msg (M_INFO, "LZO compression initialized");
+#else
+ msg (M_INFO, "LZO stub compression initialized");
+#endif
lzowork->defined = true;
}
if (lzowork)
{
ASSERT (lzowork->defined);
+#ifndef LZO_STUB
lzo_free (lzowork->wmem);
lzowork->wmem = NULL;
+#endif
lzowork->defined = false;
}
}
static inline bool
lzo_compression_enabled (struct lzo_compress_workspace *lzowork)
{
+#ifndef LZO_STUB
if ((lzowork->flags & (LZO_SELECTED|LZO_ON)) == (LZO_SELECTED|LZO_ON))
{
if (lzowork->flags & LZO_ADAPTIVE)
else
return true;
}
+#endif
return false;
}
struct lzo_compress_workspace *lzowork,
const struct frame* frame)
{
+#ifndef LZO_STUB
lzo_uint zlen = 0;
int err;
bool compressed = false;
+#endif
ASSERT (lzowork->defined);
if (buf->len <= 0)
return;
+#ifndef LZO_STUB
/*
* In order to attempt compression, length must be at least COMPRESS_THRESHOLD,
* and our adaptive level must give the OK.
*buf = work;
}
else
+#endif
{
uint8_t *header = buf_prepend (buf, 1);
*header = NO_COMPRESS;
struct lzo_compress_workspace *lzowork,
const struct frame* frame)
{
+#ifndef LZO_STUB
lzo_uint zlen = EXPANDED_SIZE (frame);
- uint8_t c; /* flag indicating whether or not our peer compressed */
int err;
+#endif
+ uint8_t c; /* flag indicating whether or not our peer compressed */
ASSERT (lzowork->defined);
if (c == YES_COMPRESS) /* packet was compressed */
{
+#ifndef LZO_STUB
ASSERT (buf_safe (&work, zlen));
err = LZO_DECOMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen,
lzowork->wmem);
lzowork->post_decompress += work.len;
*buf = work;
+#else
+ dmsg (D_COMP_ERRORS, "LZO decompression error: LZO capability not compiled");
+ buf->len = 0;
+ return;
+#endif
}
else if (c == NO_COMPRESS) /* packet was not compressed */
{
{
ASSERT (lzo_compwork->defined);
+#ifndef LZO_STUB
status_printf (so, "pre-compress bytes," counter_format, lzo_compwork->pre_compress);
status_printf (so, "post-compress bytes," counter_format, lzo_compwork->post_compress);
status_printf (so, "pre-decompress bytes," counter_format, lzo_compwork->pre_decompress);
status_printf (so, "post-decompress bytes," counter_format, lzo_compwork->post_decompress);
+#endif
}
#else
#ifdef USE_LZO
+#ifndef LZO_STUB
#ifdef LZO_HEADER_DIR
#include "lzo/lzoutil.h"
#include "lzo/lzo1x.h"
#include "lzoutil.h"
#include "lzo1x.h"
#endif
+#endif
#include "buffer.h"
#include "mtu.h"
#define LZO_ON (1<<1)
#define LZO_ADAPTIVE (1<<2)
+/*
+ * Length of prepended prefix on LZO packets
+ */
+#define LZO_PREFIX_LEN 1
+
+/*
+ * LZO 2.0 worst case size expansion
+ */
+#define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3)
+
+#ifndef LZO_STUB
+
/*
* Use LZO compress routine lzo1x_1_15_compress which is described
* as faster but needs a bit more memory than the standard routine.
#define LZO_WORKSPACE LZO1X_1_15_MEM_COMPRESS
#define LZO_DECOMPRESS lzo1x_decompress_safe
-#define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3) /* LZO 2.0 worst case size expansion. */
-
/*
* Don't try to compress any packet smaller than this.
*/
#define COMPRESS_THRESHOLD 100
-/*
- * Length of prepended prefix on LZO packets
- */
-#define LZO_PREFIX_LEN 1
-
/*
* Adaptive compress parameters
*/
int n_comp;
};
+#endif /* LZO_STUB */
+
/*
* Compress and Uncompress routines.
*/
struct lzo_compress_workspace
{
+ bool defined;
+ unsigned int flags;
+#ifndef LZO_STUB
lzo_voidp wmem;
int wmem_size;
struct lzo_adaptive_compress ac;
- unsigned int flags;
- bool defined;
/* statistics */
counter_type pre_decompress;
counter_type post_decompress;
counter_type pre_compress;
counter_type post_compress;
+#endif
};
void lzo_adjust_frame_parameters(struct frame *frame);
msg (msglevel, "this is a generic configuration and cannot directly be used");
goto err;
}
+#ifdef ENABLE_PUSH_PEER_INFO
+ else if (streq (p[1], "PUSH_PEER_INFO"))
+ {
+ options->push_peer_info = true;
+ }
+#endif
#if P2MP
else if (streq (p[1], "SERVER_POLL_TIMEOUT") && p[2])
{
buf_printf (&out, "IV_HWADDR=%s\n", format_hex_ex (macaddr, 6, 0, 1, ":", &gc));
}
+ /* push LZO status */
+#ifdef LZO_STUB
+ buf_printf (&out, "IV_LZO_STUB=1\n");
+#endif
+
/* push env vars that begin with UV_ */
for (e=es->list; e != NULL; e=e->next)
{
*/
#define ENABLE_CLIENT_NAT
+/*
+ * Support LZO as a stub in client? (LZO lib not included, but we
+ * we still support LZO protocol changes that allow us to
+ * communicate with an LZO-enabled server)
+ */
+#ifdef LZO_STUB
+#undef USE_LZO
+#undef LZO_VERSION_NUM
+#define USE_LZO 1
+#define LZO_VERSION_NUM "STUB"
+#endif
+
#endif
dnl define the OpenVPN version
-define(PRODUCT_VERSION,[2.1.3i])
+define(PRODUCT_VERSION,[2.1.3j])
dnl define the TAP version
define(PRODUCT_TAP_ID,[tap0901])
define(PRODUCT_TAP_WIN32_MIN_MAJOR,[9])