<?xml version='1.0' encoding='utf-8'?>
<!-- This template is for creating an Internet Draft using xml2rfc,
which is available here: http://xml.resource.org. -->
<!--<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">-->
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt'?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
please see http://xml.resource.org/authoring/README.html. -->
<!--<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="exp" docName="draft-anon-intarea-reverse-traceroute-00" ipr="trust200902" obsoletes="" updates="0792,4443" submissionType="IETF" xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true" sortRefs="true" version="3">
-->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" docName="draft-heiwin-intarea-reverse-traceroute-stateless-03" ipr="trust200902" consensus="true" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" tocDepth="4" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 2.38.1 -->
  <!-- category values: std, bcp, info, exp, and historic
    ipr values: trust200902, noModificationTrust200902, noDerivativesTrust200902,
    or pre5378Trust200902
    you can add the attributes updates="NNNN" and obsoletes="NNNN" 
  they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
  full title is longer than 39 characters -->

    <title abbrev="Stateless Reverse Traceroute">Stateless Reverse Traceroute</title>
    
    <!--<seriesInfo name="Internet-Draft" value="draft-anon-intarea-reverse-traceroute-00" />
    -->
    <seriesInfo name="Internet-Draft" value="draft-heiwin-intarea-reverse-traceroute-stateless-03" />
    <!-- add 'role="editor"' below for the editors if appropriate -->

    <author fullname="Valentin Heinrich" initials="V." surname="Heinrich">
      <organization>University of Applied Sciences Augsburg</organization>
      <address>
      <email>valentin.heinrich@tha.de</email>
      </address>
      </author>
      <author fullname="Rolf Winter" initials="R." surname="Winter">
      <organization>University of Applied Sciences Augsburg</organization>
      <address>
      <email>rolf.winter@tha.de</email>
      </address>
    </author>
    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
        in the current day for you. If only the current year is specified, xml2rfc will fill 
        in the current day and month for you. If the year is not the current one, it is 
        necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
        purpose of calculating the expiry date).  With drafts it is normally sufficient to 
      specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>Internet</area>
    <workgroup>Internet Area Working Group</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>reverse traceroute</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>
        Only very few troubleshooting tools exist, that universally work on the 
        public internet. Ping and traceroute are the ones that are most frequently used, 
        when issues arise that are outside the user's administrative reach. Both perform 
        quite basic checks. Ping can only
        confirm basic reachability of an interface. Traceroute can enumerate routers in the forward
        direction of a path but remains blind to the reverse path. In this memo,
        ICMP extensions are defined, that allow to build a reverse traceroute tool for the
        public internet without having to store state on the host performing the actual reverse traceroute
        operation.
      </t>
    </abstract>
  </front>
  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>
        Network operators use traceroute to troubleshoot problems that occur within their own but also outside their own network.
        While traceroute provides valuable information about the path to the target node,
        it can not gather information about the reverse path.
        As the internet proves to be widely asymmetric, meaning that forward and reverse path differ,
        traceroute's output cannot easily be used to identify problems arising on the reverse path.
        This memo addresses this limitation by defining a simple protocol and associated extensions
        that allow network operators to use traceroute's functionality from a target host back towards a client.
      </t>
      <t>
        In the past, a few attempts have been made within the IETF to provide similar functionality.
        <xref target="RFC1393" /> e.g. defines an IPv4 Traceroute option. A packet carrying that option
        is signaling to routers, that they should send an ICMP Traceroute message,
        which is also defined in <xref target="RFC1393" />, to the originator of that packet. When the
        packet finally arrives at the target host, it also uses the IP Traceroute option in its answer to enable 
        reverse traceroute. It does so by copying the IPv4 address of the originator into the option. Routers 
        use that address to again send ICMP Traceroute message to the originator while forwarding the answer
        towards it. This method differs from regular traceroute in particular in its use of 
        IP options and the need to have routers support a new feature. The IP option defined in
        <xref target="RFC1393" /> was subsequently obsoleted in <xref target="RFC6814" /> and the ICMP
        traceroute message was deprecated in <xref target="RFC6918" />. 
      </t>
      <t>
        IPv6 was also in principle capable to perform reverse traceroute from the start. The IPv6 specification in <xref target="RFC2460" />
        defined the type 0 routing header (RH0). Adding ones own source address into that option and sending it to a 
        destination would make said destination send a packet back to the original source. The Hop Limit for that packet
        is copied from the original packet and decremented by one. This way the Hop Limit can be carefully manipulated in a way
        to achieve a reverse traceroute with some trial and error involved. It however does not provide accurate timing 
        information as a source will measure full round trip times for each hop on the reverse path. Just as the
        aforementioned IP options and ICMP messages, RH0 has also been deprecated for quite some time now (<xref target="RFC5095" />) and
        has been removed from the updated IPv6 specification in <xref target="RFC8200" />.
      </t>
      <t>
        The mechanism
        defined in this memo does not require router changes and does neither rely on IPv4 options nor on
        IPv6 extension headers. In fact, as much as possible, the traceroute operation as in use today
        is utilized to implement reverse traceroute itself.
      </t>
      <t>
        Another attempt at remotely triggering traceroute is documented in <xref target="RFC4560" />. Performing 
        traceroute on a remote host and collecting the results is essentially reverse traceroute if the
        performed traceroute is towards the client that actually triggered it. The document specifies an 
        elaborate SNMP MIP module to perform this function. It does however not restrict the host to which
        the traceroute can be sent, and access to SNMP functionality is typically restricted and not a good
        choice for a facility that is supposed to work across the public internet. The mechanism defined
        in this document does rely on ICMP and restricts the reverse traceroute operation to the client that
        issues the request.
      </t>
      <t>
        Most closely resembling reverse traceroute as defined in this document is Proxy Trace <xref target="proxy-trace" />.
        Besides different message encodings, code points and some smaller differences in design decisions, Proxy Trace is specified 
        to allow a client to ask a server to traceroute towards arbitrary hosts on the internet. Reverse traceroute 
        however only allows for measuring the path back towards the client. We believe this to be a useful restriction
        for server operators without severely compromising the general usefulness for clients. 
      </t>
      <t>
        Most basic OAM tasks on the public internet involve ICMP and the fact that ICMP is 
        still being actively developed and enhanced shows its continued relevance and utility. 
        <xref target="RFC4884" /> e.g. has made ICMP messages more extensible by defining 
        multi-part messages. ICMP has also been extended to probe interfaces similar to ping,
        but without the need to have bidirectional connectivity between the probing and probed
        interface in <xref target="RFC8335" />. ICMP has also been extended to aid the operation 
        of traceroute to, amongst other things, indicate the interface where the expiring packet has been received,
        as that might differ from the interface that was used to send the ICMP Time Exceeded message
        (see <xref target="RFC5837" />). 
      </t>
      <t>
        Mechanisms defining new ICMP types and codes are supposed to fall into one of two categories 
        as per <xref target="RFC7279" />. They either should serve to inform about forwarding plane anomalies 
        or they should facilitate the discovery of dynamic information about the network. The mechanism described
        in this memo falls into the latter category.
      </t>
      <section numbered="true" toc="default">
        <name>Terminology</name>
        <dl>
          <dt>Client:</dt>
          <dd>The machine that sends reverse traceroute requests.</dd>
          <dt>Server:</dt>
          <dd>The machine that responds to reverse traceroute requests, i.e. the machine that actually performs the traceroute operation.</dd>
          <dt>Probe, probe packet, traceroute probe:</dt>
          <dd>A packet, that is sent as part of a traceroute operation, intended to expire at a certain router, causing it to respond
          with a ICMP Time Exceeded message. Typically these are UDP packets, but they could also be ICMP or TCP packets.</dd>
        </dl>
      </section>
      <section numbered="true" toc="default">
        <name>Requirements Language</name>
        <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" format="default"></xref>
          <xref target="RFC8174" format="default"></xref> when, and only when, they appear in all capitals, as shown here.
          
          .
        </t>
      </section>
    </section>
    <!-- This PI places the pagebreak correctly (before the section title) in the text output. -->

    <section numbered="true" toc="default">
      <name>Overview</name>
      <t>
      Before describing protocol extensions and the detailed operation of the protocol, the following outlines a 
      rough sketch of how reverse traceroute operates. The general aim is to define a protocol that allows
      a host (the client) to identify the routers on a path from another host (the server) towards itself. In 
      addition, just as with the classic traceroute, RTT measurements should also be part of the information
      provided to the client.</t>
      <t>
      Below is an illustrative example, showing why such a function could help troubleshoot problems that are
      difficult to identify using classic traceroute today.
      </t>
      
      <figure>
      <name>Exemplary scenario</name>
        <artwork>
