Re: [ietf-smtp] CHUNKING and PIPELINING

Jeremy Harris <jgh@wizmail.org> Wed, 10 March 2021 21:04 UTC

Return-Path: <jgh@wizmail.org>
X-Original-To: ietf-smtp@ietfa.amsl.com
Delivered-To: ietf-smtp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6C3A83A181F for <ietf-smtp@ietfa.amsl.com>; Wed, 10 Mar 2021 13:04:24 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=neutral reason="invalid (unsupported algorithm ed25519-sha256)" header.d=wizmail.org header.b=SW7fOse3; dkim=pass (2048-bit key) header.d=wizmail.org header.b=ZPIvmpxd
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 2i0w64Y7jv9J for <ietf-smtp@ietfa.amsl.com>; Wed, 10 Mar 2021 13:04:22 -0800 (PST)
Received: from wizmail.org (wizmail.org [IPv6:2a00:1940:107::2:0:0]) (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 9B5D73A181E for <ietf-smtp@ietf.org>; Wed, 10 Mar 2021 13:04:22 -0800 (PST)
DKIM-Signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=wizmail.org; s=e202001; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:Subject:From:References:To:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive:Autocrypt; bh=jMCBK0NVRlZ1bDeDiJGBmydJb6abnqGi/KWDRxXVpcY=; b=SW7fOse3uNV5hwQJ9FARURBDgW DzhlMAYDnQyzNCEY29Hg4/Mf6Zv2Rv8XX5bSS/4Nl35foZNJnu7VFhBarNDA==;
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=wizmail.org ; s=r202001; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:Subject:From:References:To:From:Sender:Reply-To: Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive:Autocrypt; bh=jMCBK0NVRlZ1bDeDiJGBmydJb6abnqGi/KWDRxXVpcY=; b=ZPIvmpxdAJQQbn4m7jnSoK56/H gOBCtSwaLiw89B4CaRoNu8VRdgSxjg519coR+8EHdbMqP/eASYdYLo29RzpGxGWGiv4E8hHkWqCDr NK2kkUWTfreKIfpQytNHwrqZqime3joEiANwbu18hAdjyn00+xvFO38KuYhZqOca/QTgyTecpPDTt kzIX3/90ujmGBHAoaU8aesP9ylqQ/N5VeYmt9jqcy/vbZALWBUar2wiYr3ncyQP74DozhZwqOqTfD nm2Qkt4erP3g93ERybiTy4z6kN61hgrzU4e4WphNLSOn0I6HeazD/DOrLEVHLdWkTzbE63nuaQNiR QLNchNkg==;
Authentication-Results: wizmail.org; iprev=pass (vgate18.wizint.net) smtp.remote-ip=2a00:1940:107::1:2f:0; auth=pass (PLAIN) smtp.auth=jgh@wizmail.org
Received: from vgate18.wizint.net ([2a00:1940:107::1:2f:0] helo=lap.dom.ain) by wizmail.org (Exim 4.94.114) (TLS1.3) tls TLS_AES_128_GCM_SHA256 with esmtpsa id 1lK60A-001dGM-Vl for ietf-smtp@ietf.org (return-path <jgh@wizmail.org>); Wed, 10 Mar 2021 21:04:19 +0000
To: ietf-smtp@ietf.org
References: <b1202e49-26b2-35d8-0db7-bb94acd0d52f@wizmail.org> <01RWCSPP4820005PTU@mauve.mrochek.com> <1AFA5DBF-325F-4943-BBE3-45311CC485CA@dukhovni.org> <01RWEGEP5NI8005PTU@mauve.mrochek.com> <290B287C-B5BB-442D-8B30-9EF42C34E33F@dukhovni.org> <04ead364-65c1-436f-a9bb-c92d009db1c1@digilicious.com> <E3A58FCB-7116-4EAC-8831-32CE426AADBC@dukhovni.org>
From: Jeremy Harris <jgh@wizmail.org>
Message-ID: <17c511fc-3819-fe41-272d-63d70c9a3b6b@wizmail.org>
Date: Wed, 10 Mar 2021 21:04:16 +0000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0
MIME-Version: 1.0
In-Reply-To: <E3A58FCB-7116-4EAC-8831-32CE426AADBC@dukhovni.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-GB
Content-Transfer-Encoding: 8bit
X-Pcms-Received-Sender: vgate18.wizint.net ([2a00:1940:107::1:2f:0] helo=lap.dom.ain) with esmtpsa
Archived-At: <https://mailarchive.ietf.org/arch/msg/ietf-smtp/Hbzi2BEp__K0HpXQOT7-uJHCbPo>
Subject: Re: [ietf-smtp] CHUNKING and PIPELINING
X-BeenThere: ietf-smtp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Discussion of issues related to Simple Mail Transfer Protocol \(SMTP\) \[RFC 821, RFC 2821, RFC 5321\]" <ietf-smtp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ietf-smtp/>
List-Post: <mailto:ietf-smtp@ietf.org>
List-Help: <mailto:ietf-smtp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf-smtp>, <mailto:ietf-smtp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Mar 2021 21:04:24 -0000

On 09/03/2021 20:47, Viktor Dukhovni wrote:
>> On Mar 8, 2021, at 10:45 PM, Gene Hightower <gene@digilicious.com> wrote:
>>
>> I can pipeline QUIT after BDAT nnnn LAST to Google's servers and it
>> seems to work. Works with Microsoft/Outlook, too.
> 
> Thanks, I just tried it, and it worked for me as well.
> Jeremy, was there perhaps a bug in your code?

As it turns out, no - or at least not the obvious part.
Some further testing has found that the syndrome
(at least with Google's SMTP servers) is down to my pipelining all of

(SMTP) MAIL, RCPT, BDAT LAST, QUIT, (TLS) close-alert, (TCP) FIN.

The TLS alert and TCP FIN go in the last of the flight of TCP
segments carrying the SMTP commands and data.

Google was actually sending TCP FIN without sending an SMTP response
for the MAIL command, much less the BDAT (which is what I had assumed).


I had thought that sending a TLS close-alert had semantics
"no further data sourced from here, but the other direction
is unaffected" - just like the TCP FIN.  Re-reading RFC 8446
(TLS 1.3 spec) I still think so:  Section 6 "Alert Protocol"  :-

    The
    "close_notify" alert is used to indicate orderly closure of one
    direction of the connection.  Upon receiving such an alert, the TLS
    implementation SHOULD indicate end-of-data to the application.



If I separate out the SMTP commands from the TLS & TCP shutdowns,
reaping the SMTP responses in between, all is well.  If I send
the TLS shutdown with the SMTP commands but not with a TCP FIN,
it is not ok.


Perhaps I need to raise the question on the tls mailinglist.
-- 
Cheers,
   Jeremy