Re: [core] block1 size negotiation with 4.13 Request Entity Too Large

Carsten Bormann <cabo@tzi.org> Thu, 07 January 2021 21:16 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DFCD43A0EED for <core@ietfa.amsl.com>; Thu, 7 Jan 2021 13:16:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.92
X-Spam-Level:
X-Spam-Status: No, score=-1.92 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 BmcLhcLxGlOt for <core@ietfa.amsl.com>; Thu, 7 Jan 2021 13:16:14 -0800 (PST)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D42333A0D2A for <core@ietf.org>; Thu, 7 Jan 2021 13:16:13 -0800 (PST)
Received: from [192.168.217.118] (p548dc939.dip0.t-ipconnect.de [84.141.201.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4DBfDB4gBKzyVj; Thu, 7 Jan 2021 22:16:10 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <3560ba6c-9840-653a-bfb6-2685142c0988@gmx.net>
Date: Thu, 07 Jan 2021 22:16:10 +0100
Cc: "core@ietf.org" <core@ietf.org>, Simon Bernard <contact@simonbernard.eu>
X-Mao-Original-Outgoing-Id: 631746969.944153-3c0b443ad5a1f1e09983bc1d0a8e30d2
Content-Transfer-Encoding: quoted-printable
Message-Id: <D324751F-D453-42D5-9310-753DF44619B4@tzi.org>
References: <189d3f1e-9c83-b1c7-d8a1-7f195265bd2d@gmx.net> <e017c262-c88e-6d77-5f05-2ae2c1145aa8@gmx.net> <AA7B14A4-575F-465F-A106-3A6048877F79@tzi.org> <f114dcbf-ef6d-53d1-41e5-83db0835d408@gmx.net> <AE33D7A2-A503-4E90-AB66-9CC7C64FF211@tzi.org> <3560ba6c-9840-653a-bfb6-2685142c0988@gmx.net>
To: Achim Kraus <achimkraus@gmx.net>
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/d3e6awhChLCsMekrc1Bm7dLQcH0>
Subject: Re: [core] block1 size negotiation with 4.13 Request Entity Too Large
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 07 Jan 2021 21:16:18 -0000

Hi Achim,

On 2021-01-07, at 21:44, Achim Kraus <achimkraus@gmx.net> wrote:
> 
> Hi Carsten
> Hi List,
> 
> sorry for that late follow up of that question from last summer.
> Currently I try to cleanup that code in Californium.
> Doing so, I'm not sure, what the intended behaviour in the following
> scenario should be:
> - the client starts with a request "GET block2(num=5, size=256)".

The operative word here is “starts with”.
So this is the first time the server has a chance to react to the proposed block size.

Section 2 of RFC 7959 says:

   In most cases, all blocks being transferred for a body (except for
   the last one) will be of the same size.  (If the first request uses a
   bigger block size than the receiver prefers, subsequent requests will
   use the preferred block size.)  The block size is not fixed by the […]

This talks about the “first request”, which could be read as meaning “num=0”, but in this case clearly matches the premise.

> - the server is configured to send blocks only up to 64 bytes.
> 
> If that exchange would happen at num=0, it works fine to send just a
> smaller response, but with "num=5", I'm not sure, what is intended.
> So, does this result in:
> 
> - the server respond with "CONTENT block2(num=?, size=64)"
>  the issue with that is in my opinion, that either the "num" must
>  be changed, or the offset can not longer calculated by
>  option.num * option.size. To change the "num" may cause issues,
>  though that "num" seems to be used to ACK the blocks.

I don’t know of any issues that the change in “num” would cause.
“Num” is just a terse encoding for the current byte position (*), based on “szx”, and when szx changes, num has to change in unison.
(Jon is right that, with the size divided by four, the num needs to be multiplied by four to start filling in the right byte position(**).)

> - the server respond with an error; but which one should be used?

Since the protocol has been designed to enable stateless servers, we didn’t see a need to provide an error that a stateless server would never know what to use for.

Grüße, Carsten

(*) Well, that is just given as an “Implementation note” in Section 2.2, but I would expect a sane implementation to follow this note.

(**) A prank implementation might try to fill in num=23 for size=64, as this is also part of the block 5 at size 256.  I don’t think that this behavior would be justifiable, as the case for num=0 clearly fills in the leftmost block.