<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>
<rfc category="std" docName="draft-mcb-6man-icmpv6-loopback-01"
     ipr="trust200902">
  <front>
    <title abbrev="ICMPv6 Loopback">Internet Control Message Protocol (ICMPv6) Loopback</title>

    <author fullname="Tal Mizrahi" initials="T."
            surname="Mizrahi">
      <organization abbrev="">Huawei</organization>

      <address>
        <postal>
          <street>8-2 Matam</street>

          <city>Haifa</city>

          <code>3190501</code>

          <country>Israel</country>
        </postal>

        <email>tal.mizrahi.phd@gmail.com</email>
      </address>
    </author>

    <author fullname="Tianran Zhou" initials="T." surname="Zhou">
      <organization abbrev="">Huawei</organization>

      <address>
        <postal>
          <street>156 Beiqing Rd.</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>China</country>
        </postal>

        <email>zhoutianran@huawei.com</email>
      </address>
    </author>

    <author fullname="Shahar Belkar" initials="S."
            surname="Belkar">
      <organization abbrev="">Huawei</organization>

      <address>
        <postal>
          <street>8-2 Matam</street>

          <city>Haifa</city>

          <code>3190501</code>

          <country>Israel</country>
        </postal>

        <email>shahar.belkar@huawei.com</email>
      </address>
    </author>

    <author fullname="Reuven Cohen" initials="R."
            surname="Cohen">
      <organization abbrev="">Huawei</organization>

      <address>
        <postal>
          <street>8-2 Matam</street>

          <city>Haifa</city>

          <code>3190501</code>

          <country>Israel</country>
        </postal>

        <email>reuven.cohen@huawei.com</email>
      </address>
    </author>

    <author fullname="Justin Iurman" initials="J." surname="Iurman">
      <organization abbrev="ULiege">Universite de Liege</organization>

      <address>
        <postal>
          <street>10, Allee de la decouverte (B28)</street>

          <code>4000</code>

          <city>Sart-Tilman</city>

          <region>LIEGE</region>

          <country>Belgium</country>
        </postal>

        <email>justin.iurman@uliege.be</email>
      </address>
    </author>

    <date year="2024"/>

    <workgroup>Network</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <keyword>ICMP</keyword>

    <keyword>ICMPv6</keyword>

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>This document defines ICMPv6 Loopback, which enables a two-way 
	  packet exchange that can be used for probing and for diagnostic purposes.
	  ICMPv6 Loopback is similar to ICMPv6 
	  Echo, except that after a Loopback Request is sent, its corresponding 
	  Reply includes as much of the IPv6 
	  Loopback Request packet as possible, including the IPv6 header and 
	  IPv6 extension headers and options if they are present.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>ICMPv6 Echo <xref target="RFC4443"/> is very commonly used for 
	  diagnostic purposes ("Ping"), and is based on a two-way exchange: 
	  Node A sends an Echo Request to Node B, and Node B responds with an 
	  Echo Reply to Node A. The data (payload) of the Echo Reply message
	  is identical to the data of the invoking Echo Request message.</t> 
	  
	  <t>This document defines ICMPv6 Loopback, using two ICMPv6 message
	  types: Loopback Request and Loopback Reply. The Loopback procedure
	  uses a two-way exchange that is similar to the Echo exchange, with 
	  the exception that the payload of the Loopback Reply includes as
	  much of the invoking IPv6 Loopback Request as possible without 
	  exceeding the MTU, including IPv6 extension headers if they are 
	  present.</t>

          <figure align="center" anchor="LoopbackProcedure"
                  title="The ICMPv6 Loopback Procedure">
            <artwork align="left"><![CDATA[

                       +----------------------------+
                       |        IPv6 Header         |
                       |+ optional extension headers|
                       +----------------------------+
                       |       ICMPv6 Header        |
                       |      Loopback Request      |
                       +----------------------------+
                       |        ICMPv6 Data         |
                       +----------------------------+
						
                       ^                            ^
                       |                            |
      +-----+          +----- Loopback Request -----+           +-----+
      |     |-------------------------------------------------->|     |
      |  A  |                                                   |  B  |
      |     |<--------------------------------------------------|     |
      +-----+          +-----  Loopback Reply  -----+           +-----+
                       |                            |
                       v                            v

                       +----------------------------+
                       |        IPv6 Header         |
                       |+ optional extension headers|
                       +----------------------------+
                       |       ICMPv6 Header        |
                       |       Loopback Reply       |
                   +-  +----------------------------+
                   |   |        IPv6 Header         |
                   |   |+ optional extension headers|
         Invoking  |   +----------------------------+
         Loopback -+   |       ICMPv6 Header        |
         Request   |   |      Loopback Request      |
                   |   +----------------------------+
                   |   |        ICMPv6 Data         |
                   +-  +----------------------------+
	  
	  
           ]]></artwork>
          </figure>


	  
	  <t>It should be noted that ICMPv6 error messages 
	  <xref target="RFC4443"/> already include as much of the IPv6 offending
	  packet as possible. For example, a node that runs Traceroute 
	  receives the inoking packets back in the returned Time Exceeded 
	  messages. The Loopback messages that are defined in this document 
	  enable this information to be returned to the sender without 
	  invoking ICMP error messages.</t>
	  
	  <t>ICMPv6 Loopback provides detailed information about the invoking
	  IPv6 packet that is not available in ICMPv6 Echo, including the IPv6
	  header and extension headers.</t> 
	  
	  <t>A related capability was proposed in the context of the 
	  Simple Two-way Active Measurement Protocol (STAMP): 
	  the STAMP extension that was proposed in 
	  <xref target="I-D.wang-ippm-stamp-hbh-extensions"/> allows a 
	  STAMP session-reflector to reflect IPv6 options that were received in 
	  test packets from the session-sender. This functionality is 
	  performed over STAMP, while the ICMPv6 Loopback functionality is
	  performed in Layer 3, and does not require any parsing or processing
	  beyond Layer 3, namely IPv6 and ICMPv6.</t>
	  
	  <t>There is a number of in-progress drafts in the
	  IETF that define IPv6 extension headers that can be used for tracing the path
	  and its performance, including for example, 
	  <xref target="I-D.ietf-ippm-ioam-ipv6-options"/>,
	  <xref target="I-D.filsfils-spring-path-tracing"/>,
	  <xref target="I-D.ali-spring-ioam-srv6"/>,
	  <xref target="I-D.kumar-ippm-ifa"/>. These extensions are used for 
	  collecting information along the path of a packet. The collected 
	  information is then exported to a central collector or controller for
	  further processing. However, there is currently no straightforward way
	  of sending such trace information back to the sender, while clearly
	  in some cases this trace information is most relevant to the sender.</t>

	  <t>ICMPv6 Loopback enables collected trace information along with other 
	  extension headers to be echoed back to the sender in a strightforward 
	  and generic way.</t> 

    </section>

    <section anchor="Conventions" title="Conventions">
      <section title="Requirement Language">
        <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 target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>
      </section>

      <section title="Terminology">
        <t>Abbreviations used in this document:</t>

        <t><list hangIndent="11" style="hanging">
            <t hangText="ICMP:">Internet Control Message Protocol</t>

            <t hangText="MTU:">Maximum Transmission Unit</t>

          </list></t>
      </section>
    </section>

    <section anchor="icmpLoopback" title="ICMPv6 Loopback Messages">
      <t>This document defines two new ICMPv6 types: Loopback Request and
	  Loopback Reply.</t>
	  
	  
	  <section title="Loopback Request Message">

          <figure align="center" anchor="LoopbackReqFormat"
                  title="Loopback Request">
            <artwork align="left"><![CDATA[
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Type      |     Code      |          Checksum             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |           Identifier          |        Sequence Number        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Data ...
      +-+-+-+-+-
           ]]></artwork>
          </figure>

      <t>IPv6 Fields:</t>

        <t><list hangIndent="20" style="hanging">
            <t hangText="Destination Address">Any legal IPv6 address.</t>
        </list></t>

      <t>ICMPv6 Fields:</t>

        <t><list hangIndent="20" style="hanging">
            <t hangText="Type">TBD-LB-Req</t>
            <t hangText="Code">0</t>
            <t hangText="Identifier">An identifier to aid in matching Loopback 
			Replies to this Loopback Request.  May be zero.</t>
            <t hangText="Sequence Number">A sequence number to aid in matching 
			Loopback Replies to this Loopback Request.  May be zero.</t>
            <t hangText="Data">Zero or more octets of arbitrary data.</t>
        </list></t>
	  
      <t>Description</t>

      <t>A node that implements the ICMPv6 Echo Request and Reply MAY implement
	  an ICMPv6 Loopback responder function that receives Loopback Requests and 
	  originates corresponding Loopback Replies. A node MAY also implement an
	  application-layer interface for originating Loopback Requests and 
	  receiving Loopback Replies, for diagnostic purposes.</t>

      <t>Upper Layer Notification</t>
	  
	  <t>Loopback Request messages MAY be passed to processes receiving ICMPv6 
	  messages.</t>
	  

      </section>


	  <section title="Loopback Reply Message">

          <figure align="center" anchor="LoopbackRepFormat"
                  title="Loopback Reply">
            <artwork align="left"><![CDATA[
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     Type      |     Code      |          Checksum             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |           Identifier          |        Sequence Number        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |     As much of the invoking IPv6 Loopback Request packet      |
      +               as possible without the ICMPv6 packet           +
      |              exceeding the minimum IPv6 MTU [RFC8200]         |
           ]]></artwork>
          </figure>


      <t>IPv6 Fields:</t>

        <t><list hangIndent="20" style="hanging">
            <t hangText="Destination Address">Copied from the Source Address 
			field of the invoking Loopback Request packet.</t>
        </list></t>

      <t>ICMPv6 Fields:</t>

        <t><list hangIndent="20" style="hanging">
            <t hangText="Type">TBD-LB-Rep</t>
            <t hangText="Code">0</t>
            <t hangText="Identifier">The identifier from the invoking Loopback 
			Request message.</t>
            <t hangText="Sequence Number">The sequence number from the invoking 
			Loopback Request message.</t>
        </list></t>
	  
      <t>Description</t>

      <t>A node that implements the ICMPv6 Echo Request and Reply MAY implement
	  an ICMPv6 Loopback responder function that receives Loopback Requests and 
	  originates corresponding Loopback Replies. A node MAY also implement an
	  application-layer interface for originating Loopback Requests and 
	  receiving Loopback Replies, for diagnostic purposes.</t>

      <t>The source address of a Loopback Reply sent in response to a unicast
      Loopback Request message MUST be the same as the destination address of
      that Loopback Request message.</t>

      <t>A Loopback Reply SHOULD be sent in response to a Loopback Request message
      sent to an IPv6 multicast or anycast address.  In this case, the
      source address of the reply MUST be a unicast address belonging to
      the interface on which the Loopback Request message was received.</t>

      <t>The payload of the ICMPv6 Loopback Reply message, which resides after 
	  the Sequence Number field, MUST include as much of the invoking IPv6 
	  Loopback Request packet without exceeding the IPv6 MTU. Note that if
	  the invoking packet includes IPv6 extension headers, they are included
	  in the payload of the Loopback Reply message.</t>


      <t>Upper Layer Notification</t>
	  
	  <t>Loopback Reply messages MUST be passed to the process that originated a
      Loopback Request message.  A Loopback Reply message MAY be passed to
      processes that did not originate the Loopback Request message.</t>


      </section>

	  <section title="Loopback Message Code">
	  
	  <t>The Loopback Request and Reply messages include a Code field. Two
	  Code values are defined in this document, 0 and 1. Code 0 indicates
	  the Loopback Request and Reply as defined above, while Code 1
	  indicates the Symmetric Loopback Request and Reply, as described
	  in <xref target="symmetric"/>.</t>
	  
	  <t>An ICMPv6 Loopback message that is received with an unknown Code 
	  value MUST be discarded. A Loopback Reply message MUST incorporate the 
	  same Code value that was received in the corresponding Loopback Request 
	  message. An ICMPv6 Loopback responder MAY be configured to respond to
	  a subset of the supported Code values.</t>
      </section>
	  
	  <section anchor="symmetric" title="Symmetric Loopback">
	  
	  <t>The Symmetric Loopback Request and Reply are identical to the 
	  conventional Loopback Request and Reply, except that the length of
	  the ICMPv6 payload in the Symmetric Loopabck Reply is equal to the 
	  length of the payload of the corresponding Symmetric Loopback 
	  Request.</t>
	  
	  <t>The payload of the ICMPv6 Symmetric Loopback Reply message, which 
	  resides after the Sequence Number field, MUST include the invoking IPv6 
	  Loopback Request packet, truncated to match the length of the payload
	  of the corresponding ICMPv6 Symmetric Loopback Request, and if necessary
	  truncated further to avoid exceeding the IPv6 MTU.</t>

	  <t>The payload of the ICMPv6 Symmetric Loopback Request message SHOULD
	  be sufficiently long to allow the Reply to include the IPv6 and ICMPv6
	  headers.</t>
	  
      </section>

    </section>


    <section anchor="IANA" title="IANA Considerations">
        <t>IANA is requested to allocate the following values in the 
		"Internet Control Message Protocol version 6 (ICMPv6) Parameters"
		registry.</t>

        <t>Two values are to be allocated from the "ICMPv6 type Numbers"
		range:</t>
		
          <figure align="center" anchor="IcmpTypes"
                  title="ICMPv6 Loopback Type Numbers">
            <artwork align="left"><![CDATA[
         
   +-------------+---------------------+---------------------------+
   | Type        | Name                | Reference                 |
   +-------------+---------------------+---------------------------+
   | TBD-LB-Req  | Loopback Request    | [This document]           |
   +-------------+---------------------+---------------------------+
   | TBD-LB-Rep  | Loopback Reply      | [This document]           |
   +-------------+---------------------+---------------------------+
           ]]></artwork>
          </figure>

        <t>The two type values should be allocated from one of the unassigned
		values greater than 127.</t>
		
		
		<t>IANA is requested to define a code registry for each of the two
		new types. The registration procedure for these registries are 
		"Specification Required". In each of these new registries, the 
		following code values are assigned by this document:</t>
		
          <figure align="center" anchor="IcmpCodes"
                  title="ICMPv6 Loopback Code Numbers">
            <artwork align="left"><![CDATA[
         
   +-------------+---------------------+---------------------------+
   | Code        | Name                | Reference                 |
   +-------------+---------------------+---------------------------+
   | 0           | Loopback            | [This document]           |
   +-------------+---------------------+---------------------------+
   | 1           | Symmetric Loopback  | [This document]           |
   +-------------+---------------------+---------------------------+
           ]]></artwork>
          </figure>
		
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>From a security perspective this document does not introduce new 
	  security threats beyond the threats that are already applicable for 
	  existing ICMPv6 messages, and are described in <xref target="RFC4443"/>.
	  </t>
	  
	  <t>An ICMPv6 Loopback Reply message may be longer than the invoking 
	  Loopback Request message, since the Loopback Reply includes the 
	  invoking IPv6 packet, encapsulated in an ICMPv6 over IPv6 packet.
	  Thus, replies are slightly amplified compared to requests. Notably, the 
	  amplification effect in this case is similar to ICMPv6 error message, and 
	  specifically similar to Traceroute. The amplification effect can be 
	  avoided by configuring responders to respond only to Symmetric Loopback 
	  (with Code 1), as defined in <xref target="symmetric"/>.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>
      <?rfc include='reference.RFC.8174'?>
      <?rfc include='reference.RFC.8200'?>
      <?rfc include='reference.RFC.4443'?>

    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.ietf-ippm-ioam-ipv6-options'?>
      <?rfc include='reference.I-D.filsfils-spring-path-tracing'?>
      <?rfc include='reference.I-D.ali-spring-ioam-srv6'?>
      <?rfc include='reference.I-D.kumar-ippm-ifa'?>
      <?rfc include='reference.I-D.spiegel-ippm-ioam-rawexport'?>
      <?rfc include='reference.I-D.wang-ippm-stamp-hbh-extensions'?>

    </references>

    <section anchor="appendix" title="New ICMPv6 Type vs. New Code">
      <t>One of the issues that was discussed in the development of this
	  document is whether ICMPv6 Loopback Request and Reply should be
	  identified based on the ICMPv6 type, or based on the code value.
	  The first approach, which is used throughout this document, is to
	  define new type values for Loopback Request and Loopback Reply.
	  The second approach is to reuse the Echo Request and Reply type 
	  values, but to define new code values that identify the Loopback
	  messages.</t>
	  
	  <t>Notably, the behavior of ICMPv6 as defined in  
	  <xref target="RFC4443"/> is well defined when receiving an unknown
	  type, but the behavior when receiving an unknown code in an Echo
	  message has not been defined. Therefore, this behavior varies between
	  different implementations. For example, in Debian distributions 
	  an Echo Reply is sent with the same code that was received in the
	  Echo Request, regardless of whether the code value is known. In 
	  FreeBSD, on the other hand, if an Echo Request is received with an
	  unknown code it is ignored. Due to this ambiguity in 
	  <xref target="RFC4443"/> it is not possible to use Echo messages
	  with a new code value, since existing implementations may behave in
	  an unpredictable manner.</t>
	  
	  <t>The current document therefore defines new type values for 
	  ICMPv6 Loopback messages.</t>
    </section>

  </back>
</rfc>