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 20:49:57 +0200
commit790b62bca59f46593711d17dd6c3058c7571a17c (patch)
treec2289090d34edc7d3a9d231904d40559169759fb
parentca47c9b46eebf19189e5bed19aacc1f278bfbf68 (diff)
downloadlibssh-790b62bca59f46593711d17dd6c3058c7571a17c.tar.gz
libssh-790b62bca59f46593711d17dd6c3058c7571a17c.tar.xz
libssh-790b62bca59f46593711d17dd6c3058c7571a17c.zip
channels: Set the max packet size to 32768.
-rw-r--r--src/channels.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/channels.c b/src/channels.c
index 221f525d..ef140ba2 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
@@ -885,7 +893,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);
}
/**
@@ -960,7 +972,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);
@@ -2935,7 +2951,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);
@@ -2998,7 +3018,11 @@ int ssh_channel_open_x11(ssh_channel channel,
goto error;
}
- rc = channel_open(channel, "x11", 64000, 32000, payload);
+ rc = channel_open(channel,
+ "x11",
+ CHANNEL_INITIAL_WINDOW,
+ CHANNEL_MAX_PACKET,
+ payload);
error:
ssh_buffer_free(payload);