diff options
author | Matt Johnston <matt@ucc.asn.au> | 2009-07-26 15:39:47 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2009-07-26 15:39:47 +0000 |
commit | 462544e04977e37ec83174b3d3e7277992c016c7 (patch) | |
tree | 36b52fa54440eccbf33fd146ad2ed390307b6eb9 | |
parent | 5a306fdf14fc58118e6d1d58135b38d22ca7d64e (diff) | |
download | dropbear-462544e04977e37ec83174b3d3e7277992c016c7.tar.gz |
- Add option to change zlib windowBits/memLevel
-rw-r--r-- | common-kex.c | 4 | ||||
-rw-r--r-- | options.h | 21 |
2 files changed, 24 insertions, 1 deletions
diff --git a/common-kex.c b/common-kex.c index 052324b..cb5cd96 100644 --- a/common-kex.c +++ b/common-kex.c @@ -371,7 +371,9 @@ static void gen_new_zstreams() { ses.newkeys->trans.zstream->zalloc = Z_NULL; ses.newkeys->trans.zstream->zfree = Z_NULL; - if (deflateInit(ses.newkeys->trans.zstream, Z_DEFAULT_COMPRESSION) + if (deflateInit2(ses.newkeys->trans.zstream, Z_DEFAULT_COMPRESSION, + Z_DEFLATED, DROPBEAR_ZLIB_WINDOW_BITS, + DROPBEAR_ZLIB_MEM_LEVEL, Z_DEFAULT_STRATEGY) != Z_OK) { dropbear_exit("zlib error"); } @@ -130,6 +130,21 @@ much traffic. */ * if the random number source isn't good. In general this isn't required */ /* #define DSS_PROTOK */ +/* Control the memory/performance/compression tradeoff for zlib. + * Set windowBits=8, memLevel=1 for least memory usage, see your system's + * zlib.h for full details. + * Default settings (windowBits=15, memLevel=8) will use + * 256kB for compression + 32kB for decompression. + * windowBits=8, memLevel=1 will use 10kB compression + 32kB decompression. + * Note that windowBits is only set for deflate() - inflate() always uses the + * default of 15 so as to interoperate with other clients. */ +#ifndef DROPBEAR_ZLIB_WINDOW_BITS +#define DROPBEAR_ZLIB_WINDOW_BITS 15 +#endif +#ifndef DROPBEAR_ZLIB_MEM_LEVEL +#define DROPBEAR_ZLIB_MEM_LEVEL 8 +#endif + /* Whether to do reverse DNS lookups. */ #define DO_HOST_LOOKUP @@ -248,13 +263,19 @@ much traffic. */ significant difference to network performance. 24kB was empirically chosen for a 100mbit ethernet network. The value can be altered at runtime with the -W argument. */ +#ifndef DEFAULT_RECV_WINDOW #define DEFAULT_RECV_WINDOW 24576 +#endif /* Maximum size of a received SSH data packet - this _MUST_ be >= 32768 in order to interoperate with other implementations */ +#ifndef RECV_MAX_PAYLOAD_LEN #define RECV_MAX_PAYLOAD_LEN 32768 +#endif /* Maximum size of a transmitted data packet - this can be any value, though increasing it may not make a significant difference. */ +#ifndef TRANS_MAX_PAYLOAD_LEN #define TRANS_MAX_PAYLOAD_LEN 16384 +#endif /* Ensure that data is transmitted every KEEPALIVE seconds. This can be overridden at runtime with -K. 0 disables keepalives */ |