Subject: questions about the window size

From: Thomas Anderson <[email-masked]>
Date: Wed, 3 Sep 2014 00:40:50 -0500

Section 5.2 of RFC4254 says:

   The maximum amount of data allowed is determined by the maximum
   packet size for the channel, and the current window size, whichever
   is smaller.  The window size is decremented by the amount of data
   sent.  Both parties MAY ignore all extra data sent after the allowed
   window is empty.

This is the data transfer packet:

byte SSH_MSG_CHANNEL_DATA
uint32 recipient channel
string data

Since string's are defined by RFC4251 as being "stored as a uint32
containing its length (number of bytes that follow) and zero (= empty
string) or more bytes that are the value of the string" it's unclear
weather or not the uint32 length field contributes to the total or not. Any
ideas?

It is also unclear from this RFC whether or not
SSH_MSG_CHANNEL_EXTENDED_DATA should be decrementing from the window size
or not. Any insight would be appreciated - thanks!

---

From: [email-masked] (Niels Möller)
Date: Wed, 03 Sep 2014 08:46:36 +0200

> weather or not the uint32 length field contributes to the total or not. Any

In this context, it should be the amount of channel data, not including
the size of the string length field or any other ssh protocol headers.
(Unlike the somewhat related global maximum on SSH packet size).

> or not.

DATA and EXTENDED_DATA should be handled in the same way for flow
control. So yes, you should decrement the appropriate window size when
sending or receiving EXTENDED_DATA.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.