38struct compress_context *
41 const struct compress_alg *alg;
49 alg = &compv2_stub_alg;
71 struct compress_context *compctx;
73 compctx->flags = opt->
flags;
75 (*compctx->alg.compress_init)(compctx);
84compv2_escape_data_ifneeded(
struct buffer *buf)
86 uint8_t *head =
BPTR(buf);
87 if (head[0] != COMP_ALGV2_INDICATOR_BYTE)
96 head[0] = COMP_ALGV2_INDICATOR_BYTE;
97 head[1] = COMP_ALGV2_UNCOMPRESSED_BYTE;
102comp_uninit(
struct compress_context *compctx)
106 (*compctx->alg.compress_uninit)(compctx);
112comp_print_stats(
const struct compress_context *compctx,
struct status_output *so)
134 bool lzo_avail =
false;
137#if defined(ENABLE_LZ4)
141#if defined(ENABLE_LZO)
167 msg(msglevel,
"Compression or compression stub framing is not allowed "
168 "since data-channel offloading is enabled.");
170 msg(msglevel,
"Compression or compression stub framing is not allowed "
171 "since OpenVPN was built without compression support.");
178 msg(msglevel,
"Compression is not allowed since allow-compression is "
179 "set to 'stub-only'");
185 msg(msglevel,
"OpenVPN is compiled without LZ4 support. Requested "
186 "compression cannot be enabled.");
193 msg(msglevel,
"OpenVPN is compiled without LZO support. Requested "
194 "compression cannot be enabled.");
bool buf_printf(struct buffer *buf, const char *format,...)
printf-style append to a buffer with overflow check.
#define BPTR(buf)
Return a pointer to the start of the buffer content.
static uint8_t * buf_prepend(struct buffer *buf, ssize_t size)
Make space at the front of a buffer for prepending data.
#define ALLOC_OBJ_CLEAR(dptr, type)
Allocate and zero-initialise memory for a single object of the given type.
bool check_compression_settings_valid(const struct compress_options *info, msglvl_t msglevel)
Checks if the compression settings are valid.
#define COMP_F_ALLOW_STUB_ONLY
Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY we still accept other compression...
#define COMP_ALG_LZ4
LZ4 algorithm.
#define COMP_F_ALLOW_NOCOMP_ONLY
Do not allow compression framing (breaks DCO)
#define COMP_ALGV2_UNCOMPRESSED
#define COMP_ALG_STUB
support compression command byte and framing without actual compression
#define COMP_ALG_LZO
LZO algorithm.
#define COMP_F_ADVERTISE_STUBS_ONLY
tell server that we only support compression stubs
static bool comp_non_stub_enabled(const struct compress_options *info)
void status_printf(struct status_output *so, const char *format,...)
Wrapper structure for dynamically allocated memory.