<![CDATA[
                      +------+    +------+
                      |router|    |router|
                +---->|      +--->|      +-----+
                |     |  B   |    |  C   |     |
                |     +------+    +------+     v
+------+    +---+--+                        +------+     +------+
|      |    |router|                        |router|     |      |
|client|<-->|      |                        |      |<--->|server|
|      |    |  A   |                        |  F   |     |      |
+------+    +------+                        +--+---+     +------+
                ^     +------+    +------+     |
                |     |router|    |router|     |
                +-----+      +----+      |<----+
                      |  D   |    |  E   |
                      +------+    +------+]]>
        </artwork>
      </figure>
      
      <t>
      In the figure above we see a client and a server connected through a network of
      routers. A packet from the client towards the server is sent along the path
      consisting of routers A, B, C, and F. A packet from the server towards the
      client follows a different set of routers, namely, F, E, D and A. Assuming
      that all routers will send ICMP Time Exceeded messages when the TTL/Hop Limit 
      of an IP packet becomes zero and currently are not hitting any rate limiting
      for ICMP message generation, using traceroute today, the client would only see
      routers A, B, C and F as part of traceroute's output.
      </t>
      <t>
      To make the example more interesting, let us assume that there is a problem between routers D and E causing
      unusually high delay. Using traceroute today, the output might look similar to this:
      </t>
      <ol spacing="compact">
        <li>A       1ms    2ms    1ms</li>
        <li>B       3ms    3ms    2ms</li>
        <li>C       5ms    6ms    6ms</li>
        <li>F       340ms  320ms  350ms</li>
        <li>server  345ms  310ms  360ms</li>
      </ol>
      <t>
      This could be misinterpreted as a problem between F and C because starting at F, 
      the reverse path is different and the additional delay starts to appear in traceroute's 
      output.
      </t>
      <t>
      Reverse traceroute would make the path between the server towards the client visible.
      Therefore its corresponding output should look similar to this, indicating the problem
      between D and E:
      </t>
      <ol spacing="compact">
        <li>F       1ms    2ms    1ms</li>
        <li>E       3ms    2ms    3ms</li>
        <li>D       300ms  320ms  310ms</li>
        <li>A       330ms  315ms  332ms</li>
        <li>client  345ms  360ms  360ms</li>
      </ol>
      <t>
      A client requesting a reverse traceroute does so by using new ICMP messages
      defined in this document.
      The same is true for reporting the result of a reverse traceroute operation.
      Everything else relies as much as possible on existing traceroute operations.
      </t>
      <t>
      Clearly, the ability to trigger a traceroute on a remote host offers plenty of 
      potential concerns, in particular in terms of amplification attacks, when 
      a single reverse traceroute request could trigger a larger traceroute operation
      involving tens of packets. Therefore, the general design of the protocol
      requires the client to send a single request for each and every packet that
      the server is supposed to send. In other words, a single traceroute request from
      the client only triggers the emission of a single traceroute probe at the server.
      </t>
      <t>
      A detailed description of the operation follows in <xref target="ops" />.
      A further discussion about security considerations follows in <xref target="Security" />.
      </t>
    </section>

    <section numbered="true" toc="default">
      <name>Protocol Design</name>
      <!--<t>In order to ensure that the protocol can be deployed on today's internet, existing ICMP Echo messages
        are extended with a new code to identify reverse traceroute messages.-->
      <t>Reverse traceroute messages are defined for both ICMPv4 and ICMPv6.</t>
      <section numbered="true" toc="default">
        <name>Traceroute Request</name>
        <t> 
          A traceroute request is sent by the client to the server to prompt the server
          for the creation of a single traceroute probe addressed to the client.
        </t>
        <t>
          The traceroute request MAY be followed by an ICMP extension structure as defined by <xref target="RFC4884"/>.
          See <xref target="extensions"/> for the currently defined extensions.
        </t>
        <figure anchor="fig_request">
          <artwork>
 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=TBD1   |            Checksum           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Identifier          |            (Unused)           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Data ...
