Its somewhat more complicated than this. The correct solution is to scale
the SSH window to a value that matches the window of the protocol
encapsulating the SSH data. Hard-coding window values into the binary
isn't a great idea. For any given protocol stack, the windows
should all match. Smaller ones will be bottlenecks, and larger ones
wasting space.

There also is a complication with just scaling the SSH window to a larger
size because of a small bug in the channel code that grows a buffer to
something larger than the buffer check allows. This really shouldn't
happen though, as SSH should be able to depend on the underlying TCP
buffer to hold data that it has not fetched yet.


Mike

On Mon, 28 Feb 2005, Markus Friedl wrote:

> On Mon, Feb 28, 2005 at 11:09:26AM -0500, Christopher Rapier wrote:
>> bandwidth = (MIN(tcp rwin, SSH2 FC buf))
>> ----------------------------
>> RTT
>>
>> Since the effective SSH2 flow control buffer is 64K (its actually
>> defined as 128K but only 1/2 of it is actually used) and most TCP

>
> well this can be changed.
>
> Index: channels.c
> ================================================== =================
> RCS file: /cvs/src/usr.bin/ssh/channels.c,v
> retrieving revision 1.211
> diff -u -r1.211 channels.c
> --- channels.c 29 Oct 2004 21:47:15 -0000 1.211
> +++ channels.c 27 Nov 2004 14:56:18 -0000
> @@ -1518,10 +1518,13 @@
> static int
> channel_check_window(Channel *c)
> {
> - if (c->type == SSH_CHANNEL_OPEN &&
> - !(c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD)) &&
> - c->local_window < c->local_window_max/2 &&
> - c->local_consumed > 0) {
> + if (c->type != SSH_CHANNEL_OPEN ||
> + c->flags & (CHAN_CLOSE_SENT|CHAN_CLOSE_RCVD) ||
> + c->local_consumed <= 0)
> + return 1;
> + if ((c->local_window_max - c->local_window <
> + 3 * CHAN_SES_PACKET_DEFAULT) ||
> + c->local_window < c->local_window_max/2) {
> packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
> packet_put_int(c->remote_id);
> packet_put_int(c->local_consumed);
> Index: channels.h
> ================================================== =================
> RCS file: /cvs/src/usr.bin/ssh/channels.h,v
> retrieving revision 1.75
> diff -u -r1.75 channels.h
> --- channels.h 29 Oct 2004 21:47:15 -0000 1.75
> +++ channels.h 27 Nov 2004 14:55:27 -0000
> @@ -118,7 +118,7 @@
>
> /* default window/packet sizes for tcp/x11-fwd-channel */
> #define CHAN_SES_PACKET_DEFAULT (32*1024)
> -#define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT)
> +#define CHAN_SES_WINDOW_DEFAULT (40*CHAN_SES_PACKET_DEFAULT)
> #define CHAN_TCP_PACKET_DEFAULT (32*1024)
> #define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT)
> #define CHAN_X11_PACKET_DEFAULT (16*1024)
>
> _______________________________________________
> openssh-unix-dev mailing list
> openssh-unix-dev@mindrot.org
> http://www.mindrot.org/mailman/listi...enssh-unix-dev
>
>


_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
http://www.mindrot.org/mailman/listi...enssh-unix-dev