Re: questions about the window size

nisse@lysator.liu.se (Niels Möller ) Wed, 03 September 2014 06:46 UTC

Return-Path: <bounces-ietf-ssh-owner-secsh-tyoxbijeg7-archive=lists.ietf.org@NetBSD.org>
X-Original-To: ietfarch-secsh-tyoxbijeg7-archive@ietfa.amsl.com
Delivered-To: ietfarch-secsh-tyoxbijeg7-archive@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 56BDF1A702C for <ietfarch-secsh-tyoxbijeg7-archive@ietfa.amsl.com>; Tue, 2 Sep 2014 23:46:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.268
X-Spam-Level:
X-Spam-Status: No, score=-2.268 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, MIME_8BIT_HEADER=0.3, RP_MATCHES_RCVD=-0.668] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E5Fmw5iJmnMC for <ietfarch-secsh-tyoxbijeg7-archive@ietfa.amsl.com>; Tue, 2 Sep 2014 23:46:51 -0700 (PDT)
Received: from mail.netbsd.org (mail.NetBSD.org [IPv6:2001:4f8:3:7::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B658E1A86DF for <secsh-tyoxbijeg7-archive@lists.ietf.org>; Tue, 2 Sep 2014 23:46:50 -0700 (PDT)
Received: by mail.netbsd.org (Postfix, from userid 605) id DE18914A193; Wed, 3 Sep 2014 06:46:47 +0000 (UTC)
Delivered-To: ietf-ssh@netbsd.org
Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 6B19B14A191 for <ietf-ssh@netbsd.org>; Wed, 3 Sep 2014 06:46:43 +0000 (UTC)
X-Virus-Scanned: amavisd-new at NetBSD.org
Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.NetBSD.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id 4VrzC7esSZ2d for <ietf-ssh@netbsd.org>; Wed, 3 Sep 2014 06:46:42 +0000 (UTC)
Received: from mail.lysator.liu.se (mail.lysator.liu.se [IPv6:2001:6b0:17:f0a0::3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.netbsd.org (Postfix) with ESMTPS id 2D33D14A190 for <ietf-ssh@netbsd.org>; Wed, 3 Sep 2014 06:46:40 +0000 (UTC)
Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 872D940020; Wed, 3 Sep 2014 08:46:37 +0200 (CEST)
Received: from bacon.lysator.liu.se (bacon.lysator.liu.se [IPv6:2001:6b0:17:f0a0::ce]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPS id 649E740002; Wed, 3 Sep 2014 08:46:37 +0200 (CEST)
Received: from bacon.lysator.liu.se (localhost [127.0.0.1]) by bacon.lysator.liu.se (8.14.5+Sun/8.14.5) with ESMTP id s836kbit025791; Wed, 3 Sep 2014 08:46:37 +0200 (MEST)
Received: (from nisse@localhost) by bacon.lysator.liu.se (8.14.5+Sun/8.14.5/Submit) id s836ka5a025790; Wed, 3 Sep 2014 08:46:36 +0200 (MEST)
X-Authentication-Warning: bacon.lysator.liu.se: nisse set sender to nisse@lysator.liu.se using -f
From: nisse@lysator.liu.se
To: Thomas Anderson <zelnaga@gmail.com>
Cc: ietf-ssh@netbsd.org
Subject: Re: questions about the window size
References: <CAEe4Dn9Xqdz1gVOZ4LAAp-sqVyJdV_DhPa9kO_TVq0B9orR5yA@mail.gmail.com>
Date: Wed, 03 Sep 2014 08:46:36 +0200
In-Reply-To: <CAEe4Dn9Xqdz1gVOZ4LAAp-sqVyJdV_DhPa9kO_TVq0B9orR5yA@mail.gmail.com> (Thomas Anderson's message of "Wed, 3 Sep 2014 00:40:50 -0500")
Message-ID: <nnppfdfbg3.fsf@bacon.lysator.liu.se>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v)
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Virus-Scanned: ClamAV using ClamSMTP
Sender: ietf-ssh-owner@NetBSD.org
List-Id: ietf-ssh.NetBSD.org
Precedence: list

Thomas Anderson <zelnaga@gmail.com> writes:

> 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?

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).

> It is also unclear from this RFC whether or not
> SSH_MSG_CHANNEL_EXTENDED_DATA should be decrementing from the window 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.