Computing window sizes and adjustments

Damien Miller djm at mindrot.org
Tue Jul 17 19:22:01 EST 2007


On Tue, 17 Jul 2007, JCA wrote:

> On 7/16/07, Damien Miller <djm at mindrot.org> wrote:
> 
> > OpenSSH counts the data sent over a channel against the window, not
> > including the protocol-level framing used to send it.
> 
>   Thanks for the feedback. Let me see if I can pin things down.
> 
>   The structure of an SSHv2 packet is laid down in section 6 of RFC 4253:
> 
>      uint32    packet_length
>      byte      padding_length
>      byte[n1]  payload; n1 = packet_length - padding_length - 1
>      byte[n2]  random padding; n2 = padding_length
>      byte[m]   mac (Message Authentication Code - MAC); m = mac_length

This isn't included

> If I understand you correctly, the only field that is to be taken into
> account when adjusting the window size is the payload. Now only two
> packet types, namely, SSH_MSG_CHANNEL_DATA and
> SSH_MSG_CHANNEL_DATA_EXTENDED, consume window space. The structures of
> these packets are
> 
>      byte      SSH_MSG_CHANNEL_DATA
>      uint32    recipient channel

This isn't included

>      string    data

This is

> and
> 
>      byte      SSH_MSG_CHANNEL_EXTENDED_DATA
>      uint32    recipient channel
>      uint32    data_type_code

This isn't included
>      string    data

This is

You can see the exact calculations by grepping for "window" in channels.c

-d


More information about the openssh-unix-dev mailing list