DynamicWindow Patch
Markus Friedl
markus at openbsd.org
Thu Jul 8 07:44:31 EST 2004
On Wed, Jul 07, 2004 at 02:51:53PM -0400, Michael Stevens wrote:
> We have developed a patch that enables changing the SSH window size
> using the tcp window size as the source. This allows SSH to obtain
> maximum use of the bandwidth on high BDP links.
>
> We also have a page that describes the changes and performance.
> http://www.psc.edu/~rapier/hpn-ssh/
>
> The patch against CVS is included here.
> - if (len > 0x100000)
> + if (!buffer->unlimited && len > 0x100000)
> fatal("buffer_append_space: len %u not supported", len);
that's dangerous, is it really necessary? we could
crank the 0x100000.
> + u_int32_t tcpwinsz = 0;
> + socklen_t optsz = sizeof(tcpwinsz);
> + int ret = -1;
> + u_int32_t addition = 0;
> + if (c->dynamic_window)
> + ret = getsockopt(packet_get_connection_in(),
> + SOL_SOCKET, SO_RCVBUF, &tcpwinsz, &optsz);
> + if (c->dynamic_window && (ret == 0) &&
> + (tcpwinsz > c->local_window_max)) {
> + addition = 2 * tcpwinsz - c->local_window_max;
> + c->local_window_max += addition;
> + }
why do you need to do this here? why not just announce a bigger
window when the channel is created?
does SO_RCVBUF change during the session? otherwise we could do
this instead. but i agree, we should really improve the WINDOW_ADJUST
handling.
Index: ssh.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/ssh.c,v
retrieving revision 1.222
diff -u -r1.222 ssh.c
--- ssh.c 23 Jun 2004 14:31:01 -0000 1.222
+++ ssh.c 7 Jul 2004 21:21:53 -0000
@@ -1096,6 +1096,8 @@
{
Channel *c;
int window, packetmax, in, out, err;
+ u_int32_t tcpwinsz = 0;
+ socklen_t optsz = sizeof(tcpwinsz);
if (stdin_null_flag) {
in = open(_PATH_DEVNULL, O_RDONLY);
@@ -1122,6 +1124,10 @@
window >>= 1;
packetmax >>= 1;
}
+ if (getsockopt(packet_get_connection_in(),SOL_SOCKET, SO_RCVBUF,
+ &tcpwinsz, &optsz) == 0)
+ window = 2 * tcpwinsz;
+
c = channel_new(
"session", SSH_CHANNEL_OPENING, in, out, err,
window, packetmax, CHAN_EXTENDED_WRITE,
More information about the openssh-unix-dev
mailing list