Re: [tcpinc] TCP's treatment of data in SYN packets

David Mazieres <dm-list-tcpcrypt@scs.stanford.edu> Sun, 31 July 2016 06:59 UTC

Return-Path: <dm-list-tcpcrypt@scs.stanford.edu>
X-Original-To: tcpinc@ietfa.amsl.com
Delivered-To: tcpinc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0B77812D57B for <tcpinc@ietfa.amsl.com>; Sat, 30 Jul 2016 23:59:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.188
X-Spam-Level:
X-Spam-Status: No, score=-2.188 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HK_RANDOM_ENVFROM=0.001, HK_RANDOM_FROM=0.999, RP_MATCHES_RCVD=-1.287, SPF_PASS=-0.001] autolearn=no 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 Jy-qQAPGBf0s for <tcpinc@ietfa.amsl.com>; Sat, 30 Jul 2016 23:59:34 -0700 (PDT)
Received: from market.scs.stanford.edu (www.scs.stanford.edu [IPv6:2001:470:806d:1::9]) (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 789D512D579 for <tcpinc@ietf.org>; Sat, 30 Jul 2016 23:59:34 -0700 (PDT)
Received: from market.scs.stanford.edu (localhost.scs.stanford.edu [127.0.0.1]) by market.scs.stanford.edu (8.14.7/8.14.7) with ESMTP id u6V6xXSW018831; Sat, 30 Jul 2016 23:59:33 -0700 (PDT)
Received: (from dm@localhost) by market.scs.stanford.edu (8.14.7/8.14.7/Submit) id u6V6xWwv030123; Sat, 30 Jul 2016 23:59:32 -0700 (PDT)
X-Authentication-Warning: market.scs.stanford.edu: dm set sender to dm-list-tcpcrypt@scs.stanford.edu using -f
From: David Mazieres <dm-list-tcpcrypt@scs.stanford.edu>
To: Kyle Rose <krose@krose.org>, Jeremy Harris <jgh@wizmail.org>
In-Reply-To: <CAJU8_nVBem40i5Rqke37UBtOquF_mVBJHkjrtAmNN2qPdHqY=A@mail.gmail.com>
References: <CAJU8_nU1WzQNFFUn_2o1cACutB01iyQ_hC29PHoutr8TRDKGnA@mail.gmail.com> <579A4669.7030600@isi.edu> <87lh0lselg.fsf@ta.scs.stanford.edu> <CAJU8_nUPrm9JJMrrMbL5+FpP-9CKC6EkidCry9UuZA5ZfyJtoA@mail.gmail.com> <579A8223.8050308@isi.edu> <CAJU8_nXSxr7ykC1TwptBmyP8pNccz52ozq=hF7-EYiaMdDeLBQ@mail.gmail.com> <579BA470.3000405@isi.edu> <CAJU8_nXjhHH1eEXPA3hvhJ3YXsP_v2djGX=X2p9+wyn767Hm5A@mail.gmail.com> <adcaa33a-3bf5-e63a-bd19-fd165b16aa7d@wizmail.org> <87oa5fniu0.fsf@ta.scs.stanford.edu> <9ff12fb6-44f9-b1d0-2e9d-a67683679037@wizmail.org> <CAJU8_nVBem40i5Rqke37UBtOquF_mVBJHkjrtAmNN2qPdHqY=A@mail.gmail.com>
Date: Sat, 30 Jul 2016 23:59:32 -0700
Message-ID: <87d1lunvhn.fsf@ta.scs.stanford.edu>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <https://mailarchive.ietf.org/arch/msg/tcpinc/3eD1EHM5xMitVLCLwGRRlTBSN_0>
Cc: tcpinc <tcpinc@ietf.org>
Subject: Re: [tcpinc] TCP's treatment of data in SYN packets
X-BeenThere: tcpinc@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
Reply-To: David Mazieres expires 2016-10-28 PDT <mazieres-jat7tv6bmd95tdfrcp343a63r2@temporary-address.scs.stanford.edu>
List-Id: "Discussion list for adding encryption to TCP." <tcpinc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tcpinc>, <mailto:tcpinc-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tcpinc/>
List-Post: <mailto:tcpinc@ietf.org>
List-Help: <mailto:tcpinc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tcpinc>, <mailto:tcpinc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 31 Jul 2016 06:59:35 -0000

Okay, guys.  This is getting long and feels a bit pedantic, but how
about the following?

David


4.7.  Data in SYN segments

   A SYN segment containing an ENO option MUST NOT include a TCP Fast
   Open (TFO) option [RFC7413].  However, TEPs MAY specify the use of
   data in SYN segments to achieve similar benefits to TFO.

   The last TEP identifier suboption in host A's SYN segment is the _SYN
   TEP_.  The use of data in host A's SYN segment is goverend by the SYN
   TEP.  If the SYN TEP's specification does not define the use of SYN
   data, then host A's SYN segment MUST NOT contain data and host B MUST
   discard any SYN data.  Host B MUST also discard SYN data if either
   the SYN TEP differs from the negotiated TEP or host B disables
   encryption.

   The use of data in B's SYN-ACK segment is governed by the negotiated
   TEP.  If the negotiated TEP's specification does not define the use
   of SYN data, then host B's SYN-ACK segment MUST NOT contain data and
   host A MUST discard any SYN data.  Host A MUST also discard SYN data
   if host A disables encryption.  In the event that host B is an active
   opener (because of simultaneous open), host B's SYN-only segment MUST
   NOT include data.

   A host MUST NOT act on discarded data under any circumstances.  In
   particular, after a host discards SYN data, if a later non-SYN
   segment contains different data for the same sequence numbers, the
   host MUST process the contents of the non-SYN segment only.
   Furthermore, when a host discards SYN data, it MUST NOT acknowledge
   the sequence number of the discarded data.  Rather, it MUST
   acknowledge the other host's initial sequence number as if the
   received SYN segment contained no data.

   If host A's SYN segment contains data, host B's SYN-ACK segment
   acknowledges that data, and either encryption is disabled or the
   negotiated TEP is not the SYN TEP, then host A MUST reset the TCP
   connection.  Under such circumstances, the acknowledged data is
   defined by the SYN TEP, which does not govern the connection.  Hence,
   there is significant risk of host B misinterpreting SYN data.

   If host A sends SYN data, host B does not acknowledge the SYN data,
   and host B's SYN-ACK segment does not include an ENO option, then
   host A SHOULD reset the connection.  The reason is that a legacy host
   B, if it does not implement ENO, could buffer and later act on SYN
   data even without first acknowledging that data.  Barring empirical
   evidence against the existence of unacknowledged data buffering, it
   is not safe for host A to assume its SYN data has been discarded.

   To avoid unexpected resets, TEPs SHOULD support a normal mode of
   operation that does not make use of data in SYN segments, and SHOULD
   enable data in host A's SYN segment only if explicitly requested by
   the application or in cases where such use is unlikely to cause
   connection failure.  Implementations MAY provide a per-connection
   mandatory-encryption mode that automatically resets a connection if
   ENO fails.  If supported by the TEP, host A MAY enable SYN data when
   the application requests mandatory-encryption mode.