Remove unused code when --disable-compression is set.

Resolves: #291

Singed-off-by: Alan Jowett <alanjo@microsoft.com>
This commit is contained in:
Alan Jowett
2020-04-25 15:53:31 -06:00
parent df5ea8bd3d
commit 7e5052782e
5 changed files with 12 additions and 4 deletions

View File

@@ -275,14 +275,13 @@ minimal:
- tests/*.log
# Build a minimal version with every optional feature disable
# --disable-compression currently not supported due to issue #291
Ubuntu18.04-minimal:
stage: testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$UBUNTU18_BUILD
script:
- git submodule update --init
- autoreconf -fvi
- ./configure --without-protobuf --without-root-tests --without-docker-tests --without-nuttcp-tests --without-libtalloc-prefix --without-libnl --without-maxmind --without-geoip --without-libreadline-prefix --without-liboath --without-libc-prefix --without-pam --without-radius --without-libcrypt-prefix --without-utmp --without-libutil-prefix --without-libwrap --without-libwrap-prefix --without-libseccomp-prefix --without-libsystemd-prefix --without-http-parser --without-lz4 --without-gssapi --without-pcl-lib --disable-rpath --disable-seccomp --disable-anyconnect-compat
- ./configure --without-protobuf --without-root-tests --without-docker-tests --without-nuttcp-tests --without-libtalloc-prefix --without-libnl --without-maxmind --without-geoip --without-libreadline-prefix --without-liboath --without-libc-prefix --without-pam --without-radius --without-libcrypt-prefix --without-utmp --without-libutil-prefix --without-libwrap --without-libwrap-prefix --without-libseccomp-prefix --without-libsystemd-prefix --without-http-parser --without-lz4 --without-gssapi --without-pcl-lib --disable-rpath --disable-seccomp --disable-anyconnect-compat --disable-compression
- make -j$JOBS
- make check -j$JOBS
tags:

View File

@@ -498,7 +498,9 @@ static void apply_default_conf(vhost_cfg_st *vhost, unsigned reload)
}
vhost->perm_config.config->mobile_idle_timeout = (unsigned)-1;
#ifdef ENABLE_COMPRESSION
vhost->perm_config.config->no_compress_limit = DEFAULT_NO_COMPRESS_LIMIT;
#endif
vhost->perm_config.config->rekey_time = 24*60*60;
vhost->perm_config.config->cookie_timeout = DEFAULT_COOKIE_RECON_TIMEOUT;
vhost->perm_config.config->auth_timeout = DEFAULT_AUTH_TIMEOUT_SECS;
@@ -869,6 +871,7 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
READ_TF(config->dtls_psk);
} else if (strcmp(name, "match-tls-dtls-ciphers") == 0) {
READ_TF(config->match_dtls_and_tls);
#ifdef ENABLE_COMPRESSION
} else if (strcmp(name, "compression") == 0) {
READ_TF(config->enable_compression);
} else if (strcmp(name, "compression-algo-priority") == 0) {
@@ -879,6 +882,7 @@ static int cfg_ini_handler(void *_ctx, const char *section, const char *name, co
}
} else if (strcmp(name, "no-compress-limit") == 0) {
READ_NUMERIC(config->no_compress_limit);
#endif
} else if (strcmp(name, "use-seccomp") == 0) {
READ_TF(config->isolate);
if (config->isolate)
@@ -1334,8 +1338,10 @@ static void check_cfg(vhost_cfg_st *vhost, vhost_cfg_st *defvhost, unsigned sile
if (config->mobile_idle_timeout == (unsigned)-1)
config->mobile_idle_timeout = config->idle_timeout;
#ifdef ENABLE_COMPRESSION
if (config->no_compress_limit < MIN_NO_COMPRESS_LIMIT)
config->no_compress_limit = MIN_NO_COMPRESS_LIMIT;
#endif
/* use tcp listen host by default */
if (vhost->perm_config.udp_listen_host == NULL) {

View File

@@ -237,9 +237,10 @@ struct cfg_st {
gnutls_certificate_request_t cert_req;
char *priorities;
#ifdef ENABLE_COMPRESSION
unsigned enable_compression;
unsigned no_compress_limit; /* under this size (in bytes) of data there will be no compression */
#endif
char *banner;
char *ocsp_response; /* file with the OCSP response */
char *default_domain; /* domain to be advertised */

View File

@@ -207,7 +207,6 @@ struct compression_method_st comp_methods[] = {
.server_prio = 80,
}
};
#endif
unsigned switch_comp_priority(void *pool, const char *modstring)
{
@@ -249,6 +248,7 @@ unsigned switch_comp_priority(void *pool, const char *modstring)
talloc_free(str);
return ret;
}
#endif
static
void header_value_check(struct worker_st *ws, struct http_req_st *req)

View File

@@ -1558,6 +1558,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
ws->udp_state = UP_INACTIVE;
}
#ifdef ENABLE_COMPRESSION
if (ws->udp_state == UP_ACTIVE && ws->dtls_selected_comp != NULL && l > WSCONFIG(ws)->no_compress_limit) {
/* otherwise don't compress */
ret = ws->dtls_selected_comp->compress(ws->decomp+8, sizeof(ws->decomp)-8, ws->buffer+8, l);
@@ -1585,6 +1586,7 @@ static int tun_mainloop(struct worker_st *ws, struct timespec *tnow)
cstp_type = AC_PKT_COMPRESSED;
}
}
#endif
/* only transmit if allowed */
if (bandwidth_update(&ws->b_tx, dtls_to_send.size, tnow)