From dbb181f466cc92961d016e8645903eeecb7f37b7 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Thu, 27 Jul 2017 15:06:17 +0200 Subject: [PATCH] Drop dependency on zlib. It's not used, since nothing in the code enables compression. If the application wants to use compression, it should perform this itself. --- configure.ac | 4 ---- src/net_packet.c | 35 ++--------------------------------- src/protocol_key.c | 3 ++- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/configure.ac b/configure.ac index 3a067381..ec530b24 100644 --- a/configure.ac +++ b/configure.ac @@ -132,10 +132,6 @@ AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo], AC_CACHE_SAVE -dnl These are defined in files in m4/ - -MeshLink_ZLIB - AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile m4/Makefile test/Makefile examples/Makefile]) AC_OUTPUT diff --git a/src/net_packet.c b/src/net_packet.c index 9fabffd7..03ecc945 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -196,42 +196,11 @@ static void mtu_probe_h(meshlink_handle_t *mesh, node_t *n, vpn_packet_t *packet } static uint16_t compress_packet(uint8_t *dest, const uint8_t *source, uint16_t len, int level) { - if(level == 0) { - memcpy(dest, source, len); - return len; - } else if(level == 10) - return -1; - else if(level < 10) { -#ifdef HAVE_ZLIB - unsigned long destlen = MAXSIZE; - if(compress2(dest, &destlen, source, len, level) == Z_OK) - return destlen; - else -#endif - return -1; - } else - return -1; - - return -1; + abort(); } static uint16_t uncompress_packet(uint8_t *dest, const uint8_t *source, uint16_t len, int level) { - if(level == 0) { - memcpy(dest, source, len); - return len; - } else if(level > 9) - return -1; -#ifdef HAVE_ZLIB - else { - unsigned long destlen = MAXSIZE; - if(uncompress(dest, &destlen, source, len) == Z_OK) - return destlen; - else - return -1; - } -#endif - - return -1; + abort(); } /* VPN packet I/O */ diff --git a/src/protocol_key.c b/src/protocol_key.c index ec2cde4a..ccaf9e28 100644 --- a/src/protocol_key.c +++ b/src/protocol_key.c @@ -304,7 +304,8 @@ bool ans_key_h(meshlink_handle_t *mesh, connection_t *c, const char *request) { /* Don't use key material until every check has passed. */ from->status.validkey = false; - if(compression < 0 || compression > 11) { + /* Compression is not supported. */ + if(compression != 0) { logger(mesh, MESHLINK_ERROR, "Node %s (%s) uses bogus compression level!", from->name, from->hostname); return true; } -- 2.39.2