]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
build: properly process lzo-stub
authorAlon Bar-Lev <alon.barlev@gmail.com>
Wed, 29 Feb 2012 20:12:08 +0000 (22:12 +0200)
committerDavid Sommerseth <davids@redhat.com>
Thu, 22 Mar 2012 21:17:27 +0000 (22:17 +0100)
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Samuli Seppänen <samuli@openvpn.net>
Signed-off-by: David Sommerseth <davids@redhat.com>
configure.ac
src/openvpn/lzo.c
src/openvpn/lzo.h
src/openvpn/ssl.c
src/openvpn/syshead.h

index baa66b28e0f0def47fb5a5cdb1772c086b44a4cf..da415549e3a7681c9058a514e6b44af7e139f5c2 100644 (file)
@@ -701,11 +701,6 @@ if test "${enable_lzo}" = "yes" && test "${enable_lzo_stub}" = "no"; then
    fi
 fi
 
-dnl enable multi-client mode
-if test "${enable_lzo_stub}" = "yes"; then
-       AC_DEFINE([LZO_STUB], [1], [Enable LZO stub capability])
-fi
-
 PKG_CHECK_MODULES(
        [PKCS11_HELPER],
        [libpkcs11-helper-1 >= 1.02],
@@ -867,6 +862,13 @@ if test "${enable_selinux}" = "yes"; then
        AC_DEFINE([ENABLE_SELINUX], [1], [SELinux support])
 fi
 
+if test "${enable_lzo_stub}" = "yes"; then
+       test "${enable_lzo}" = "yes" && AC_MSG_ERROR([Cannot have both lzo stub and lzo enabled])
+       AC_DEFINE([ENABLE_LZO_STUB], [1], [Enable LZO stub capability])
+       AC_DEFINE([USE_LZO], [1], [Enable LZO compression library])
+       AC_DEFINE([LZO_VERSION_NUM], ["STUB"], [LZO version number])
+fi
+
 if test "${enable_pkcs11}" = "yes"; then
        test "${have_pkcs11_helper}" != "yes" && AC_MSG_ERROR([PKCS11 enabled but libpkcs11-helper is missing])
        test "${enable_ssl}" != "yes" && AC_MSG_ERROR([PKCS11 can be enabled only if SSL is enabled])
index 7e50fc93920fe1da0b751358964b165696bc2a81..ca06f714a98af7bacd739453e24b818e9bf57d71 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "memdbg.h"
 
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 /**
  * Perform adaptive compression housekeeping.
  *
@@ -91,7 +91,7 @@ lzo_adaptive_compress_data (struct lzo_adaptive_compress *ac, int n_total, int n
   ac->n_comp += n_comp;
 }
 
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
 
 void lzo_adjust_frame_parameters (struct frame *frame)
 {
@@ -109,7 +109,7 @@ lzo_compress_init (struct lzo_compress_workspace *lzowork, unsigned int flags)
   CLEAR (*lzowork);
 
   lzowork->flags = flags;
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   lzowork->wmem_size = LZO_WORKSPACE;
 
   if (lzo_init () != LZO_E_OK)
@@ -129,7 +129,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
   if (lzowork)
     {
       ASSERT (lzowork->defined);
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
       lzo_free (lzowork->wmem);
       lzowork->wmem = NULL;
 #endif
@@ -140,7 +140,7 @@ lzo_compress_uninit (struct lzo_compress_workspace *lzowork)
 static inline bool
 lzo_compression_enabled (struct lzo_compress_workspace *lzowork)
 {
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   if ((lzowork->flags & (LZO_SELECTED|LZO_ON)) == (LZO_SELECTED|LZO_ON))
     {
       if (lzowork->flags & LZO_ADAPTIVE)
@@ -157,7 +157,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
              struct lzo_compress_workspace *lzowork,
              const struct frame* frame)
 {
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   lzo_uint zlen = 0;
   int err;
   bool compressed = false;
@@ -168,7 +168,7 @@ lzo_compress (struct buffer *buf, struct buffer work,
   if (buf->len <= 0)
     return;
 
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   /*
    * In order to attempt compression, length must be at least COMPRESS_THRESHOLD,
    * and our adaptive level must give the OK.
@@ -226,7 +226,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
                struct lzo_compress_workspace *lzowork,
                const struct frame* frame)
 {
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   lzo_uint zlen = EXPANDED_SIZE (frame);
   int err;
 #endif
@@ -244,7 +244,7 @@ lzo_decompress (struct buffer *buf, struct buffer work,
 
   if (c == YES_COMPRESS)       /* packet was compressed */
     {
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
       ASSERT (buf_safe (&work, zlen));
       err = LZO_DECOMPRESS (BPTR (buf), BLEN (buf), BPTR (&work), &zlen,
                            lzowork->wmem);
@@ -291,7 +291,7 @@ void lzo_print_stats (const struct lzo_compress_workspace *lzo_compwork, struct
 {
   ASSERT (lzo_compwork->defined);
 
-#ifndef LZO_STUB
+#ifndef ENABLE_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);
index 5fb2a150ca2d8b300811188803db9d91aa301d15..da4bd8867b343e0e073b0fd04f4f0805d62fb092 100644 (file)
@@ -39,7 +39,7 @@
  * @{
  */
 
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 #ifdef LZO_HEADER_DIR
 #include "lzo/lzoutil.h"
 #include "lzo/lzo1x.h"
@@ -68,7 +68,7 @@
 
 /**************************************************************************/
 /** @name LZO library interface defines *//** @{ *//***********************/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 #define LZO_COMPRESS    lzo1x_1_15_compress
                                 /**< LZO library compression function.
                                  *
@@ -90,7 +90,7 @@
                                  *   verify the integrity of incoming
                                  *   packets, you might want to consider
                                  *   using the non-safe version. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
 /** @} name LZO library interface *//**************************************/
 
 
 /** @name Miscellaneous compression defines *//** @{ *//*******************/
 #define LZO_EXTRA_BUFFER(len) ((len)/8 + 128 + 3)
                                 /**< LZO 2.0 worst-case size expansion. */
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 #define COMPRESS_THRESHOLD 100  /**< Minimum packet size to attempt
                                  *   compression. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
 /** @} name Miscellaneous compression defines *//**************************/
 
 
 
 /**************************************************************************/
 /** @name Adaptive compression defines *//** @{ *//************************/
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 #define AC_SAMP_SEC    2        /**< Number of seconds in a sample period. */
 #define AC_MIN_BYTES   1000     /**< Minimum number of bytes a sample
                                  *   period must contain for it to be
                                  *   turned off. */
 #define AC_OFF_SEC     60       /**< Seconds to wait after compression has
                                  *   been turned off before retesting. */
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
 /** @} name Adaptive compression defines *//*******************************/
 
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
 
 /**
  * Adaptive compression state.
@@ -144,7 +144,7 @@ struct lzo_adaptive_compress {
   int n_comp;
 };
 
-#endif /* LZO_STUB */
+#endif /* ENABLE_LZO_STUB */
 
 
 /**
@@ -161,7 +161,7 @@ struct lzo_compress_workspace
 {
   bool defined;
   unsigned int flags;
-#ifndef LZO_STUB
+#ifndef ENABLE_LZO_STUB
   lzo_voidp wmem;
   int wmem_size;
   struct lzo_adaptive_compress ac;
index e260718ac7d0af86b1dab9f1fa6a4f80117f53a0..ba06ff70c72ac69754884cd1478ba7adb086c25a 100644 (file)
@@ -1652,7 +1652,7 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
       }
 
       /* push LZO status */
-#ifdef LZO_STUB
+#ifdef ENABLE_LZO_STUB
       buf_printf (&out, "IV_LZO_STUB=1\n");
 #endif
 
index 53b758046f9437628cfeeb32637a874557814603..bfdf148c06d5506f91ac978276cc2d34f9b78e2b 100644 (file)
@@ -699,18 +699,6 @@ socket_defined (const socket_descriptor_t sd)
  */
 #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
-
 /*
  * Enable --memstats option
  */