<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="4"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-boucadair-tcpm-rst-diagnostic-payload-00"
     ipr="trust200902">
  <front>
    <title abbrev="RST Diagnostic Payload">TCP RST Diagnostic Paylaod</title>

    <author fullname="Mohamed Boucadair" initials="M." surname="Boucadair">
      <organization>Orange</organization>

      <address>
        <postal>
          <street></street>

          <city>Rennes</city>

          <region></region>

          <code>35000</code>

          <country>France</country>
        </postal>

        <email>mohamed.boucadair@orange.com</email>
      </address>
    </author>

    <date />

    <workgroup>tcpm</workgroup>

    <abstract>
      <t>This document specifies a diagnostic payload format to be returned in
      TCP RST segments. Such payloads are used to share with the endpoints the
      reasons for which a TCP connection has been reset. This is meant to ease
      diagnostic and troubleshooting. </t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction" title="Introduction">
      <t>A TCP connection <xref target="I-D.ietf-tcpm-rfc793bis"></xref> can
      be reset by a peer for various reasons, e.g., a received data does not
      correspond to an active connection. Also, a TCP connection can be reset
      by an on-path service function (e.g., CGN <xref
      target="RFC6888"></xref>, NAT64 <xref target="RFC6146"></xref>,
      firewall) for various reasons. Typically, a NAT function can generate an
      RST segment to notify the peers upon the expiry of the lifetime of the
      corresponding mapping entry or because an RST segment was received from
      a peer (Section 2.2 of <xref target="RFC7857"></xref>). A TCP connection
      can also be closed by a user or an application at any time. However, the
      peer that receives an RST segment does not have any hint about the
      reason that led to terminating the connection. Likewise, the application
      that relies upon such a TCP connection may not easily identify the
      reason for a connection closure. Troubleshooting such events at the
      terminal side that receives the RST segment may not be trivial. </t>

      <t>This document fills this void by specifying a diagnostic payload that
      is returned in an RST segment. Returning such data is consistent with
      the provision in Section 3.5.3 of <xref
      target="I-D.ietf-tcpm-rfc793bis"></xref> for RST segments. </t>

      <t>This document does not change the conditions under which an RST
      segment is generated (Section 3.5.2 of <xref
      target="I-D.ietf-tcpm-rfc793bis"></xref>). </t>

      <t>The generic procedure for processing an RST segment is specified in
      Section 3.5.3 of <xref target="I-D.ietf-tcpm-rfc793bis"></xref>. Only
      the deviation from that procedure to identify and validate an enclosed
      diagnostic payload is provided in <xref target="new"></xref>. </t>

      <t>A peer that receives a diagnostic payload may pass that information
      to the local application in addition to the information (MUST-12)
      described in Section 3.6 of <xref
      target="I-D.ietf-tcpm-rfc793bis"></xref>. That information may also be
      logged locally, unless a local policy specifies otherwise.</t>

      <t> The first version of the specification is meant to discuss the
      format and the overall approach to ease maintaining the list of codes
      while allowing for adding new codes as needed in the future. As such,
      this first version of the specification does not include a comprehensive
      list of error codes. These codes will be completed in future versions
      (<xref target="initial"></xref>).</t>
    </section>

    <section anchor="notation" title="Terminology">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
      "OPTIONAL" in this document are to be interpreted as described in BCP 14
      <xref target="RFC2119"></xref><xref target="RFC8174"></xref> when, and
      only when, they appear in all capitals, as shown here.</t>

      <t>This document makes use of the terms defined in Section 4 of <xref
      target="I-D.ietf-tcpm-rfc793bis"></xref>.</t>
    </section>

    <section anchor="new" title="RST Diagnostic Payload">
      <t>In order to unambiguously identify an RST diagnostic payload that is
      compliant with the present specification, the payload MUST use the
      I-JSON message format <xref target="RFC7493"></xref>. The following
      parameters are defined: <list style="hanging">
          <t hangText="rc:">Stands for "Reason Code". This parameter takes a
          value from the "TCP Failure Causes" registry (<xref
          target="reg"></xref>). This parameter is omitted if none of the
          values maintained by IANA can be used to report a reset failure
          cause. </t>

          <t hangText="rd:">Stands for "Reason Description". It includes a
          brief description of the reason code. This parameter SHOULD NOT be
          included if a code that covers this error case is already registered
          in <xref target="reg"></xref>. This parameter is useful only for
          codes that are not yet registered or application-specific codes.
          </t>
        </list></t>

      <t>At least one of the above parameters MUST be included in an RST
      diagnostic payload that is compliant with the present specification.</t>

      <t><xref target="ex1"></xref> depicts an example of an RST diagnostic
      payload that is generated to inform the peer that the connection is
      reset because an ACK was received while the connection is still in the
      LISTEN state.</t>

      <t><figure anchor="ex1"
          title="An RST Diagnostic Payload with Reason Code">
          <artwork><![CDATA[{
 "rc": 2
}
]]></artwork>
        </figure></t>

      <t><xref target="ex2"></xref> shows an example of an RST diagnostic
      payload that includes a free description to report a case that is not
      covered yet by the table maintained by IANA (<xref
      target="reg"></xref>).</t>

      <t><figure anchor="ex2"
          title="An RST Diagnostic Payload with Reason Description">
          <artwork><![CDATA[{
 "rd": "brief human-readable description"
}
]]></artwork>
        </figure></t>

      <t>An RST diagnostic payload may be included by the peer that resets the
      connection or by an on-path service function. For example, the following
      payload can be returned by a NAT when a mapping entry expires (<xref
      target="ex3"></xref>). </t>

      <t><figure anchor="ex3"
          title="An RST Diagnostic Payload to Report Connection Timeout">
          <artwork><![CDATA[{
 "rc": 8
}
]]></artwork>
        </figure></t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t></t>

      <section anchor="reg" title="New Registry for TCP Failure Causes">
        <t>This document requests IANA to create a new subregistry entitled
        "TCP Failure Causes" under the "Transmission Control Protocol (TCP)
        Parameters" registry <xref target="IANA-TCP"></xref>. </t>

        <t>The registry is initially populated with the following values:</t>

        <texttable anchor="initial" title="Initial TCP Failure Causes">
          <ttcol>Value</ttcol>

          <ttcol>Description </ttcol>

          <ttcol>Specification (if available)</ttcol>

          <c>1</c>

          <c>Data lost. New data is received after CLOSE is called</c>

          <c>Sections 3.6.1 and 3.10.7.1 of <xref
          target="I-D.ietf-tcpm-rfc793bis"></xref></c>

          <c>2</c>

          <c>Still in LISTEN. Received ACK while the connection still in the
          LISTEN state</c>

          <c>Section 3.10.7.2 of <xref
          target="I-D.ietf-tcpm-rfc793bis"></xref></c>

          <c>3</c>

          <c>Malformed Message</c>

          <c>N/A</c>

          <c>4</c>

          <c>Not Authorized </c>

          <c>N/A</c>

          <c>5</c>

          <c>Resource Exceeded</c>

          <c>N/A</c>

          <c>6</c>

          <c>Network Failure</c>

          <c>N/A</c>

          <c>7</c>

          <c>Connection Reset received from the peer</c>

          <c>N/A</c>

          <c>8</c>

          <c>Destination Unreachable</c>

          <c>N/A</c>

          <c>9</c>

          <c>Connection Timeout</c>

          <c>RFCXXX</c>

          <c>10</c>

          <c>description XXX</c>

          <c>URL</c>
        </texttable>

        <t>The assignment policy for this registry is "Expert Review" (Section
        4.5 of <xref target="RFC8126"></xref>). The designated experts may
        approve registration once they checked that the new requested code is
        not covered by an existing code and if the provided reasoning to
        register the new code is acceptable. A registration request may supply
        a pointer to a specification where that code is defined. However, a
        registration may be accepted even if no permanent and readily
        available public specification is available.</t>
      </section>
    </section>

    <section anchor="security" title="Security Considerations">
      <t><xref target="I-D.ietf-tcpm-rfc793bis"></xref> discusses TCP-related
      security considerations. RST-specific attacks and their mitigation are
      discussed in Section 3.10.7.3 of <xref
      target="I-D.ietf-tcpm-rfc793bis"></xref>.</t>

      <t>In addition to these considerations, it is RECOMMENDED to control the
      size of acceptable diagnostic payload and keep it as brief as possible.
      Also, it is RECOMMENDED to avoid leaking privacy-related information as
      part of the diagnostic payload (e.g., including a description such as
      "user X resets explicitly the connection"). </t>
    </section>

    <section anchor="ack" title="Acknowledgements">
      <t>TBC.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>

      <?rfc include='reference.RFC.8174'?>

      <?rfc include='reference.RFC.8126'?>

      <?rfc include='reference.RFC.7493'?>

      <?rfc include='reference.I-D.ietf-tcpm-rfc793bis'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.RFC.6888'?>

      <?rfc include='reference.RFC.7857'?>

      <?rfc include='reference.RFC.6146'?>

      <reference anchor="IANA-TCP"
                 target="https://www.iana.org/assignments/tcp-parameters/tcp- parameters.xhtml">
        <front>
          <title>Transmission Control Protocol (TCP) Parameters</title>

          <author>
            <organization>IANA YANG</organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>
    </references>
  </back>
</rfc>
