aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2011-08-03 20:49:57 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-08-03 22:20:52 +0200
commita8111934d567aeee1973b6eddd6ee808192cdba8 (patch)
treed4d50e5af48a24f18250b8bc6cd33d75b452c803
parentf201e983b0a58bd7b216fafd656fcb1a482e3ea9 (diff)
downloadlibssh-a8111934d567aeee1973b6eddd6ee808192cdba8.tar.gz
libssh-a8111934d567aeee1973b6eddd6ee808192cdba8.tar.xz
libssh-a8111934d567aeee1973b6eddd6ee808192cdba8.zip
channels: Set the max packet size to 32768.
(cherry picked from commit 790b62bca59f46593711d17dd6c3058c7571a17c)
-rw-r--r--src/channels.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/channels.c b/src/channels.c
index 92c09ec5..aebf68d4 100644
--- a/src/channels.c
+++ b/src/channels.c
@@ -48,6 +48,14 @@
#define WINDOWBASE 128000
#define WINDOWLIMIT (WINDOWBASE/2)
+/*
+ * All implementations MUST be able to process packets with an
+ * uncompressed payload length of 32768 bytes or less and a total packet
+ * size of 35000 bytes or less.
+ */
+#define CHANNEL_MAX_PACKET 32768
+#define CHANNEL_INITIAL_WINDOW 64000
+
/**
* @defgroup libssh_channel The SSH channel functions
* @ingroup libssh
@@ -877,7 +885,11 @@ int ssh_channel_open_session(ssh_channel channel) {
}
#endif
- return channel_open(channel,"session",64000,32000,NULL);
+ return channel_open(channel,
+ "session",
+ CHANNEL_INITIAL_WINDOW,
+ CHANNEL_MAX_PACKET,
+ NULL);
}
/**
@@ -952,7 +964,11 @@ int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
goto error;
}
- rc = channel_open(channel, "direct-tcpip", 64000, 32000, payload);
+ rc = channel_open(channel,
+ "direct-tcpip",
+ CHANNEL_INITIAL_WINDOW,
+ CHANNEL_MAX_PACKET,
+ payload);
error:
ssh_buffer_free(payload);
@@ -2803,7 +2819,11 @@ int ssh_channel_open_reverse_forward(ssh_channel channel, const char *remotehost
goto error;
}
- rc = channel_open(channel, "forwarded-tcpip", 64000, 32000, payload);
+ rc = channel_open(channel,
+ "forwarded-tcpip",
+ CHANNEL_INITIAL_WINDOW,
+ CHANNEL_MAX_PACKET,
+ payload);
error:
ssh_buffer_free(payload);