+-+-+-+-+-
          </artwork>
        </figure>

        <t>Header fields:</t>
        <t>NOTE: see <xref target="discuss" /> for why those protocol field
        values were chosen.</t>
        <ul>
          <li>
            <t>Type: The ICMP type of the message.</t>
            <t>The value for ICMPv4 is 8. The value for ICMPv6 is 128. (Echo)</t>
          </li>
          <li>Code: Reverse traceroute messages are identified by code TBD1.</li>
          <li>Identifier: The ICMP query identifier of the message.</li>
          <li>Unused: MUST be set to 0 and ignored by the receiver.</li>
          <li>
            <t>Data: The request carries ICMP Echo Data in a fixed format:</t>
            <artwork>
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Exp      |     Proto     |              Flow             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            </artwork>
            <ul>
              <li>Exp: The hop at which the traceroute probe is expected to expire. This translates to the 
                  Time-To-Live (IPv4)/Hop Limit (IPv6) value the traceroute probe MUST use.</li>
              <li>
                <t>Protocol: The protocol the traceroute probe MUST use.</t>
                <t>Supported SHOULD be ICMP, TCP and UDP. The code points for this are defined by IANA in the list of protocol numbers.</t>
              </li>
              <li>Flow: The flow identifier the traceroute probe MUST use.</li>
            </ul>
          </li>
        </ul>
        <t>
          The identifier is employed by a client application to match traceroute requests with traceroute responses.
          The Exp field specifies the value of the Time-To-Live/Hop Limit field of the resulting traceroute probe.
        </t>
        <t>
          The protocol field specifies the protocol to be employed in the traceroute probes.
          A value of 0 indicates to the server endpoint that it MUST choose a suitable protocol on its own.
        </t>
        <t>
          The Flow field contains a number that impacts the next-hop forwarding decision in load-balancing routers.
          Adjusting the Flow field can result in the probes taking different paths. In other words, pinning the Flow
          field to a fixed value will make sure that all probes with the same Flow value will follow the same path.
          A value of 0 indicates to the server endpoint that it MUST choose a suitable flow identifier on its own. See
          <xref target="probes" /> for details.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Traceroute Response</name>
        <t>
          A traceroute response is sent by a server to the client containing
          information about the answer to a traceroute probe such as 
          an ICMP Time Exceeded message.
        </t>
        <figure anchor="fig_response">
          <artwork>
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=TBD2   |            Checksum           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Identifier          |            (Unused)           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Data ...
+-+-+-+-+-
          </artwork>
        </figure>

        <t>Header fields:</t>
        <ul>
          <li>
            <t>Type: The ICMP type of the message.</t>
            <t>The value for ICMPv4 is 0. The value for ICMPv6 is 129. (Echo Reply)</t>
          </li>
          <li>Code: Reverse traceroute messages are identified by code TBD2.</li>
          <li>Identifier: The ICMP query identifier of the message.</li>
          <li>Unused: MUST be set to 0 and ignored by the receiver.</li>
          <li>
            <t>Data: The response carries ICMP Echo Data in a fixed format:</t>
            <artwork>
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Status    |     Length    |             Value             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
            </artwork>
            <ul>
              <li>
                <t>Status: Supplies information about the status of a request.</t>
                <t>Following values are defined:</t>
                <t>0x00: Success</t>
                <t>0x01: Invalid TTL/Hop Limit</t>
                <t>0x02: Invalid Protocol</t>
                <t>0x03: Invalid Flow</t>
                <t>0x04: Unsupported Extension</t>
                <t>0x05: Insufficient Padding</t>
              </li>
              <li>Length: The length of the optional error message following the header.</li>
              <li>
                <t>Value: Carries additional information depending on the status, SHOULD be set to zero when not defined for a status code. This field is defined for the following status values:</t>
                <ul>
                  <li>
                    <t>Unsupported Extension: Carries the Class-Num and C-Type of the first encountered unsupported extension object</t>
                    <artwork>
     0                   1           
     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |    Class-Num  |     C-Type    |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                    </artwork>
                  </li>
                  <li>
                    <t>Insufficient Padding: Carries the number of missing padding bytes</t>
                  </li>
                </ul>
              </li>
            </ul>
          </li>
        </ul>
        <t>
          The identifier of the response MUST match the the identifier of the corresponding request.
          If a malformed request is encountered, it MUST be silently dropped.
          If an invalid probe configuration is supplied by the request, the server MUST respond
          with a suitable error code.
          Additional information about an error condition MAY be supplied to the client by specifying an error message,
          whose length MUST be reflected in the length field.
        </t>
        <t>
          The server MUST respond with an Invalid TTL/Hop Limit status if the requested TTL/Hop Limit equals zero.
          The server MUST choose suitable default values if the requested protocol or flow values are zero.
        </t>
        <t>
          If the response status indicates success, the length field MUST be set to 0 and the message MUST be followed by a single traceroute payload structure.
          The traceroute payload structure MUST NOT be appended to the response message if the status
          does not indicate success.
        </t>
        <t>
          If the server endpoints responds with an Invalid Padding status, it MUST support the Padding extension (see <xref target="extensions"/>).
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Traceroute Payload Structure</name>
        <t>
        The traceroute payload structure contains information about a single
        successful traceroute probe.
        </t>
        <figure anchor="fig_payload">
          <artwork>
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                          IPv6 Address                         +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                            Timespan                           +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
        <ul>
          <li>
            <t>IPv6 Address: Address of the node that responded to the traceroute probe.</t>
            <t>The address format is defined in <xref target="RFC4291" />.</t>
            <t>IPv4 addresses are encoded as IPv4-mapped IPv6 addresses.</t>
          </li>
          <li>
            <t>(Optional) Timespan: The timespan elapsed between sending a traceroute probe and receiving an answer.</t>
            <t>The timespan is defined in nanoseconds.</t>
            <t>If the server was not able to determine the timespan this field MUST be omitted.</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="probes" numbered="true" toc="default">
      <name>Probes</name>
      <t>
        The probes sent by a reverse traceroute server application share a set of common
        information, that must be encoded inside them.
        This set of information consists of:
      </t>
      <dl>
        <dt>Flow identifier:</dt>
        <dd>An identifier that affects the next-hop forwarding decision in load-balancing routers. Depending on the protocol used 
        for the probes (ICMP, TCP or UDP), the flow identifier affects different fields in the probe packet's header.</dd>
        <dt>Probe identifier:</dt>
        <dd>A constant identifier that identifies the packet as a reverse traceroute probe. This identifier is needed to distinguish an 
        answer to a reverse traceroute probe from an ICMP Time Exceeded message triggered by the traceroute tool running 
        on the same machine.</dd>
        <dt>Query identifier:</dt>
        <dd>An identifier that is used by the server to match traceroute probes with their responses.
        It is identical to the identifier inside the traceroute request, which the client uses to match traceroute requests and responses.</dd>
        <dt>Timestamp:</dt>
        <dd>The current timestamp when issuing the probe in nanoseconds resolution.
        By extracting this information from the probe's response the RTT can be computed.</dd>
      </dl>
      <t>
        <xref target="RFC0792" />
        guarantees that Time Exceeded and Destination Unreachable responses contain
        at least the first eight bytes of the original datagram.
        As a consequence the needed information MUST be encoded in those eight bytes.
        This restriction also impacts the RTT estimates of a measurement,
        as the timestamp stored inside a traceroute probe might not be delivered back in the probe response.
        In that case the reverse traceroute server will not be able to convey an RTT measurement to the client.

        This section gives suggestions as to how the state SHOULD be encoded inside different types of probes.
        In all probes supporting port numbers, e.g. UDP and TCP, the probe identifier is encoded
        into the source port. As the probe identifier is a constant value, we suggest to assign
        an unused user port number (see
        <xref target="IANA" />
        ) for reverse traceroute server implementations.
        <!--TODO: Probe Identifier can be used by firewalls to identify rev-tr traffic-->
      </t>
      <t>  
        The flow identifier is encoded into a field of the probe packet that routers commonly use for load-balancing decisions.
        The following sections define the exact fields for ICMP, UDP and TCP. In adddition, when used with IPv6, the probe will
        use the same flow label as found in the traceroute request. This allows the client to influence load-balancing at that level 
        as well. Further information on load-balancing and flow identifiers can be found in <xref target="paris-traceroute" />.
      </t>
      <section numbered="true" toc="default">
        <name>ICMP</name>
        <figure>
          <artwork>
 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=0    |        Checksum (Flow)        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       Identifier (Query)      |       Sequence (Probe)        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                           Timestamp                           *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Payload                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
        <t>
          The payload MUST be adjusted so that the flow identifier encoded inside the
          checksum is valid.

          A significant part of the payload SHOULD consist of random bytes to prevent the client
          from crafting ICMP packets with a predictable payload.

          It is recommended to set the probe identifier encoded in the ICMP sequence to 0xFFFF
          to minimize potential clashes with regular traceroute probes.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>UDP</name>
        <figure>
          <artwork>
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     Source Port (Probe)       |   Destination Port (Flow)     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Length            |       Checksum (Query)        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                           Timestamp                           *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Payload                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
        <t>
          The payload MUST be adjusted so that the query identifier encoded inside the
          checksum is valid.
          A significant part of the payload SHOULD consist of random bytes to prevent the client
          from crafting malicious UDP packets with a predictable payload.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>TCP</name>
        <figure>
          <artwork>
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       Source Port (Probe)     |    Destination Port (Flow)    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Sequence Number (Query)                    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Acknowledgment Number                     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Offset|  Res. |     Flags     |             Window            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Checksum           |         Urgent Pointer        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Options                    |    Padding    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                           Timestamp                           *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Payload                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
        <t>
          The implementation SHOULD append additional payload to a TCP probe packet.
          In this case a significant part of the payload SHOULD consist of random bytes to prevent the client
          from crafting malicious TCP packets with a predictable payload.
        </t>
      </section>
    </section>
    <section anchor="extensions" numbered="true" toc="default">
      <name>Extensions</name>
      <t>This section defines ICMP multi-part extension objects, which are part of an extension structure defined in <xref target="RFC4884"/>.</t>
      <section numbered="true" toc="default">
        <name>Padding</name>
        <t>
          The padding extension allows an endpoint to append variable length padding to ICMP messages.
        </t>
        <artwork>
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             Length            | Class-Num=TBD4|    C-Type=0   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
|                       // (Padding) //                         |
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      </artwork>
      </section>
    </section>
    <section numbered="true" toc="default" anchor="ops">
      <name>Operation</name>
      <section numbered="true" toc="default">
        <name>Client</name>
        <t>
          Before sending traceroute requests, a client could first discover whether a server endpoint runs reverse traceroute.
          It does so by setting the TTL/Hop Limit inside the traceroute request message to 0, thus creating
          an error condition.
          If a response with a non-zero status, signaling an error, is received, the server runs reverse traceroute.
          Otherwise, the originator of the response does not provide a reverse traceroute instance (or other circumstances prevent
          the instance to respond to or receive requests, such as firewalls).
        </t>
        <t>
          After such a potential discovery phase, the client sends regular traceroute request messages with an increasing TTL/Hop Limit to the server.
          Each of these request messages SHOULD employ a unique identifier to eliminate false measurements that may arise because of delayed responses to previously issued requests using the same identifier as newer ones.
          The client SHOULD pace those requests appropriately as to avoid packet loss due to e.g. rate limiting, which is recommended for security reasons (see <xref target="Security" />).
          If the specified probe configuration is considered invalid by the server, an error message is immediately dispatched to the client.
          The client examines the status in order to find the cause of the error and prints the optional error message inside the response.
          If the error occured due to an invalid protocol or flow, the client can set the respective value to zero in order to ask the server 
          to choose a suitable default value on its own.
        </t>
        <t>
          If the status indicates success, the payload data structure immediately following the header is examined
          to retrieve the address of the node that responded to the traceroute probe and, if present, the round-trip-time encoded in the timespan field.
          If no response to a traceroute request message is received in a time interval specified by the client, then the server e.g. did either not receive the request or the response to a probe,
          or the server's traceroute response message was lost during transit to the client.
          In either case the client SHOULD assume that the traceroute probe was not answered.
        </t>
      </section>
      <section numbered="true" toc="default">
        <name>Server</name>
        <t>
          The server attempts to parse incoming reverse traceroute requests 
          and the optional multi-part extension structure immediately following the header.
          <!-- This allows the client to be always notified when an extension is not supported -->
          The extension structure MUST be parsed by a server endpoint even if all extensions are disabled.
          If a request with an invalid configuration was received by the server,
          it MUST respond with a traceroute response message indicating a suitable error status
          and MAY supplement it with an error message immediately following the header, whose length is encoded in the corresponding field.
        </t>
        <t>
          If a request with a valid configuration was received by the server,
          a probe with the configuration supplied in the request is formed and sent back towards the client.
        </t>
        <t>
          The server handles incoming packets as follows:
        </t>
        <ol>
          <li>
            <t>ICMP error messages from routers:</t>
            <t>The original IP header and the first eight bytes of the traceroute probe are contained in the payload of these messages.</t>
            <t>The server determines if the packet is related to reverse traceroute by checking the original probe identifier.</t>
            <t>The exact encoding is specific to the protocol of the traceroute probe.</t>
            <t>The destination address for the reverse traceroute response is the destination address of the original IP header.</t>
            <t>The query and probe identifiers are probe specific and encoded in the first eight bytes after the original IP header.</t>
          </li>
          <li>
            <t>Response from client:</t>
            <t>The destination address for the reverse traceroute response is the source address of the packet.</t>
            <t>The query and probe identifiers are probe specific.</t>
          </li>
        </ol>
        <t>
          If the probe identifier matches the value assigned to reverse traceroute the packet is considered a probe response
          and a reverse traceroute response MUST be dispatched to the client.
          The reverse traceroute response is built as follows:
          The destination address is filled in with the previously extracted value.
          A traceroute payload structure is appended to the response message and filled with
          the packet's source address.
          If the server was able to extract the previously stored timestamp from the packet the payload's 
          timespan is initialized to the computed RTT value, otherwise the timespan field is omitted.
        </t>
      </section>
    </section>
    <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>If this document is to be published as an RFC, IANA is asked to:</t>
      <ul>
        <li>
          assign a unique user port number to be encoded as the probe identifier
          in the source port of reverse traceroute probes (
          <xref target="probes" />
          )
        </li>
        <li>extend type 8 with code TBD1 as reverse traceroute request in the list of ICMP Parameters</li>
        <li>extend type 0 with code TBD2 as reverse traceroute response in the list of ICMP Parameters</li>
        <li>extend type 128 with code TBD1 as reverse traceroute request in the list of ICMPv6 Parameters</li>
        <li>extend type 129 with code TBD2 as reverse traceroute response in the list of ICMPv6 Parameters</li>
        <li>assign an ICMP Multi-Part Extension Object with Class-Num TBD4 for the padding extension</li>
      </ul>
      <t>
      We ask IANA to assign the code 1 for both TBD1 and TBD2 as its deployability in the internet has been
      verified by a measurement study.
      </t>
    </section>
    <section anchor="discuss" numbered="true" toc="default">
      <name>Discussion</name>
      <t>
      The ICMP messages defined in this memo use the ICMP types of Echo request and Echo reply but use
      new codes. The main reason for this is that by reusing these particular types, reverse traceroute has
      a higher chance of being immediately deployable on the public internet, as middleboxes are 
      familiar with these types and especially a large number of NATs could readily translate these
      packets. 
      </t>
    </section>
    <section anchor="Security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>
        Both client and server endpoints SHOULD support and make use of the Padding extension object (<xref target="extensions"/>)
        to further reduce the potential of amplification attacks. 
        The server endpoint SHOULD require enough padding so that the total size of the packets triggered by a request does not exceed 
        the size of the request itself.
      </t>
      <t>
        A server implementation SHOULD be able to restrict the IP address ranges from which it accepts reverse traceroute 
        requests. 
      </t>
      <t>
        When the server runs behind a firewall the reverse-traceroute probes may be used by a malicious user to determine
        open ports. Hence, reverse traceroute server endpoints SHOULD not be deployed behind a firewall that restricts
        egress traffic based on destination port numbers.
      </t>
      <t>
        The details of the probe encoding scheme proposed in <xref target="probes"/> SHOULD be carefully considered. 
        The flow identifier specified inside reverse traceroute requests is encoded into the destination ports for UDP and TCP.
        If an operator deems the control of a probe's destination port as a security threat, the reverse traceroute server SHOULD 
        be configured to allow only a single flow identifier. If a client attempts to set a flow identifier other than the one
        configured at the server, the server SHOULD send an appropriate error back.
      </t>
      <t>
        As the probe encoding scheme uses a four-byte payload to balance changes to the checksum,
        a malicious client could create reverse traceroute requests that carry a known payload.
        Combined with the control over the destination probes destination port and employment of IP-Spoofing,
        the probes could be used to deliver a malicious payload to a service running on the spoofed host.
        The server can mitigate this risk by using payload randomization as discussed in this document.
      </t>

      <!-- NOT ENABLED BY DEFAULT AND RESTRICT TO SPECIFIED SOURCE ADDRESSES/ADDRESS RANGES-->
    </section>
    <section anchor="ack" numbered="true" toc="default">
      <name>Acknowledgments</name>
      <t>We would like to thank Ole Troan for pointing out that the type 0 routing header was a means to implement reverse traceroute in IPv6.</t>
      <t>We would also like to thank Saku Ytti for pointing us to his work on Proxy Trace and Ron Bonica for suggesting to avoid updates to other	
   documents. </t>
      <t>
        Rolf Winter and Valenin Heinrich have been partially funded by the German Federal Ministry for Economic Affairs and Climate
        as part of the MAVERIC project. Measurement results relating to reverse traceroute can be found in <xref target="stateless-rtr"/>.
      </t>
    </section>

  </middle>
  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
      1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
      2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
      (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

      Both are cited textually in the same manner: by using xref elements.
      If you use the PI option, xml2rfc will, by default, try to find included files in the same
      directory as the including file. You can also define the XML_LIBRARY environment variable
      with a value containing a set of directories to search.  These can be either in the local
    filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4291.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4884.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <!-- Here we use entities that we defined at the beginning. -->
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.1393.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6814.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4560.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6918.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8335.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5837.xml"/> 
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7279.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8200.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.5095.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2460.xml"/>

        <reference anchor="proxy-trace" target="https://ytti.github.io/proxy-trace/draft-ytti-intarea-proxy-trace.html">
          <front>
            <title>Proxy Trace: A Utility for Programmatic Discovery of Forward and Reverse Path</title>
            <author initials="S." surname="Ytti" fullname="Saku Ytti" />
            
            <date year="2019" month="March" />
          </front>
          <!--<seriesInfo name="Internet Measurement Conference (IMC)" value="06" />-->
        </reference>

        <reference anchor="RFC0792" target="https://www.rfc-editor.org/info/rfc792">
          <front>
            <title>Internet Control Message Protocol</title>
            <author initials="J." surname="Postel" fullname="J. Postel">
              <organization />
            </author>
            <date year="1981" month="September" />
          </front>
          <seriesInfo name="STD" value="5" />
          <seriesInfo name="RFC" value="792" />
          <seriesInfo name="DOI" value="10.17487/RFC0792" />
        </reference>
        <reference anchor="paris-traceroute">
          <front>
            <title>Avoiding traceroute anomalies with Paris traceroute</title>
            <author initials="B." surname="Augustin" fullname="Brice Augustin" />
            <author initials="X." surname="Cuvellier" fullname="Xavier Cuvellier" />
            <author initials="B." surname="Orgogozo" fullname="Benjamin Orgogozo" />
            <author initials="F." surname="Viger" fullname="Fabien Viger" />
            <author initials="T." surname="Friedman" fullname="Timur Friedman" />
            <author initials="M." surname="Latapy" fullname="Matthieu Latapy" />
            <author initials="C." surname="Magnien" fullname="Clemence Magnien" />
            <author initials="R." surname="Teixeira" fullname="Renata Teixeira" />
            <date year="2006" month="October" />
          </front>
          <seriesInfo name="Internet Measurement Conference (IMC)" value="06" />
        </reference>
        <reference anchor="stateless-rtr">
          <front>
            <title>Towards a Stateless Reverse Traceroute Protocol</title>
            <author initials="V." surname="Heinrich" fullname="Valentin Heinrich" />
            <author initials="R." surname="Winter" fullname="Rolf Winter" />
            <date year="2024" month="June" />
          </front>
          <seriesInfo name="International Conference on Communications (ICC)" value="24" />
        </reference>
      </references>
    </references>
    <!-- Change Log

        v00 2006-03-15  EBD   Initial version

        v01 2006-04-03  EBD   Moved PI location back to position 1 -
        v3.1 of XMLmind is better with them at this location.
        v02 2007-03-07  AH    removed extraneous nested_list attribute,
        other minor corrections
        v03 2007-03-09  EBD   Added comments on null IANA sections and fixed heading capitalization.
        Modified comments around figure to reflect non-implementation of
        figure indent control.  Put in reference using anchor="DOMINATION".
        Fixed up the date specification comments to reflect current truth.
        v04 2007-03-09 AH     Major changes: shortened discussion of PIs,
        added discussion of rfc include.
        v05 2007-03-10 EBD    Added preamble to C program example to tell about ABNF and alternative 
        images. Removed meta-characters from comments (causes problems).

        v06 2010-04-01 TT     Changed ipr attribute values to latest ones. Changed date to
        year only, to be consistent with the comments. Updated the 
        IANA guidelines reference from the I-D to the finished RFC.
        v07 2020-01-21 HL    Converted the template to use XML schema version 3.
      -->
  </back>
</rfc>
