<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp   "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
 
   <!ENTITY I-D.ietf-ippm-stamp-yang SYSTEM
     "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-yang.xml">
  <!ENTITY I-D.ietf-ippm-stamp-ext-hdr SYSTEM
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-ext-hdr.xml">
  <!ENTITY RFC10052 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.10052.xml">
  <!ENTITY RFC0768 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.0768.xml">
  <!ENTITY RFC0791 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.0791.xml">
  <!ENTITY RFC0826 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.0826.xml">
  <!ENTITY RFC4026 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4026.xml">
  <!ENTITY RFC4861 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4861.xml">
  <!ENTITY RFC2681 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2681.xml">
  <!ENTITY RFC6056 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6056.xml">
  <!ENTITY RFC6234 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6234.xml">
  <!ENTITY RFC6335 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6335.xml">
  <!ENTITY RFC6374 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6374.xml">
  <!ENTITY RFC6398 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6398.xml">
  <!ENTITY RFC8085 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8085.xml">
  <!ENTITY RFC8762 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8762.xml">
  <!ENTITY RFC8972 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8972.xml">
  <!ENTITY RFC8986 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8986.xml">
  <!ENTITY RFC9503 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9503.xml">
  <!ENTITY RFC9534 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9534.xml">
  <!ENTITY RFC2113 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2113.xml">
  <!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC5905 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5905.xml">
  <!ENTITY RFC6437 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6437.xml">
  <!ENTITY RFC7404 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7404.xml">
  <!ENTITY RFC8174 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY RFC8200 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8200.xml">
  <!ENTITY RFC8402 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8402.xml">
  <!ENTITY RFC8754 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8754.xml">
  <!ENTITY RFC9256 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9256.xml">
  <!ENTITY RFC9350 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9350.xml">
  <!ENTITY RFC9780 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9780.xml">
  <!ENTITY RFC9800 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9800.xml">

]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" docName="draft-ietf-spring-stamp-srpm-srv6-11" category="info" ipr="trust200902" obsoletes="" updates="8972" xml:lang="en" sortRefs="false" consensus="yes" symRefs="true" tocInclude="true" version="3">
  <front>
    <title abbrev="STAMP for Segment Routing over IPv6">Performance Measurement Using Simple Two-Way Active Measurement Protocol (STAMP) for Segment Routing over the IPv6 (SRv6) Data Plane</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-spring-stamp-srpm-srv6-11"/>
    <author fullname="Rakesh Gandhi" initials="R." role="editor" surname="Gandhi">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>Canada</street>
        </postal>
        <email>rgandhi@cisco.com</email>
      </address>
    </author>
    <author fullname="Clarence Filsfils" initials="C." surname="Filsfils">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <email>cfilsfil@cisco.com</email>
      </address>
    </author>
    <author fullname="Bart Janssens" initials="B." surname="Janssens">
      <organization>Colt</organization>
      <address>
        <email>Bart.Janssens@colt.net</email>
      </address>
    </author>
    <author fullname="Mach(Guoyi) Chen" initials="M." surname="Chen">
      <organization>Huawei</organization>
      <address>
        <email>mach.chen@outlook.com</email>
      </address>
    </author>
    <author fullname="Richard Foote" initials="R." surname="Foote">
      <organization>Nokia</organization>
      <address>
        <email>footer.foote@nokia.com</email>
      </address>
    </author>

    <date year="2026"/>
    <workgroup>SPRING Working Group</workgroup>
    <abstract>
      <t>
   Segment Routing (SR) can be used to steer packets through a
   network employing source routing.  SR can be applied to both MPLS
   (SR-MPLS) and IPv6 (SRv6) data planes.

  This document describes the procedures for performance measurement in SRv6 networks using the
   Simple Two-Way Active Measurement Protocol (STAMP), as specified in RFC 8762,
  along with its optional extensions specified in RFC 8972 and the SR-specific extensions specified in RFC 9503.

  These procedures measure links and SRv6 paths including Segment Lists of SR Policies, SRv6 IGP best paths, and SRv6 IGP
  Flexible Algorithm (Flex-Algo) paths, as well as Layer-3 and Layer-2 services carried over those paths.
   </t>

    <t>
  This document updates RFC 8972 for the definition of the STAMP session identifier for SRv6.
  </t>

    </abstract>
  </front>
  <middle>
    <section anchor="sect-1" numbered="true" toc="default">
      <name>Introduction</name>
   <t>
   Segment Routing (SR) <xref target="RFC8402" format="default"/> can be used to steer packets through a
   network employing source routing.  SR can be applied to both MPLS
   (SR-MPLS) and IPv6 (SRv6) data planes.

   SR can take advantage of
   Equal-Cost Multipath (ECMP) between source and transit nodes,
   between transit nodes, and between transit and destination nodes. SR
   Policies, as specified in <xref target="RFC9256" format="default"/>, are used
   to steer traffic through specific user-defined paths, each represented by a list of segments.
  </t>

  <t>
  A comprehensive SR performance measurement toolset is essential for measuring network performance and meeting Service Level
  Agreements (SLAs).
  </t>

  <t>
  The Simple Two-Way Active Measurement Protocol (STAMP), as specified in <xref target="RFC8762" format="default"/>, provides
  the capability to measure various performance metrics in IP networks 
  without the use of a control channel to pre-signal session parameters.
  <xref target="RFC8972" format="default"/> specifies optional extensions in the form of Type-Length-Value (TLV) objects 
  for STAMP, and <xref target="RFC9503" format="default"/> further augments that framework 
  to define STAMP extensions for SR networks.
   </t>

   <t>
  This document describes procedures for measuring performance in SRv6 networks using STAMP as specified in <xref target="RFC8762" format="default"/>, along with the optional extensions specified in <xref target="RFC8972" format="default"/> and the SR-specific extensions specified in <xref target="RFC9503" format="default"/>.
  The procedures in this document measure links and SRv6 paths <xref target="RFC8402" format="default"/> including Segment Lists of SR Policies <xref target="RFC9256" format="default"/>, SRv6 IGP best paths, and SRv6 Flexible Algorithm (Flex-Algo) paths <xref target="RFC9350" format="default"/>, as well as Layer-3 (L3) and Layer-2 (L2) services carried over those paths.
  The procedures specified in this document are intended for deployment in a single network administrative domain.
   </t>

   <t>
  STAMP requires protocol support as specified in <xref target="RFC8762" format="default"/> on the Session-Reflector to process received STAMP-Test packets, including optional TLVs specified in <xref target="RFC8972" format="default"/>, and to generate Session-Reflector test packets and reflect received TLVs.
  In addition, use of the UDP port number in STAMP-Test packets exposes the Session-Reflector to security threats and requires rate limiting and consideration of operational impacts.
  In practice, these requirements lead implementations to process STAMP-Test packets on an exception path (e.g., by punting them from the IP-forwarding fast path).
  This limits the frequency of STAMP-Test packets and the ability to provide shorter measurement intervals.
    </t>

    <t>
  This document defines new mechanisms to enhance the procedures for performance measurement using STAMP, improve scalability by supporting a larger number of STAMP sessions, and shorten the measurement interval for links and SRv6 paths by defining three measurement modes: one-way measurement mode, loopback measurement mode, and loopback with Timestamp and Forward (TSF) measurement mode. The loopback measurement mode and the loopback with TSF measurement mode take advantage of source routing.
   </t>

   <t>
  This document updates RFC 8972 for the definition of the STAMP session identifier for SRv6.
  </t>

    </section>

    <section anchor="sect-2" numbered="true" toc="default">
      <name>Conventions Used in This Document</name>
      <section anchor="sect-2.1" 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 target="RFC8174" format="default"/>
    when, and only when, they appear in all capitals, as shown here.
   </t>
      </section>

      <section anchor="sect-2.2" numbered="true" toc="default">
        <name>Terminology</name>
        <t>This document uses the terms Session-Sender, Session-Reflector, and STAMP-Test packet as defined in <xref target="RFC8762" format="default"/>.</t>

        <t>This document uses timestamps T1, T2, T3, and T4 and the one-way delay metric (T2 - T1), the two-way delay metric ((T4 - T1) - (T3 - T2)), and the round-trip delay metric (T4 - T1), as defined in Section 2.4 of <xref target="RFC6374" format="default"/>.</t>

        <t>Round-trip delay: <xref target="RFC2681" section="2.7.2" format="default"/> defines round-trip delay as the wire-time interval from when a test packet leaves the source's network interface (T1) until the corresponding response packet has completely arrived there (T4). When the packet arrives at the destination, the destination sends a corresponding response to the source as soon as possible (<xref target="RFC2681" section="2.6" format="default"/>). The time at the destination between packet receipt (T2) and response transmission (T3) is ideally zero; any nonzero time adds error and uncertainty to the round-trip measurement (<xref target="RFC2681" section="2.7.2" format="default"/>; <xref target="RFC2681" section="2.7.3" format="default"/>).</t>
      </section>

      <section anchor="sect-2.3" numbered="true" toc="default">
        <name>Abbreviations</name>
        <table anchor="tbl-abbreviations" align="center">
          <name>Abbreviations</name>
          <thead>
            <tr>
              <th align="left">Abbreviation</th>
              <th align="left">Expansion</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">ARP</td>
              <td align="left">Address Resolution Protocol</td>
              <td align="left"><xref target="RFC0826" format="default"/></td>
            </tr>
            <tr>
              <td align="left">CSID</td>
              <td align="left">Compressed Segment Identifier</td>
              <td align="left"><xref target="RFC9800" format="default"/></td>
            </tr>
            <tr>
              <td align="left">HMAC</td>
              <td align="left">Hashed Message Authentication Code</td>
              <td align="left"><xref target="RFC6234" format="default"/></td>
            </tr>
            <tr>
              <td align="left">HL</td>
              <td align="left">Hop Limit</td>
              <td align="left"><xref target="RFC8200" format="default"/></td>
            </tr>
            <tr>
              <td align="left">LAG</td>
              <td align="left">Link Aggregation Group</td>
              <td align="left"><xref target="IEEE802.1AX" format="default"/></td>
            </tr>
            <tr>
              <td align="left">L2</td>
              <td align="left">Layer-2</td>
              <td align="left"><xref target="RFC4026" format="default"/></td>
            </tr>
            <tr>
              <td align="left">L2VPN</td>
              <td align="left">Layer-2 Virtual Private Network</td>
              <td align="left"><xref target="RFC4026" format="default"/></td>
            </tr>
            <tr>
              <td align="left">L3</td>
              <td align="left">Layer-3</td>
              <td align="left"><xref target="RFC4026" format="default"/></td>
            </tr>
            <tr>
              <td align="left">L3VPN</td>
              <td align="left">Layer-3 Virtual Private Network</td>
              <td align="left"><xref target="RFC4026" format="default"/></td>
            </tr>
            <tr>
              <td align="left">NDP</td>
              <td align="left">Neighbor Discovery Protocol</td>
              <td align="left"><xref target="RFC4861" format="default"/></td>
            </tr>
            <tr>
              <td align="left">NTP</td>
              <td align="left">Network Time Protocol</td>
              <td align="left"><xref target="RFC5905" format="default"/></td>
            </tr>
            <tr>
              <td align="left">OAM</td>
              <td align="left">Operations, Administration, and Maintenance</td>
              <td align="left"><xref target="RFC8762" format="default"/></td>
            </tr>
            <tr>
              <td align="left">PSP</td>
              <td align="left">Penultimate Segment Popping</td>
              <td align="left"><xref target="RFC8986" format="default"/></td>
            </tr>
            <tr>
              <td align="left">PTP</td>
              <td align="left">Precision Time Protocol</td>
              <td align="left"><xref target="IEEE.1588" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SHA</td>
              <td align="left">Secure Hash Algorithms</td>
              <td align="left"><xref target="RFC6234" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SID</td>
              <td align="left">Segment Identifier</td>
              <td align="left"><xref target="RFC8402" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SR</td>
              <td align="left">Segment Routing</td>
              <td align="left"><xref target="RFC8402" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SRH</td>
              <td align="left">Segment Routing Header</td>
              <td align="left"><xref target="RFC8754" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SRv6</td>
              <td align="left">Segment Routing over the IPv6 data plane</td>
              <td align="left"><xref target="RFC8402" format="default"/></td>
            </tr>
            <tr>
              <td align="left">SSID</td>
              <td align="left">STAMP Session Identifier</td>
              <td align="left"><xref target="RFC8972" format="default"/></td>
            </tr>
            <tr>
              <td align="left">STAMP</td>
              <td align="left">Simple Two-Way Active Measurement Protocol</td>
              <td align="left"><xref target="RFC8762" format="default"/></td>
            </tr>
            <tr>
              <td align="left">TLV</td>
              <td align="left">Type-Length-Value</td>
              <td align="left"><xref target="RFC8972" format="default"/></td>
            </tr>
            <tr>
              <td align="left">TSF</td>
              <td align="left">Timestamp and Forward</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">TTL</td>
              <td align="left">Time to Live</td>
              <td align="left"><xref target="RFC0791" format="default"/></td>
            </tr>
            <tr>
              <td align="left">VPN</td>
              <td align="left">Virtual Private Network</td>
              <td align="left"><xref target="RFC4026" format="default"/></td>
            </tr>
          </tbody>
        </table>
      </section>

    </section>
    <section anchor="sect-3" numbered="true" toc="default">
      <name>Overview</name>
    <t>
    For performance measurement in SRv6 networks, the STAMP Session-Sender and Session-Reflector use the STAMP-Test packets specified in <xref target="RFC8762" format="default"/>, along with optional extensions specified in <xref target="RFC8972" format="default"/>. The STAMP-Test packets are encapsulated using an IP/UDP header, as specified in <xref target="RFC8762" format="default"/>. In this document, STAMP-Test packets use an IP/UDP header and are further encapsulated with an IPv6 Segment Routing Header (SRH) for use in SRv6 networks.
    </t>

    <t>
    In SRv6 networks, STAMP-Test packets can use one of the following measurement modes, which differ in how the Session-Reflector processes the packets:
    </t>

    <ol>
      <li><t>Two-Way measurement mode:</t>
          <t>The Session-Reflector generates and transmits Session-Reflector test packets (see <xref target="sect-4.1" format="default"/>).</t>
      </li>

      <li><t>One-Way measurement mode:</t>
          <t>The Session-Reflector does not generate or transmit Session-Reflector test packets (see <xref target="sect-4.2" format="default"/>).</t>

      </li>

      <li><t>Loopback measurement mode:</t>
          <t>The Session-Reflector does not perform STAMP processing (see <xref target="sect-4.3" format="default"/>).</t>
      </li>

      <li><t>Loopback with TSF measurement mode:</t>
          <t>The Session-Reflector writes the receive timestamp in the fast path but does not perform STAMP processing (see <xref target="sect-4.4" format="default"/>).</t>
      </li>
    </ol>
    
    <t>
    Note that the two-way measurement mode is specified as part of the STAMP process in <xref target="RFC8762" format="default"/> and is further specified for SRv6 networks in this document. The other measurement modes are new, specific to SRv6 networks, and are not specified in <xref target="RFC8762" format="default"/>.
    </t>

    <t>
    STAMP-Test packets are transmitted on the same path as the data traffic flow being measured to measure the delay and packet loss experienced by the data traffic flow, using the same IPv6/SRH encapsulation.
    </t>

    <ul spacing="normal">
      <li><t>STAMP-Test packets are transmitted on various transport data paths in the network to measure the delay and packet loss experienced by the traffic forwarded on those paths.</t></li>
      <li><t>STAMP-Test packets are transmitted over L3 and L2 services in the network to measure the delay and packet loss experienced by the traffic carried by those services.</t></li>
    </ul>

    <t>
    Two encoding modes are defined in this document for STAMP-Test packets in the SRv6 data plane: Insert-Mode and Encaps-Mode. The Session-Sender generates STAMP-Test packets locally in either of the two encapsulation modes, based on local provisioning.
    </t>

    <ul spacing="normal">
        <li><t>In Insert-Mode:</t> 
        <t>An SRH is inserted after the IPv6 header of the test packets. This is further described in <xref target="sect-6.3" format="default"/>.</t></li>
        <li><t>In Encaps-Mode:</t> 
        <t>The test packets with an IP header are further encapsulated with an outer IPv6/SRH. This is further described in <xref target="sect-6.3" format="default"/>.</t></li>
    </ul>

    <t>
    Typically, STAMP Session-Reflector test packets are transmitted along an IP path between the Session-Reflector and Session-Sender. The forward-direction path and the return path of STAMP-Test packets are not guaranteed to match, even for directly connected nodes. In SRv6 networks, the same path (i.e., the same set of links and nodes) between the Session-Sender and Session-Reflector might be desirable for the STAMP-Test packets in both directions, for example, in an ECMP environment. This is achieved as follows:
    </t>

    <ul spacing="normal">
    <li><t>In two-way measurement mode:</t>
    <t>The optional STAMP extensions for SRv6 networks, as specified in <xref target="RFC9503" format="default"/>, are used. The STAMP Session-Reflector uses the return path parameters for the Session-Reflector test packet from the STAMP extensions in the received Session-Sender test packet, as specified in <xref target="RFC9503" format="default"/>.
    </t>
    </li>
    <li><t>In the loopback measurement mode and loopback with TSF measurement mode: </t> 
    <t>Both the forward path and the return path are included in the IPv6/SRH encapsulation of the Session-Sender test packets using source routing.</t>
    </li>
    </ul>

    <t>
The procedures in this document measure delay and packet loss in SRv6 networks by transmitting and receiving STAMP-Test packets. The optional STAMP extensions specified in <xref target="RFC8972" format="default"/> are used for direct measurement in SRv6 networks.
    </t>

    <t>
The compression of an SRv6 Segment List, as specified in <xref target="RFC9800" format="default"/>, is equally applicable to the performance measurement procedures defined in this document and can significantly reduce the size of the SRv6 encapsulation needed to transmit STAMP-Test packets over long Segment Lists. All examples described in this document using SRv6 Segment Identifiers (SIDs) can be similarly implemented using SRv6 Compressed-SIDs (CSIDs) <xref target="RFC9800" format="default"/>.
    </t>

    </section>

    <section anchor="sect-4-modes" numbered="true" toc="default">
      <name>Measurement Modes</name>

<t>
In <xref target="ure-reference-topology-two-way" format="default"/> to <xref target="ure-loopback-mode-with-tsf" format="default"/>, the nodes S1 and R1 may be connected via a link or an SRv6 path <xref target="RFC8402" format="default"/>.  
</t>

<t>
The link can be a physical interface, a virtual link, a Link Aggregation Group (LAG) <xref target="IEEE802.1AX" format="default"/>, or a LAG member link. 
</t> 

<t>
The SRv6 path may be a Segment List of an SR Policy <xref target="RFC9256" format="default"/> on node S1 (referred to as the "head-end") with node R1 as the destination (referred to as the "endpoint"), an SRv6 IGP best path, or an SRv6 IGP Flex-Algo path <xref target="RFC9350" format="default"/>. Additionally, an L3 or L2 VPN service may be carried over the SRv6 path between nodes S1 and R1.
</t>

      <section anchor="sect-4.1" numbered="true" toc="default">
        <name>Two-Way Measurement Mode</name>

<t>
As shown in <xref target="ure-reference-topology-two-way" format="default"/>, in two-way measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet, and the STAMP Session-Reflector R1 generates and transmits a Session-Reflector test packet. The Session-Reflector test packet is sent to the Session-Sender S1 on either the same path (i.e., the same set of links and nodes) or a different path in the reverse direction from the path taken toward the Session-Reflector R1.
</t>

          <figure anchor="ure-reference-topology-two-way">
          <name>Reference Topology for Two-Way Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - ->|       |
         |   S1  |=================================|   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+   Session-Reflector test packet +-------+
                  \                               /
                   T4                           T3

     STAMP Session-Sender                 STAMP Session-Reflector
]]></artwork>
        </figure>

    <t>
T1 is a transmit timestamp, and T4 is a receive timestamp added by node S1. T2 is a receive timestamp, and T3 is a transmit timestamp added by node R1. All four timestamps are used by the Session-Sender to measure the two-way delay metric, defined as ((T4 - T1) - (T3 - T2)) in <xref target="sect-2.2" format="default"/>. Timestamps T1 and T2 are used by the Session-Sender to measure the forward one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>. Note that the delay value (T4 - T3), measured by the Session-Sender, is the reverse one-way delay metric.
The "two-way delay" is the sum of the one-way delays in each direction and reflects the delay of the bidirectional path, irrespective of processing delays within the Session-Reflector.
</t>

<t>In two-way measurement mode, the round-trip delay interval (T4 - T1) includes the Session-Reflector processing time, including handling the UDP header in the exception path, generating the Session-Reflector test packet, and reflecting optional TLVs. The two-way delay metric subtracts the Session-Reflector interval (T3 - T2) from the round-trip delay interval.</t>

<t>
The computation of the one-way delay metric requires the clocks on the Session-Sender and the Session-Reflector to be synchronized, e.g., using either PTPv2 <xref target="IEEE.1588" format="default"/> or NTPv4 <xref target="RFC5905" format="default"/>.
</t> 

    <t>
    In two-way measurement mode, round-trip packet loss, near-end packet loss (forward direction), and far-end packet loss (backward direction) can be measured.
    Note that packet loss measurement does not require the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.
    </t>
 
      </section>

      <section anchor="sect-4.2" numbered="true" toc="default">
        <name>One-Way Measurement Mode</name>

<t>
As shown in <xref target="ure-reference-topology-one-way" format="default"/>, in one-way measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet. Upon receiving a Session-Sender test packet, the STAMP Session-Reflector does not transmit a Session-Reflector test packet.
</t>


          <figure anchor="ure-reference-topology-one-way">
          <name>Reference Topology for One-Way Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - ->|       |
         |   S1  |=================================|   R1  |
         |       |                                 |       |
         +-------+                                 +-------+

     STAMP Session-Sender                 STAMP Session-Reflector
  ]]></artwork>
        </figure>

<t>
T1 is a transmit timestamp added by node S1, and T2 is a receive timestamp added by node R1. Timestamps T1 and T2 are used by the Session-Reflector to measure the one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>.
</t>

<t>
The computation of the one-way delay metric requires the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.
</t>

    <t>
    In one-way measurement mode, forward-direction packet loss can be measured. The Session-Reflector compares the Session-Sender Sequence Number in each received Session-Sender test packet with the sequence number in the previously received packet. An increase of k indicates that k-1 test packets were not received, accounting for sequence-number wraparound. This measurement is available at the Session-Reflector.  Note that packet loss measurement does not require the clocks on the Session-Sender and the Session-Reflector to be synchronized using either PTPv2 or NTPv4.        
    </t>


      </section>

      <section anchor="sect-4.3" numbered="true" toc="default">
        <name>Loopback Measurement Mode</name>

<t>
   As shown in <xref target="ure-reference-topology-for-loopback" format="default"/>, in loopback measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet to measure the round-trip delay using source routing. The node R1 at the end of the configured forward path forwards the received STAMP-Test packet along the configured return path using its forwarding state in the data plane. The node R1 does not need to support STAMP or maintain a STAMP session.
</t>

          <figure anchor="ure-reference-topology-for-loopback">
          <name>Reference Topology for Loopback Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1               
                  /                
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - - |       |
         |   S1  |================================||   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+     Session-Sender test packet  +-------+
                  \    (Return)     
                   T4               

    STAMP Session-Sender                 STAMP Session-Reflector
                                         (Loopback, Forward)
]]></artwork>
            </figure>


<t>
T1 is a transmit timestamp and T4 is a receive timestamp added by node S1. The Session-Sender uses them to measure the round-trip delay metric, defined as (T4 - T1) in <xref target="sect-2.2" format="default"/>. This delay includes test packet processing on the node R1 in the data plane. The processing delay includes only the time required to forward the test packet from the incoming interface to the outgoing interface in the data plane. The node R1 does not timestamp the test packets and therefore does not require a timestamping capability.
</t>

    <t>
    In loopback measurement mode, only round-trip packet loss can be measured.
    </t>

      </section>

      <section anchor="sect-4.4" numbered="true" toc="default">
        <name>Loopback with TSF Measurement Mode</name>

<t>
As shown in <xref target="ure-loopback-mode-with-tsf" format="default"/>, in the reference topology for loopback with TSF measurement mode, the STAMP Session-Sender S1 initiates a Session-Sender test packet in loopback measurement mode using source routing. The TSF mechanism optimizes the operation of punting the test packet from the data-plane fast path for control-plane processing and generating the return Session-Sender test packet on the STAMP Session-Reflector R1, because timestamp writing is implemented in the data-plane fast path. This helps achieve a higher number of STAMP sessions and faster measurement intervals.
</t>

              <figure anchor="ure-loopback-mode-with-tsf">
          <name>Reference Topology for Loopback with TSF Measurement Mode</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                   T1                           T2
                  /                               \
         +-------+  Session-Sender Test Packet     +-------+
         |       | - - - - - - - - - - - - - - - - |       |
         |   S1  |================================||   R1  |
         |       |<- - - - - - - - - - - - - - - - |       |
         +-------+     Session-Sender test packet  +-------+
                  \    (Return)               
                   T4                        

     STAMP Session-Sender               STAMP Session-Reflector
                                        (Loopback, TSF)
 ]]></artwork>
        </figure>

    <t>
T1 is a transmit timestamp and T4 is a receive timestamp added by node S1. 
The Session-Reflector R1 writes the receive timestamp (T2) in the received STAMP-Test packet in the fast path in the data plane, without punting the test packet from the fast path in the data plane for control-plane STAMP processing.
In this mode, a node that performs the TSF needs to support the applicable End.TSF endpoint behavior, as specified in <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
Timestamps T1 and T2 are used by the Session-Sender to measure the one-way delay metric, defined as (T2 - T1) in <xref target="sect-2.2" format="default"/>. Timestamps T1 and T4 are used by the Session-Sender to measure the round-trip delay metric, defined as (T4 - T1) in <xref target="sect-2.2" format="default"/>.
</t>

    <t>
    In loopback with TSF measurement mode, only round-trip packet loss can be measured.
    </t>

      </section>


    </section>

    <section anchor="sect-5" numbered="true" toc="default">
      <name>STAMP Reference Model</name>

        <t>
The STAMP Reference Model from <xref target="RFC8762" format="default"/>, augmented with an SDN Controller for Configuration and Management and typical measurement parameters for a STAMP session, is shown in <xref target="ure-reference-model" format="default"/>.
    </t>

        <figure anchor="ure-reference-model">
          <name>STAMP Reference Model</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
                          +------------+
                          |    SDN     |
                          | Controller |
                          +------------+
                               /  \
Measurement Mode              /    \      Stateful or Stateless 
Destination UDP Port Number  /      \     Destination UDP Port Number
Authentication Mode         /        \    Authentication Mode
Authentication Key         /          \   Authentication Key
Timestamp Format          /            \  Timestamp Format 
SSID                     /              \ SSID 
Metric Types            /                \  
                       v                  v
                   +-------+          +-------+
                   |       |  STAMP   |       |
                   |   S1  |==========|   R1  |
                   |       |  Session |       |
                   +-------+          +-------+

            STAMP Session-Sender  STAMP Session-Reflector
]]></artwork>
        </figure>

<t>
The procedures specified in <xref target="RFC8762" format="default"/> and <xref target="RFC8972" format="default"/> correspond to the two-way measurement mode defined in this document.
</t>

<t>
The STAMP-Test packet payloads specified in <xref target="RFC8972" format="default"/> are transported using an IPv4 or IPv6 header and a UDP header.
The IPv4 or IPv6 header and the UDP header follow the procedures specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" section="3.1" format="default"/>.
The same or a different destination UDP port number may be used for STAMP sessions for links, SRv6 paths, and L3 and L2 services carried over SRv6 paths, subject to the mode-specific UDP port selection rules in <xref target="sect-14" format="default"/>.
Similarly, the same or a different source UDP port number can be used for STAMP sessions for links, SRv6 paths, and L3 and L2 services carried over those paths.
</t>

<t>
The Session-Sender and Session-Reflector IP addresses for a STAMP session are provisioned by the operator for the session.
In addition, SRv6 node prefix SIDs can be provisioned for the Session-Sender and the Session-Reflector and used in STAMP-Test packets instead of their IP addresses.
</t>

<t>
The Session-Reflector mode can be either Stateful or Stateless, as specified in <xref target="RFC8762" section="4" format="default"/>. Stateless Session-Reflector mode is applicable only in two-way measurement mode.</t>

<t>
For two-way and one-way measurement modes, when authentication is used, the Session-Sender and Session-Reflector must be configured with the same HMAC key, as specified in <xref target="RFC8762" section="4.4" format="default"/>. In loopback measurement mode, the Session-Sender can use an HMAC key to add an HMAC to its test packet and verify the HMAC when the packet is returned; the Session-Reflector forwards the packet without validating the HMAC and does not need the key.
</t>

<t>The supported timestamp formats are a 64-bit truncated Precision Time Protocol (PTPv2) timestamp <xref target="IEEE.1588" format="default"/> and a 64-bit Network Time Protocol (NTPv4) timestamp <xref target="RFC5905" format="default"/>. The Z field identifies the timestamp format used by the STAMP Session-Sender and Session-Reflector, as specified in <xref target="RFC8762" section="4.2.1" format="default"/>.</t>

<t>Examples of delay metrics are one-way delay, two-way delay, forward one-way delay, and reverse one-way delay, as specified in <xref target="RFC8762" format="default"/>.</t>

<t>Examples of packet loss metric types are round-trip packet loss, near-end packet loss (forward direction), and far-end packet loss (backward direction), as specified in <xref target="RFC8762" format="default"/>.</t>

<t>
The IPv4 TTL and IPv6 Hop Limit (HL) fields must follow the specification defined in <xref target="RFC8762" format="default"/>.
The IPv4 TTL and IPv6 HL must be set to 255 in both Session-Sender and Session-Reflector test packets, as this allows the number of hops that IP-forwarded the test packet to be determined.
</t>

<t>
The IPv6 Flow Label field is set as follows:
</t>

<ul>
  <li><t>The IPv6 Flow Label field in each Session-Sender test packet must be set to the value used by the data packets for the IPv6 traffic flow being measured by the Session-Sender.</t></li>
  <li><t>Unless local policy explicitly specifies otherwise, the Session-Reflector must set the IPv6 Flow Label field in its test packet to the value received in the Session-Sender test packet.</t></li>
  <li><t>Local policy may specify that the Session-Reflector replaces the received value with a locally configured value.</t></li>
</ul>

<t>A Software-Defined Networking (SDN) controller can be used for the configuration and management of STAMP sessions, as specified in <xref target="RFC8762" format="default"/>. The controller can also receive streaming telemetry of operational data. The YANG data model for STAMP, defined in <xref target="I-D.ietf-ippm-stamp-yang" format="default"/>, can be used to configure Session-Senders and Session-Reflectors and to stream telemetry of operational data.</t>

<t>In two-way measurement mode, the Session-Sender retrieves timestamp T1, T2, and T3 from the received Session-Reflector test packet as specified in <xref target="RFC8762" format="default"/> and collects the receive timestamp T4 locally. </t>

    <section anchor="sect-5.1" numbered="true" toc="default">
        <name>STAMP for One-Way Measurement Mode</name>
<t>
In one-way measurement mode, the Session-Reflector must operate in Stateful mode.
</t>

<t>
In one-way measurement mode, one of the following configurations for the destination UDP port number is used:
</t>

<ul>
  <li><t>A different destination UDP port number may be selected instead of the UDP port number used by the Session-Reflector for the two-way measurement mode. A different UDP port number does not by itself signal the measurement mode. When a different UDP port is used, the Session-Reflector must associate packets received on that UDP port with the configured one-way session. Destination UDP port selection and endpoint configuration are specified in <xref target="sect-14.7" format="default"/>.</t></li>
  <li><t>If the same Session-Reflector UDP port number is used for one-way and two-way measurement modes, the Session-Sender must include the "No Reply Requested" flag in the Control Code Sub-TLV within the Return Path TLV defined in <xref target="RFC9503" format="default"/>. The Session-Reflector must process this Control Code Sub-TLV in one-way measurement mode, must not transmit Session-Reflector test packets in response, and must terminate the received STAMP-Test packet.</t></li>
</ul>

<t>In one-way measurement mode, the Session-Reflector retrieves timestamp T1 from the Timestamp field of the received Session-Sender test packet and collects the receive timestamp T2 locally.</t>

    </section>

        <section anchor="sect-5.2" numbered="true" toc="default">
          <name>STAMP for Loopback and Loopback with TSF Measurement Modes</name>

<t>
In the loopback measurement mode and the loopback with TSF measurement mode, the node at the end of the forward path (referred to as the Session-Reflector in this document) must process the IPv6/SRH header according to the specified forwarding procedure, must not perform STAMP processing, must not modify the STAMP-Test packet except where the End.TSF procedure explicitly requires timestamp modification, and must forward the packet using the specified return-path mechanism. A node performing the End.TSF behavior must support the applicable endpoint behavior, as specified in <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
The Session-Sender must set the destination UDP port number to the UDP port number it uses to receive return Session-Sender test packets. This UDP port must not be 862, which is the default UDP port number used by the Session-Reflector. The same UDP port number may be used as both the destination and source UDP port numbers in the Session-Sender test packets. Port selection is summarized in <xref target="sect-14" format="default"/>.
</t>

<t>
The "Session-Sender Sequence Number", the "Session-Sender Timestamp", the "Session-Sender Error Estimate", and the "Session-Sender TTL" fields in the Session-Reflector test packet, shown in Figure 5 of <xref target="RFC8762" format="default"/>, must be set to zero in the transmitted Session-Sender test packets, as specified in <xref target="RFC8762" format="default"/>. These fields must be ignored in the return Session-Sender test packets received at the Session-Sender in the loopback measurement mode and the loopback with TSF measurement mode.
</t>

<t>
In both the loopback measurement mode and the loopback with TSF measurement mode, 
the Session-Sender adds the transmit timestamp (T1) to the payload of the Session-Sender test packet.
</t>

<t>In loopback measurement mode, the Session-Sender retrieves timestamp T1 from the Timestamp field of the returned Session-Sender test packet and collects the receive timestamp T4 locally.</t>

<t>In loopback with TSF measurement mode, the Session-Reflector writes the receive timestamp (T2) in the received STAMP-Test packet in the fast path in the data plane, without punting the test packet from the fast path in the data plane for control-plane STAMP processing. The Session-Sender retrieves timestamp T1 from the Timestamp field of the returned Session-Sender test packet, retrieves timestamp T2 from the location of the Receive Timestamp field, and collects the receive timestamp T4 locally. </t>

        </section>

      <section anchor="sect-5.4" numbered="true" toc="default">
        <name>Measurement Mode Comparison for STAMP</name>
        <table anchor="measurement-mode-comparison" align="center">
          <name>Measurement Mode Comparison for Applicability in STAMP</name>
          <thead>
            <tr>
              <th align="left">Mode</th>
              <th align="left">STAMP Reflector</th>
              <th align="left">Timestamp</th>
              <th align="left">Delay Metrics</th>
              <th align="left">Loss Metrics</th>
              <th align="left">Direct Measurement</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
          <tr><td>Two-Way</td><td>Stateful or Stateless</td><td>T1/T2/T3/T4</td><td>OW, TW</td><td>One-Way, Round-trip</td><td>Applicable</td><td><xref target="RFC8762" format="default"/></td></tr>
            <tr><td>One-Way</td><td>Stateful</td><td>T1/T2</td><td>OW</td><td>One-Way</td><td>Applicable</td><td>This document</td></tr>
            <tr><td>Loopback</td><td>N/A</td><td>T1/T4</td><td>RT</td><td>Round-trip</td><td>Not Applicable</td><td>This document</td></tr>
            <tr><td>Loopback with TSF</td><td>N/A</td><td>T1/T2/T4</td><td>OW, RT</td><td>Round-trip</td><td>Not Applicable</td><td>This document</td></tr>
          </tbody>
        </table>

    <t>Delay metric abbreviations and clock synchronization requirements:</t>
    <ul>
      <li><t>OW: One-way delay metric (T2 - T1); computation requires clock synchronization.</t></li>
      <li><t>TW: Two-way delay metric ((T4 - T1) - (T3 - T2)); computation does not require clock synchronization.</t></li>
      <li><t>RT: Round-trip delay metric (T4 - T1); computation does not require clock synchronization.</t></li>
    </ul>

      <section anchor="sect-5.4.1" numbered="true" toc="default">
        <name>STAMP TLV Applicability</name>

      <t>The following STAMP TLVs specified for the two-way measurement mode are applicable in the one-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode:</t>
      <ul>
        <li><t>Type 1 (Extra Padding) <xref target="RFC8972" format="default"/>.</t></li>
      </ul>

      <t>Type 8 (HMAC) <xref target="RFC8972" format="default"/> is applicable in the one-way measurement mode and the loopback measurement mode, but is not applicable in the loopback with TSF measurement mode.</t>

      <t>Type 11 (Micro-Session ID) <xref target="RFC9534" format="default"/> can be used to identify LAG member link micro-sessions.</t>

      <t>Within Type 10 (Return Path) <xref target="RFC9503" format="default"/>, the following Sub-TLVs are applicable:</t>
      <ul>
        <li>
          <t>Control Code Sub-TLV:</t>
          <ul>
            <li><t>When the same Session-Reflector UDP port number is used for one-way and two-way sessions, the "No Reply Requested" requirement specified in <xref target="sect-5.1" format="default"/> applies.</t></li>
            <li><t>The "Reply Requested on the Same Link" value is applicable in two-way measurement mode.</t></li>
          </ul>
        </li>
        <li><t>The Return IPv4 or IPv6 Address (Sub-TLV Type 2) is applicable only in two-way measurement mode.</t></li>
        <li><t>The SRv6 Segment List of the Return Path (Sub-TLV Type 4) is applicable only in two-way measurement mode.</t></li>
      </ul>

      <t>Type 5 (Direct Measurement) <xref target="RFC8972" format="default"/> is applicable in the two-way measurement mode and the one-way measurement mode. It is not applicable in the loopback measurement mode or the loopback with TSF measurement mode.</t>

      <t>In the two-way measurement mode and the one-way measurement mode, Type 9 (Destination Node IPv4 or IPv6 Address) <xref target="RFC9503" format="default"/> carries the Session-Reflector IP address. In the loopback measurement mode and the loopback with TSF measurement mode, it carries the Session-Sender IP address. For link measurements, it carries the Session-Reflector link IP address in two-way and one-way measurement modes and the Session-Sender link IP address in loopback measurement mode.</t>

      <t>The following STAMP TLVs specified for the two-way measurement mode are not applicable in the one-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode:</t>
      <ul>
        <li><t>Type 2 (Location) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 3 (Timestamp Information) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 4 (Class of Service) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 6 (Access Report) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 7 (Follow-Up Telemetry) <xref target="RFC8972" format="default"/>.</t></li>
        <li><t>Type 12 (Reflected Test Packet Control) <xref target="RFC10052" format="default"/>.</t></li>
        <li><t>Reflected IPv6 Extension Header Data <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.</t></li>
        <li><t>Reflected Fixed Header Data <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.</t></li>
      </ul>

      <t>A STAMP session operating in the one-way measurement mode, the loopback measurement mode, or the loopback with TSF measurement mode must ignore any TLV listed above that is not applicable to that mode when the session receives a STAMP-Test packet containing that TLV.</t>

      </section>

      </section>

    <section anchor="sect-5.5" numbered="true" toc="default">
      <name>STAMP Session Identifier for SRv6</name>

      <t>
      <xref target="RFC8972" section="3" format="default"/> defines the STAMP session identifier as follows:
      </t>

       <ul>
         <li><t>"A STAMP Session is identified by the 4-tuple (source and destination IP addresses, source and destination UDP port numbers)".</t></li>
         <li><t>"An implementation of the STAMP Session-Reflector that supports this specification must identify a STAMP Session using the SSID in combination with elements of the usual 4-tuple for the session".</t></li>
       </ul>

      <t>
        This document updates the definition of the STAMP session identifier
        in <xref target="RFC8972" section="3" format="default"/> for SRv6 for the following reasons:
      </t>

      <ul>
        <li><t>STAMP test packets for SRv6 can carry a non-routable destination IP address.</t></li>
        <li><t>The source UDP port number is selected using a randomized allocation method, as specified in <xref target="RFC6056" format="default"/>.</t></li>
      </ul>

      <t>
        For SRv6 paths and links, the Session-Sender must include a nonzero SSID in each Session-Sender test packet. The following procedures apply to STAMP session identification using the SSID in each measurement mode:
      </t>

       <ul>
         <li><t>Two-way measurement mode: A Session-Reflector that receives a Session-Sender test packet with an SSID of zero follows the procedure specified in <xref target="RFC8972" section="3" format="default"/>. For a nonzero SSID, the Session-Reflector must use the SSID to identify the configured session and must copy the SSID into its reply as specified in <xref target="RFC8972" format="default"/>. A Session-Sender that receives a Session-Reflector test packet with a zero SSID may stop the session, as specified in <xref target="RFC8972" section="3" format="default"/>.</t></li>
         <li><t>One-way measurement mode: A Session-Reflector that receives a Session-Sender test packet with an SSID of zero must discard it. For a nonzero SSID, the Session-Reflector must use the SSID to identify the configured session. The Session-Reflector must associate each received Session-Sender test packet with a STAMP session using the source IP address, the SSID, the destination UDP port number, and the measurement mode configured locally for that SSID. For link measurements, the configured link endpoints and, for LAG member measurements, the Micro-Session ID identify the link or member associated with the session.</t></li>
         <li><t>Loopback measurement mode and loopback with TSF measurement mode: The Session-Sender must identify a returned Session-Sender test packet using the source IP address, SSID, destination UDP port number, and measurement mode configured locally for that SSID. The returned Session-Sender test packet is the Session-Sender's own test packet, so its source IP address identifies the Session-Sender and cannot be used as the Session-Reflector address for session identification. The Session-Sender must discard a returned Session-Sender test packet with a zero or non-matching SSID.</t></li>
       </ul>

      <t>
      These fields identify the local STAMP session on the Session-Sender but do not identify the endpoint node that forwarded the packet; the intended endpoint node is determined by the provisioned forward path and service or link context.
      </t>
      
    </section>

    </section>

    <section anchor="sect-6" numbered="true" toc="default">
      <name>Encapsulations for Two-Way Measurement Mode</name>

      
      <section anchor="sect-6.1" numbered="true" toc="default">
        <name>Session-Sender Test Packet</name>
        <t>
  The content of a Session-Sender test packet is shown in <xref target="ure-dm-sender-test-packet" format="default"/>. 
  The Session-Sender transmits the test packet payload, as specified in
  <xref target="RFC8972" section="3" format="default"/>, with an IP header
  and a UDP header <xref target="RFC0768" format="default"/>.
        </t>

        <figure anchor="ure-dm-sender-test-packet">
          <name>Content of Session-Sender Test Packet</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address = Session-Sender IP Address                .
 .  Destination IP Address = Session-Reflector IP Address        .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Sender                     .
 .  Destination Port = User-configured Destination Port Or 862   .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 1 and Figure 3   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

   </section>

        <section anchor="sect-6.2" numbered="true" toc="default">
          <name>Session-Sender Test Packet for Links</name>

<t>
The Session-Sender test packet, as shown in <xref target="ure-dm-sender-test-packet" format="default"/>, is transmitted over the link for delay measurement. The local and remote IP addresses of the link must be used as the Source IP Address and Destination IP Address in the IP header of the Session-Sender test packet, respectively. For IPv6 links, the link-local IPv6 address <xref target="RFC7404" format="default"/> may also be used in the IP header. </t>

<t>
The Session-Sender uses a discovery protocol or another method to obtain the peer IP and MAC addresses for the links.
For example, the Session-Sender can use the Address Resolution Protocol (ARP) <xref target="RFC0826" format="default"/> 
or the Neighbor Discovery Protocol (NDP) <xref target="RFC4861" format="default"/> table to obtain the IP and MAC addresses for the links when transmitting STAMP packets.
</t>

<t>
Note that the Session-Sender test packet is further encapsulated with an L2 header containing the Session-Reflector MAC address as the Destination MAC address and the Session-Sender MAC address as the Source MAC address for Ethernet links.
</t>

<t>
For delay measurement of LAG member links, a separate STAMP micro-session is created for each member of the LAG. The STAMP extension for the Micro-Session ID TLV, as specified in <xref target="RFC9534" format="default"/>, is used to identify each member link of the LAG associated with the STAMP micro-session on the Session-Sender and Session-Reflector. The Session-Reflector replies on the same member of the LAG in the reverse direction, based on the received Session-Sender test packet and either the local configuration or the information received from the data plane.
</t>

        </section>


<section anchor="sect-6.3" numbered="true" toc="default">
    <name>Session-Sender Test Packet for SRv6 Data Plane</name>

<t>
The Session-Sender generates STAMP-Test packets for the SRv6 data plane, which can be encoded in either Encaps-Mode or Insert-Mode as follows:
</t>

<ul>
<li>
<t>Encaps-Mode:</t>
<t>When Session-Sender test packets are encoded in Encaps-Mode, they are generated with an IP header, and an outer IPv6/SRH encapsulation is added by the forwarding path in the data plane when the SRv6 path is present in the data plane.</t> <t>This encoding mode requires the Session-Reflector to process two IP headers and one UDP header before the STAMP-Test packets are terminated for control-plane processing.</t>
</li>

<li>
<t>Insert-Mode:</t>
<t>When Session-Sender test packets are encoded in Insert-Mode, the test packets are generated with an IPv6/SRH encapsulation. For example, when explicitly configured SRv6 paths are used, these paths may not be present in the data plane.</t> <t>This encoding mode requires the Session-Reflector to process fewer headers before the STAMP-Test packets are terminated for control-plane processing.</t>
</li>
</ul>

<t>
In both encoding modes, the timestamps are collected in the data plane, ensuring that the measured delay values are similar.
</t>

<t>
A Segment List of an SR Policy optionally contains the node prefix SID of the SR Policy endpoint as the ultimate SID. Similarly, the L3 and L2 services steered over the SR Policy also ensure that the traffic reaches the endpoint of the SR Policy. Thus, there are two incoming SRv6 SIDs for the Session-Reflector in the packet: the node prefix SID for the endpoint and the SID for the L3 or L2 service. As an optimization to avoid processing additional SIDs, the Session-Sender excludes the endpoint node prefix SID when the packet carries an L3 or L2 service SID in its Segment List. 
</t>

<t>
The SRv6 network programming procedures are described in <xref target="RFC8986" format="default"/>. The procedure specified for Upper-Layer Header processing for SRv6 End SIDs in <xref target="RFC8986" section="4.1.1" format="default"/> is used to process the UDP header in the received Session-Sender test packets on the Session-Reflector.
</t>


<section anchor="sect-6.3.1" numbered="true" toc="default">
            <name>Session-Sender Test Packet for SRv6 Paths</name>

<t>
A Session-Sender test packet using the same IPv6/SRH encapsulation as the data traffic on the path is shown in <xref target="ure-test-packet-for-srv6-policy" format="default"/>. The IPv6/SRH encapsulation is encoded in Insert-Mode or Encaps-Mode.
</t>

<t>
In Insert-Mode, an SRH is inserted after the IPv6 header of the test packets, as shown in Example 1 of <xref target="ure-test-packet-for-srv6-policy" format="default"/>.</t>

<t>
In Encaps-Mode, the test packets are encapsulated in an outer IPv6 header with an SRH, as shown in Example 2 of <xref target="ure-test-packet-for-srv6-policy" format="default"/>.
</t>

            <figure anchor="ure-test-packet-for-srv6-policy">
              <name>Content of Session-Sender Test Packet for an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = Session-Reflector IPv6 Address or          .
 .                    Last Segment of Segment List               .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+

       Example 1: Encapsulation Using Insert-Mode Encoding 

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = Session-Reflector IPv6 Address or          .
 .                    Last Segment of Segment List               .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6) or 4 (IPv4)                          .
 .                                                               .
 +---------------------------------------------------------------+
 | IP Header, UDP Header and Payload as shown in Figure 6        |
 .                                                               .
 +---------------------------------------------------------------+

      Example 2: Encapsulation Using Encaps-Mode Encoding 
]]></artwork>
            </figure>


<section anchor="sect-6.3.1.1" numbered="true" toc="default">
  <name>SR Policy Paths</name>

<t>
A valid Candidate Path of an SR Policy contains one or more Segment Lists <xref target="RFC9256" format="default"/>.
To measure delay for an SR Policy, the Session-Sender should transmit test packets for each Segment List selected for monitoring, using a separate STAMP session for each list. The Candidate Paths and Segment Lists selected for monitoring depend on the operational objective, as described in <xref target="sect-14.6" format="default"/>.
</t>

<t>
Each Segment List contains a number of SRv6 SIDs as specified in <xref target="RFC8986" format="default"/>. The Session-Sender test packets carry the Segment List in an IPv6 header and an SRv6 Segment Routing Header (SRH) <xref target="RFC8754" format="default"/>.
</t>



<t>
In the IPv6/SRH header for Insert-Mode and in the outer IPv6/SRH header for Encaps-Mode, the head-end node IPv6 address of the SR Policy must be used as the Source IPv6 Address.
The Destination IPv6 Address must be set as follows:
</t>

<ul spacing="normal">
<li>
The next Segment in the Segment List must be used when the Segment List of the Candidate Path of the SR Policy is not empty. 
</li>

<li>
Otherwise, the Session-Reflector IPv6 address must be used.    
</li>

</ul>

<t>
In Encaps-Mode, the Session-Sender adds an inner IPv6 header whose Source IPv6 Address must be the IPv6 address of the SR Policy's head-end node. There are two cases for the SR Policy endpoints, as described below.
</t>

<ol spacing="normal">

<li>
<t>If the SR Policy's endpoint is specified and is not the null endpoint, its IPv6 address must be used as the Destination IPv6 Address in the inner IPv6 header.</t>
</li>

<li>
<t>For an SR Policy with Color-Only Destination Steering, where the endpoint is an unspecified IPv6 address (the null endpoint :: with all bits set to 0), as specified in <xref target="RFC9256" section="8.8.1" format="default"/>, an IPv6 address from the Dummy IPv6 Prefix 100:0:0:1::/64 block <xref target="RFC9780" format="default"/> <xref target="IANA-IPv6-REG" format="default"/> is used as the Destination IPv6 Address in the inner IPv6 header. </t>

<t>
In this case, the SRv6 Segment List of the Session-Sender test packets must end with a SID that causes the packets to be delivered to the Session-Reflector at the SR Policy endpoint (for example, by adding the Prefix SID of the SR Policy endpoint to the Segment List). </t>

<t>
Because a non-routable destination IPv6 address does not identify the Session-Reflector, the Session-Sender should include the Type 9 ("Destination Node IPv4 or IPv6 Address") STAMP TLV defined in <xref target="RFC9503" format="default"/>, with the IP address of the intended Session-Reflector. When a non-routable destination IP address is added, and the intended destination node is not verified by other means, a misforwarded STAMP-Test packet or a packet whose SRv6 Segment List ends early may be processed by another node and produce an incorrect measurement without indication.
    </t>

</li>
</ol>

 </section>

<section anchor="sect-6.3.1.2" numbered="true" toc="default">
  <name>SRv6 IGP Paths</name>

<t>
Each IGP Flex-Algo path and IGP best path in SRv6 networks <xref target="RFC9350" format="default"/> has Prefix SIDs advertised by the nodes. The Session-Sender test packet uses these Prefix SIDs.
</t>

<t>The IPv6 header uses the Session-Sender's Prefix SID as the Source IPv6 Address and the Session-Reflector's Prefix SID as the Destination IPv6 Address.
The SRv6 Segment List Sub-TLV in the Return Path TLV carries the Session-Sender's Prefix SID for the reverse direction, as specified in <xref target="sect-6.4.2" format="default"/>.
</t>

<t>
An SRv6 IGP Prefix SID identifies a destination within an IGP or Flex-Algo forwarding context; it does not identify a specific SRv6 path. A test packet using an IGP Prefix SID therefore measures forwarding according to the IGP-selected path, which may include multiple ECMP paths. <xref target="sect-12" format="default"/> describes how the Session-Sender can influence ECMP paths using hashing inputs, although it generally cannot deterministically select a particular path. This differs from measuring a specific SR Policy Segment List of a valid Candidate Path, as described above. However, a Segment List can itself encounter multiple ECMP paths when it uses an IGP Prefix SID.
</t>

</section>

      </section>

<section anchor="sect-6.3.2" numbered="true" toc="default">
          <name>Session-Sender Test Packet for Layer-3 Services over an SRv6 Path</name>

<t>
To measure delay for an L3 service carried over an SRv6 path, the Session-Sender must use the IPv6/SRH encapsulation of the data packets transmitted over the L3 service, including the L3VPN SRv6 SID instantiated on the Session-Reflector (e.g., an End.DT6, End.DT4, or End.DT46 SID instance, as specified in <xref target="RFC8986" format="default"/>), to encapsulate the Session-Sender test packets.
</t>

<t>
The encapsulation of the Session-Sender test packet is shown in <xref target="ure-test-packet-for-srv6-l3" format="default"/> for both encoding modes: Insert-Mode and Encaps-Mode.
</t>


            <figure anchor="ure-test-packet-for-srv6-l3">
              <name>Content of Session-Sender Test Packet for an L3 Service over an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT6/End.DT46 SID                       .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+
 
       Example 1: Encapsulation Using Insert-Mode Encoding 
 
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT4/End.DT46 SID                       .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 4 (IPv4)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | IPv4 Header as shown in Figure 6                              |
 .  Destination IPv4 Address in L3VPN table                      .
 .  Source IPv4 Address in L3VPN table (reverse direction)       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+

   Example 2: Encapsulation Using Encaps-Mode Encoding for IPv4 

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT6/End.DT46 SID                       .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6)                                      . 
 .                                                               .
 +---------------------------------------------------------------+
 | IPv6 Header as shown in Figure 6                              |
 .  Destination IPv6 Address in L3VPN table                      .
 .  Source IPv6 Address in L3VPN table (reverse direction)       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+

   Example 3: Encapsulation Using Encaps-Mode Encoding for IPv6 
]]></artwork>
            </figure>


<ul>
<li>
<t>In Insert-Mode:</t>
<t>An SRH is inserted after the IPv6 header of the STAMP-Test packets, as shown in Example 1 of <xref target="ure-test-packet-for-srv6-l3" format="default"/>. 
</t> <t>
The ultimate End.DT6/End.DT46 SID in the Segment List is interpreted as an End SID, and local configuration on the Session-Reflector permits processing of UDP as the upper-layer header for OAM as described in <xref target="RFC8986" section="4.1.1" format="default"/>.</t>
</li>

<li>
<t>In Encaps-Mode:</t> 
<t>The STAMP-Test packets are encapsulated in an outer IPv6 header with an SRH, as shown in Examples 2 and 3 of <xref target="ure-test-packet-for-srv6-l3" format="default"/>. 
</t> <t>
An inner IP header is added to the Session-Sender test packets after the outer IPv6/SRH encapsulation.
</t>
</li>
</ul>

<t>
In both modes, the Session-Sender IPv6 address must be used as the Source IPv6 Address, and the Session-Reflector IPv6 address must be used as the Destination IPv6 Address in the outer IPv6 header.
</t>

<t>
The IPv6 Destination Address in the inner IPv6 header must be reachable through the IPv6 table lookup associated with the added L3VPN SRv6 SID. Similarly, the IPv4 Destination Address in the inner IPv4 header must be reachable through the IPv4 table lookup associated with the added L3VPN SRv6 SID.
</t>

<t>
The IPv6 Source Address in the inner IPv6 header must be reachable through the IPv6 table lookup for the reverse-direction L3 service so that the Session-Reflector test packets are returned over that service. Similarly, the IPv4 Source Address in the inner IPv4 header must be reachable through the IPv4 table lookup for the reverse-direction L3 service.
</t>
 
          </section>

    <section anchor="sect-6.3.3" numbered="true" toc="default">
          <name>Session-Sender Test Packet for Layer-2 Services over an SRv6 Path</name>

<t>
To measure delay for an L2 service carried over an SRv6 path, the Session-Sender must use the IPv6/SRH encapsulation of the data packets transmitted over the L2 service, including the L2VPN SRv6 SID instantiated on the Session-Reflector (e.g., an End.DT2U SID instance, as specified in <xref target="RFC8986" format="default"/>), to encapsulate the Session-Sender test packets.
</t>

<t>
The encapsulation of the Session-Sender test packet is shown in <xref target="ure-test-packet-for-srv6-l2" format="default"/> for both encoding modes: Insert-Mode and Encaps-Mode.
</t>


            <figure anchor="ure-test-packet-for-srv6-l2">
              <name>Content of Session-Sender Test Packet for an L2 Service over an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT2U SID                               .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+

       Example 1: Encapsulation Using Insert-Mode Encoding 

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT2U SID                               .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6)                                      . 
 .                                                               .
 +---------------------------------------------------------------+
 | IPv6 Header as shown in Figure 6                              |
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 6                   |
 .                                                               .
 +---------------------------------------------------------------+

       Example 2: Encapsulation Using Encaps-Mode Encoding 
]]></artwork>
            </figure>

<ul>
<li>
<t>In Insert-Mode:</t> 
<t>An SRH is inserted after the IPv6 header of the STAMP-Test packets, as shown in Example 1 of <xref target="ure-test-packet-for-srv6-l2" format="default"/>.
</t> 
<t>
The ultimate End.DT2U SID in the Segment List is interpreted as an End SID, and local configuration on the Session-Reflector permits processing of UDP as the upper-layer header for OAM as described in <xref target="RFC8986" section="4.1.1" format="default"/>.
</t>
</li>

<li>
<t>In Encaps-Mode:</t> 
<t>In addition to the outer IPv6/SRH encapsulation, an inner IPv6 header is added, as shown in Example 2 of <xref target="ure-test-packet-for-srv6-l2" format="default"/>. 
</t> 
<t>
The inner IPv6 header contains the Session-Sender IPv6 address as the Source IPv6 Address and the Session-Reflector IPv6 address as the Destination IPv6 Address.
</t>
</li>
<li>
<t>
For security reasons, the Router Alert IP option <xref target="RFC2113" format="default"/> is not used in Session-Sender or Session-Reflector test packets when STAMP-Test packets are terminated for control-plane processing, as described in <xref target="RFC6398" format="default"/>.
</t>
</li>
</ul>

<t>
In both encoding modes, the Session-Sender IPv6 address must be used as the Source IPv6 Address, and the Session-Reflector IPv6 address must be used as the Destination IPv6 Address in the outer IPv6 header.
</t>

   </section>
   </section>

  <section anchor="sect-6.4" numbered="true" toc="default">
          <name>Session-Reflector Test Packet</name>

<t>
In two-way measurement mode, the Session-Reflector transmits Session-Reflector test packets for links, SRv6 paths, L3 services, and L2 services in the reverse direction toward the Session-Sender.
</t>

<t>
For Ethernet links, the Session-Reflector decapsulates the L2 header from the received Session-Sender test packets. For SRv6, it decapsulates the IPv6/SRH header, if present, from the received Session-Sender test packets.
</t>

<t>
The Session-Reflector must generate the Session-Reflector test packet using the source and destination IP addresses and UDP port numbers extracted from the received Session-Sender test packet, except that a Return Address Sub-TLV, when present, specifies the destination IP address, as described in <xref target="sect-6.4.2" format="default"/>. The packet format is shown in <xref target="ure-test-reply-packet" format="default"/>.
</t>

        <figure anchor="ure-test-reply-packet">
          <name>Content of Session-Reflector Test Packet</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header                                                     |
 .  Source IP Address                                            .
 .     = Session-Reflector IP Address                            . 
 .  Destination IP Address                                       .
 .     = Source IP Address from Session-Sender Test Packet       .
 .       (unless overridden by Return Address Sub-TLV)           .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Reflector                  .
 .  Destination Port                                             . 
 .     = Source Port from Session-Sender Test Packet             .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 2 and Figure 4   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

    <t>
The Session-Reflector test packet fields are set as follows:
</t>

<ul>
  <li><t>The payload contains the Session-Reflector test packet specified in <xref target="RFC8972" section="3" format="default"/>.</t></li>
  <li><t>The source UDP port number in the received UDP header MUST be used as the destination UDP port number, and the destination UDP port number in the received UDP header MUST be used as the source UDP port number.</t></li>
  <li><t>The source IP address in the received IP header MUST be used as the destination IP address unless a Return Address Sub-TLV is present, in which case the specified address MUST be used.</t></li>
  <li><t>The Session-Reflector IP address MUST be used as the source IP address.</t></li>
</ul>

<t>
The Session-Reflector must encapsulate the Session-Reflector test packets for transmission over links, SRv6 paths, L3 services, or L2 services in the reverse direction.
</t>

<t>
For SRv6 encapsulation, the Session-Reflector must encode the Session-Reflector test packet using the same mode as the received Session-Sender test packet.
</t>

        <section anchor="sect-6.4.1" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for Links</name>

<t>
The Session-Reflector test packet defined in <xref target="ure-test-reply-packet" format="default"/> is encapsulated with an L2 header containing the Session-Sender MAC address as the Destination MAC address and the Session-Reflector MAC address as the Source MAC address for Ethernet links.
</t>

<t>
When the Session-Reflector receives the "Reply Requested on the Same Link" flag in the Control Code Sub-TLV of the Return Path TLV specified in <xref target="RFC9503" format="default"/>, it must transmit the Session-Reflector test packet over the same link in the reverse direction.
</t>

</section>

        <section anchor="sect-6.4.2" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for SRv6 Paths</name>

<t>
When the Session-Reflector receives an SRv6 Segment List sub-TLV in the Return Path TLV specified in <xref target="RFC9503" format="default"/>, it must use that Segment List as the reverse-direction SRv6 path and encapsulate the Session-Reflector test packet with an IPv6/SRH header.
The Source IPv6 Address in the added IPv6 header is set to the Session-Reflector IPv6 address.
</t>

<t>
The Session-Reflector must process a Control Code Sub-TLV as specified in <xref target="RFC9503" section="4.1.1" format="default"/>:
</t>

<ul>
  <li><t>When the Reply Request flag indicates "No Reply Requested", the Session-Reflector must not transmit a Session-Reflector test packet and must terminate the received STAMP-Test packet.</t></li>
  <li><t>When it indicates "Reply Requested on the Same Link", the Session-Reflector must transmit the Session-Reflector test packet over the incoming link in the reverse direction.</t></li>
  <li><t>As specified in <xref target="RFC9503" section="4.1" format="default"/>, a Control Code Sub-TLV cannot be included in the same Return Path TLV as a Return Address or SRv6 Segment List Sub-TLV.</t></li>
</ul>

<t>
A Return Address Sub-TLV may be present together with a Segment List sub-TLV. When both are present, the Session-Reflector must use the Segment List for the reverse SRv6 path and must use the Return Address as the destination IP address of the Session-Reflector test packet, as specified in <xref target="RFC9503" section="4.1.2" format="default"/>.
</t>

<t>
Examples of specific SRv6 return paths include:
</t>

<ul spacing="normal">
<li>The Segment List of the associated reverse Candidate Path.</li>
<li>The Binding SID of the reverse SR Policy.</li>
<li>The SRv6 Prefix SID of the Session-Sender.</li>
</ul>

<t>
For an SRv6 IGP Flex-Algo path, the SRv6 Segment List sub-TLV in the Return Path TLV carries the Session-Sender Prefix SID for the same SRv6 IGP Flex-Algo path and requests that the Session-Reflector transmit the Session-Reflector test packet over that path in the reverse direction.
</t>

<t>
If no Return Path TLV is received, or if the received Return Path TLV contains neither a Control Code Sub-TLV nor an SRv6 Segment List Sub-TLV, the Session-Reflector must transmit the Session-Reflector test packet with additional IPv6/SRH encapsulation over the locally selected reverse-direction SRv6 path to the Session-Sender.
</t>

<t>
In Insert-Mode, after adding the IPv6/SRH encapsulation, the Session-Reflector must not add the IP header shown in <xref target="ure-test-reply-packet" format="default"/>.
</t>

<t>
In Encaps-Mode, after adding the IPv6/SRH encapsulation, the Session-Reflector must add the IP header shown in <xref target="ure-test-reply-packet" format="default"/> as an inner IP header.
</t>

<t>
If no reverse SRv6 path can be selected, the Session-Reflector must transmit the test packet shown in <xref target="ure-test-reply-packet" format="default"/> without additional IPv6/SRH encapsulation.
</t>


</section>

        <section anchor="sect-6.4.3" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for an L3 Service over an SRv6 Path</name>

<t>
In Insert-Mode, the Session-Reflector must follow the procedure described in <xref target="sect-6.4.2" format="default"/>.
</t>

<t>
In Encaps-Mode:
The Session-Reflector must transmit Session-Reflector test packets with IPv6/SRH encapsulation for the reverse-direction L3 service as follows:
</t>

<ul>
  <li>
  <t>The Session-Reflector must add the IPv6/SRH encapsulation using reachability information for the Source IP Address in the inner IP header of the received test packet. This address must be reachable through the IPv4 or IPv6 table lookup associated with the received L3VPN SRv6 SID instantiated on the Session-Reflector.</t>
  <t>The Source IPv6 Address in the added IPv6 header must be the Session-Reflector IPv6 address.</t>
  </li>

  <li>
  <t>The Session-Reflector must add an inner IP header as shown in <xref target="ure-test-reply-packet" format="default"/>. Its Destination IP Address and Source IP Address must be set to the source and destination IP addresses, respectively, from the received inner IP header.</t>
  </li>

  <li>
  <t>If the Session-Reflector cannot find the corresponding reverse-direction L3 service, it must drop the test packet and must not transmit a Session-Reflector test packet.</t>
  </li>
</ul>

</section>

        <section anchor="sect-6.4.4" numbered="true" toc="default">
          <name>Session-Reflector Test Packet for an L2 Service over an SRv6 Path</name>

<t>
In Insert-Mode, the Session-Reflector must follow the procedure described in <xref target="sect-6.4.2" format="default"/>.
</t>

<t>
In Encaps-Mode:
The Session-Reflector must transmit Session-Reflector test packets with IPv6/SRH encapsulation for the reverse-direction L2 service as follows:
</t>

<ul>
  <li>
<t>
The Session-Reflector must add the IPv6/SRH encapsulation for the corresponding reverse-direction L2 service associated with the received L2VPN SRv6 SID instantiated on the Session-Reflector.
</t>
<t>
The Source IPv6 Address in the added IPv6 header must be the Session-Reflector IPv6 address.
</t>
  </li>

  <li>
<t>
The Session-Reflector must add an inner IP header as shown in <xref target="ure-test-reply-packet" format="default"/>.
</t>
  </li>

  <li>
<t>
If the Session-Reflector cannot find the corresponding reverse-direction L2 service, it must drop the test packet and must not transmit a Session-Reflector test packet.
</t>
  </li>
</ul>

     </section>
  </section>

     </section>

         <section anchor="sect-7" numbered="true" toc="default">
      <name>Encapsulations for One-Way Measurement Mode</name>

<t>
In one-way measurement mode for links, the Session-Sender transmits STAMP-Test packets using the encapsulations defined in <xref target="sect-6.2" format="default"/>.

In one-way measurement mode for SRv6 paths and for L3 and L2 services carried over those SRv6 paths, the Session-Sender transmits STAMP-Test packets using the encapsulations defined in <xref target="sect-6.3" format="default"/>.

Because no Session-Reflector test packets are transmitted, the encapsulation defined in <xref target="sect-6.4" format="default"/> does not apply.
</t>


     </section>


        <section anchor="sect-8" numbered="true" toc="default">
          <name>Encapsulations for Loopback Measurement Mode</name>

<t>
In loopback measurement mode for links, SRv6 paths, and L3 and L2 services carried over those SRv6 paths, the Session-Sender must transmit the STAMP-Test packets defined in <xref target="sect-6.1" format="default"/>. The Session-Sender must add an IP header for the return path to its test packets and must set the Destination IP Address to the Session-Sender IP address, as shown in <xref target="ure-dm-sender-test-packet-lb-return" format="default"/>.
</t>

      <figure anchor="ure-dm-sender-test-packet-lb-return">
        <name>Content of Return Session-Sender Test Packet in Loopback Measurement Mode</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IP Header (Return Path)                                       |
 .  Source IP Address = Session-Sender IP Address                .
 .  Destination IP Address = Session-Sender IP Address           .
 .  IPv4 Protocol or IPv6 Next-header = 17 (UDP)                 .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 .  Source Port = Selected by Session-Sender                     .
 .  Destination Port = Source Port                               .
 .                                                               .
 +---------------------------------------------------------------+
 | Payload = Test Packet as specified in Figure 1 and Figure 3   |
 .           in Section 3 of RFC 8972                            .
 .                                                               .
 +---------------------------------------------------------------+
    ]]></artwork>
      </figure>

<t>
When an SRv6 return path is included, the forward-path and return-path segments are carried in the same SRH. After the forward-path segments have been processed, the next segment directs the packet along the return path. The Session-Reflector does not need to identify the boundary between the paths or process the packet differently; it forwards the packet according to the SRH.
</t>


  <section anchor="sect-8.1" numbered="true" toc="default">
       <name>Loopback Measurement Mode for Links</name>

<t>
The Session-Sender must transmit the test packets in loopback measurement mode for Ethernet links with an L2 header for the forward path.
The L2 header contains the link MAC address at the Session-Reflector as the Destination MAC address and the link MAC address at the Session-Sender as the Source MAC address, as shown in <xref target="ure-dm-sender-test-packet-lb" format="default"/>.
</t>
<figure anchor="ure-dm-sender-test-packet-lb">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for Ethernet Link</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | L2 MAC Header (Forward Path)                                  |
.  Source MAC Address = Session-Sender Link MAC                  .
.  Destination MAC Address = Session-Reflector Link MAC          .
 .  Ether-Type = 0x0800 (IPv4) Or 0x86DD (IPv6)                  . 
 .                                                               .
 +---------------------------------------------------------------+
 | Test Packet as shown in Figure 11 (Return Path)               |
 .                                                               .
 +---------------------------------------------------------------+
]]></artwork>
        </figure>

<t>
The Session-Sender must add an IP header for the return path to the test packets and must set both the Source IP Address and Destination IP Address to the Session-Sender IP address on the link.
</t>

<t>
The Session-Reflector decapsulates the L2 header and forward the test packet to the Session-Sender using the IP header.
</t>
   </section>


  <section anchor="sect-8.2" numbered="true" toc="default">
        <name>Loopback Measurement Mode for SRv6 Paths</name>

    <t>
In loopback measurement mode for SRv6 paths, the Session-Sender test packet must carry either only the Segment List for the forward path (using Encaps-Mode encoding) or both the forward and return paths in the IPv6/SRH encapsulation (using Insert-Mode encoding), as shown in <xref target="ure-test-packet-for-srv6-policy-lb" format="default"/>.
    </t>

<t>
For an SRv6 IGP path, the forward Segment List must carry the Session-Reflector's Prefix SID: the Flex-Algo Prefix SID for an IGP Flex-Algo path, and the IGP Prefix SID for an IGP best path.
</t>

      <figure anchor="ure-test-packet-for-srv6-policy-lb">
        <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = Session-Sender IPv6 Address or             .
 .                    Last Segment of Segment List of Return Path.
 .  <Remaining Segment List for Return Path>                     .
 .  <Segment List for Forward Path>                              .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 1: Encapsulation Using Insert-Mode Encoding 
                with SRv6 Return Path

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = Session-Reflector IPv6 Address or          .
 .                    Last Segment of Segment List or            .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6) or 4 (IPv4)                          . 
 .                                                               .
 +---------------------------------------------------------------+
 | IP Header as shown in Figure 11 (Return Path)                 |
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 2: Encapsulation Using Encaps-Mode Encoding 
                with IP Return Path 
]]></artwork>
            </figure>

<t>
For an SR Policy using PSP, the Session-Sender must include the Prefix SID of the SR Policy endpoint as the final SID in the forward-direction Segment List
to ensure that the Session-Sender test packets reach the SR Policy endpoint.
</t>
        
      <section anchor="sect-8.2.1" numbered="true" toc="default">
        <name>SRv6 Return Path</name>

<t>
For the SRv6 return path, the Session-Sender test packets must be encoded in Insert-Mode, as shown in Example 1 of <xref target="ure-test-packet-for-srv6-policy-lb" format="default"/>.
</t>

<t>
The Session-Sender test packets must carry the return path in the SRv6 Segment List in addition to the forward path.
Examples of specific SRv6 return paths include:
</t>

<ul spacing="normal">
<li>The Segment List of the associated reverse Candidate Path.</li>
<li>The Binding SID of the reverse SR Policy.</li>
<li>The SRv6 Prefix SID of the Session-Sender.</li>
</ul>

<t>
For an SRv6 IGP return path, the return Segment List must carry the Session-Sender's Prefix SID. The Flex-Algo Prefix SID must be used for the same IGP Flex-Algo path in the reverse direction, and the Session-Sender's IGP Prefix SID must be used for an IGP best path.
</t>

<t>
The Binding SID of the reverse SR Policy can be configured on the Session-Sender using an SDN controller, for example.
</t>

<t>
Encaps-Mode using an SRv6 return path does not preclude carrying an inner IP header of the IP return path.
</t>

<t>
When adding SRv6 CSIDs to Session-Sender test packets for the SRv6 return path in loopback measurement mode, it is recommended that the CSIDs be carried in a separate CSID container to avoid altering the ECMP path taken by the test packets.
</t>

   </section>

  <section anchor="sect-8.2.2" numbered="true" toc="default">
    <name>IP Return Path</name>

<t>
For the IP return path, the Session-Sender test packets must be encoded in Encaps-Mode, as shown in Example 2 of <xref target="ure-test-packet-for-srv6-policy-lb" format="default"/>.
</t>

<t>
The Session-Sender test packets must carry only the Segment List of the SRv6 forward-direction path.
</t>

<t>
For an SRv6 IGP path, the forward Segment List carries the Session-Reflector's Prefix SID, as described in <xref target="sect-8.2" format="default"/>. The return path is carried in the inner IP header and does not use a Session-Sender Prefix SID in the SRH.
</t>

<t>
The Session-Sender must add an inner IP header for the return path to the test packets and must set its Destination IP Address to the Session-Sender IP address.
</t>

<t>
The Session-Reflector decapsulates the IPv6/SRH headers and forward the test packet using the inner IP header for the return path.
</t>

    </section>
    </section>

  <section anchor="sect-8.3" numbered="true" toc="default">
        <name>Loopback Measurement Mode for Layer-3 Services over an SRv6 Path</name>

<t>
In loopback measurement mode for an L3 service carried over an SRv6 path, the Session-Sender must use the IPv6/SRH encapsulation of the data packets transmitted over the L3 service, including the L3VPN SRv6 SID instantiated on the Session-Reflector (e.g., an End.DT6, End.DT4, or End.DT46 SID, as specified in <xref target="RFC8986" format="default"/>), to encapsulate the Session-Sender test packets, as shown in <xref target="ure-test-packet-for-srv6-l3-lb" format="default"/>.
</t>

      <figure anchor="ure-test-packet-for-srv6-l3-lb">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an L3 Service over an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT4/End.DT6/End.DT46 SID of Return Path.
 .  <Remaining Segment List of Return Path>                      .
 .  <Segment List of Forward Path>                               .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 1: Encapsulation Using Insert-Mode Encoding 
                with SRv6 Return Path

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT4/End.DT46 SID of Forward Path       .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 4 (IPv4)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | IPv4 Header as shown in Figure 11 (Return Path)               |
 .      Destination IPv4 Address in L3VPN table                  .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 2: Encapsulation Using Encaps-Mode Encoding 
                with IPv4 Return Path 

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT6/End.DT46 SID of Forward Path       .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6)                                      . 
 .                                                               .
 +---------------------------------------------------------------+
 | IPv6 Header as shown in Figure 11 (Return Path)               |
 .      Destination IPv6 Address in L3VPN table                  .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 3: Encapsulation Using Encaps-Mode Encoding 
                with IPv6 Return Path 
]]></artwork>
            </figure>


  <section anchor="sect-8.3.1" numbered="true" toc="default">
        <name>SRv6 Return Path</name>

<t>
For the SRv6 return path, the Session-Sender test packets must be encoded in Insert-Mode, as shown in Example 1 of <xref target="ure-test-packet-for-srv6-l3-lb" format="default"/>.
</t>

<t>
The Session-Sender must add the SRv6 Segment List for the forward-direction L3 service, excluding the L3VPN SRv6 SID instantiated on the Session-Reflector, to the IPv6/SRH encapsulation of the test packet.
</t>

<t>
In addition, the Session-Sender must add the SRv6 Segment List for the reverse-direction L3 service, including the L3VPN SRv6 SID instantiated on the Session-Sender, to the IPv6/SRH encapsulation to return the test packet from the Session-Reflector to the Session-Sender.
</t>

<t>
Encaps-Mode using an SRv6 return path does not preclude carrying an inner IP header of the IP return path.
</t>

   </section>
  <section anchor="sect-8.3.2" numbered="true" toc="default">
        <name>IP Return Path</name>

<t>
For the IP return path, the Session-Sender test packets must be encoded in Encaps-Mode, as shown in Examples 2 and 3 of <xref target="ure-test-packet-for-srv6-l3-lb" format="default"/>.
</t>

<t>
The Session-Sender must add the SRv6 Segment List for the forward-direction L3 service, including the L3VPN SRv6 SID instantiated on the Session-Reflector, to the IPv6/SRH encapsulation of the test packets sent to the Session-Reflector.
</t>

<t>
The Session-Sender must add an inner IP header for the return path to the test packets and must set its Destination IP Address to the Session-Sender IP address. This address must be reachable through the IPv4 or IPv6 table lookup associated with the L3VPN SRv6 SID on the Session-Reflector.
</t>

<t>
The Session-Reflector decapsulates the IPv6/SRH header and forward the Session-Sender test packet using the inner IP header, after adding IPv6/SRH encapsulation for the reverse-direction L3 service.
</t>

   </section>

   </section>

    <section anchor="sect-8.4" numbered="true" toc="default">
       <name>Loopback Measurement Mode for Layer-2 Services over an SRv6 Path</name>

    <t>
In loopback measurement mode for an L2 service carried over an SRv6 path, the Session-Sender must use the IPv6/SRH encapsulation of the data packets transmitted over the L2 service, including the L2VPN SRv6 SID instantiated on the Session-Reflector (e.g., an End.DT2U SID, as specified in <xref target="RFC8986" format="default"/>), to encapsulate the Session-Sender test packets, as shown in <xref target="ure-test-packet-for-lb-srv6-l2" format="default"/>.
</t>

            <figure anchor="ure-test-packet-for-lb-srv6-l2">
              <name>Content of Session-Sender Test Packet in Loopback Measurement Mode for an L2 Service over an SRv6 Path</name>
              <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         .
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.DT2U SID of Return Path                .
 .  <Remaining Segment List of Return Path>                      .
 .  <Segment List of Forward Path>                               .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+
 
   Encapsulation Using Insert-Mode Encoding with SRv6 Return Path
]]></artwork>

            </figure>
  <section anchor="sect-8.4.1" numbered="true" toc="default">
        <name>SRv6 Return Path</name>
    
<t>
For the SRv6 return path, the Session-Sender test packets must be encoded in Insert-Mode, as shown in <xref target="ure-test-packet-for-lb-srv6-l2" format="default"/>.
</t>

<t>
The Session-Sender must add the SRv6 Segment List for the forward-direction L2 service, excluding the L2VPN SRv6 SID instantiated on the Session-Reflector, to the IPv6/SRH encapsulation of the test packet.
</t>

<t>
In addition, the Session-Sender must add the SRv6 Segment List for the reverse-direction L2 service, including the L2VPN SRv6 SID instantiated on the Session-Sender, to the IPv6/SRH encapsulation to return the test packet from the Session-Reflector to the Session-Sender.
</t>

  </section>

  <section anchor="sect-8.4.2" numbered="true" toc="default">
        <name>IP Return Path</name>

    <t>
    An IP return path is not supported for an L2 service because the Session-Reflector has no IP forwarding context associated with the L2 service for forwarding the returned Session-Sender test packet. The return path therefore uses the SRv6 Segment List for the reverse-direction L2 service, as specified in <xref target="sect-8.4.1" format="default"/>.
    </t>

  </section>

  </section>

  </section>

  <section anchor="sect-9" numbered="true" toc="default">
      <name>Encapsulations for Loopback with TSF Measurement Mode</name>

<t>
Loopback with TSF measurement mode must use the encapsulation defined for SRv6 paths. 
For L3 and L2 services carried over the SRv6 paths, the applicable service SID must follow the End.TSF SID so that the TSF action is applied before the packet is forwarded in the service context.
.
</t>

<t>
Loopback with TSF measurement mode must use unauthenticated STAMP-Test packets. End.TSF applies only when the "Receive Timestamp" field is at an offset of 16 bytes from the start of the STAMP-Test packet payload. The Session-Sender must not use authenticated mode with loopback with TSF measurement mode.
</t>

  <section anchor="sect-9.1" numbered="true" toc="default">
      <name>STAMP TSF Endpoint Behaviors for SRv6</name>

<t>
<xref target="RFC8986" format="default"/> defines SRv6 Endpoint Behaviors for SRv6 nodes. This document defines two SRv6 Endpoint Behaviors for TSF: 
</t>

<ul spacing="normal">
<li>STAMP TSF with PTPv2 (End.TSF behavior TBA1):  A 64-bit PTPv2 timestamp written at a begin offset of 16 bytes from the start of the STAMP-Test packet payload.</li>

<li>STAMP TSF with NTPv4 (End.TSF behavior TBA2): A 64-bit NTPv4 timestamp written at a begin offset of 16 bytes from the start of the STAMP-Test packet payload.</li>

</ul>

<t>
The timestamp is written in the "Receive Timestamp" field <xref target="RFC8972" format="default"/>, located at a begin offset of 16 bytes from the start of the STAMP-Test packet payload, as shown in the Session-Reflector test packet in Figure 2 of <xref target="RFC8972" section="3" format="default"/>.
</t>

<t>
The TBA1 and TBA2 End.TSF endpoint behaviors are bound to SRv6 SIDs and instantiated on Session-Reflector nodes. 
</t>

<t>
For SRv6 paths in loopback with TSF measurement mode, the Session-Sender test packets must carry the applicable End.TSF behavior with the target SRv6 SID in an SRH <xref target="RFC8754" format="default"/>, as shown in <xref target="ure-test-packet-header-for-srv6-with-endpoint-function" format="default"/>, for Insert-Mode in Example 1 and Encaps-Mode in Example 2.
</t>

        <figure anchor="ure-test-packet-header-for-srv6-with-endpoint-function">
          <name>Content of Session-Sender Test Packet in Loopback Measurement Mode with End.TSF for SRv6 Paths</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  <Segment List for Return Path>                               .
 .  <Segment List for Forward Path including End.TSF SID>        .
 .  Next-Header = 17 (UDP)                                       .
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 1: Encapsulation Using Insert-Mode Encoding 
                with SRv6 Return Path

 +---------------------------------------------------------------+
 | IPv6 Header                                                   |
 .  Source IP Address = Session-Sender IPv6 Address              .
 .  Destination IP Address = Segment List[Segments Left]         . 
 .  Next-Header = 43 (IPv6-Route)                                .
 .                                                               .
 +---------------------------------------------------------------+
 | Routing Type = 4 (SRH)                                        |
 .  Segment List(0) = End.TSF SID                                .
 .  <Remaining Segment List of Forward Path>                     .
 .  Next-Header = 41 (IPv6) or 4 (IPv4)                          . 
 .                                                               .
 +---------------------------------------------------------------+
 | IP Header as shown in Figure 11 (Return Path)                 |
 .                                                               .
 +---------------------------------------------------------------+
 | UDP Header and Payload as shown in Figure 11                  |
 .                                                               .
 +---------------------------------------------------------------+

     Example 2: Encapsulation Using Encaps-Mode Encoding 
                with IP Return Path
  ]]></artwork>
        </figure>

<t>
The Session-Sender test packets must be encoded in Insert-Mode for the SRv6 return path and in Encaps-Mode for the IP return path, as defined in the loopback measurement mode for SRv6 paths in this document.
</t>

<t>
When a Session-Reflector receives a STAMP-Test packet with the applicable End.TSF behavior for the target SRv6 SID, it must write the timestamp to the STAMP-Test packet payload and forward the test packet as defined in the loopback measurement mode for SRv6 paths.
If the Session-Reflector cannot write the timestamp, it must drop the packet.
</t>

        <section anchor="sect-9.1.1" toc="default" numbered="true">
          <name>TSF Endpoint Behavior Node Capability</name>

<t>
Before enabling loopback with TSF measurement mode:
</t>

<ul>
  <li><t>The Session-Sender must determine whether the Session-Reflector supports the applicable End.TSF behavior and associated timestamp format.</t></li>
  <li><t>The capability information can be statically configured on the Session-Sender or obtained using management protocols or a capability signaling mechanism.</t></li>
  <li><t>If no signaling mechanism is used, the capability must be statically configured on the Session-Sender.</t></li>
  <li><t>If support for the selected End.TSF behavior and its associated timestamp format cannot be confirmed, the Session-Sender must not enable the TSF measurement session.</t></li>
</ul>

<t>The mechanisms to learn the End.TSF capability of nodes are out of scope for this document.</t>

<t>
To validate the timestamp result:
</t>

<ul>
  <li><t>The Session-Sender must initialize the Receive Timestamp field to zero in each Session-Sender test packet.</t></li>
  <li><t>The Session-Sender must discard a returned Session-Sender test packet with a zero Receive Timestamp field and must not use it to compute delay metrics.</t></li>
</ul>

        </section>

      </section>
    </section>

    <section anchor="sect-12" numbered="true" toc="default">
      <name>ECMP Measurement in SRv6 Networks</name>

      <t>
The Segment List of an SRv6 path can have ECMP paths between the source and transit nodes, between transit nodes, and between transit and destination nodes, for example, due to:
</t>

<ul spacing="normal">
<li>Use of a Node Prefix SID <xref target="RFC8402" format="default"/>.</li>
<li>Use of an Anycast SID <xref target="RFC8402" format="default"/>, which can result in ECMP paths via transit nodes that are part of that anycast group.</li>
</ul>

        <t>
        ECMP load-balancing behavior and the hashing inputs are implementation-specific.
        The Session-Sender can influence the ECMP path taken by STAMP-Test packets by varying one or more fields that are used as input to the hashing function, while keeping the remaining fields constant.
        </t>

        <t>
        To measure delay on different ECMP paths of a Segment List, the Session-Sender can transmit STAMP-Test packets using the following mechanisms:
        </t>

    <ul spacing="normal">

  <li>The Session-Sender may use different IPv6 Flow Label values <xref target="RFC6437" format="default"/> in its test packets to influence ECMP hashing. The Session-Reflector copies the received IPv6 Flow Label into its test packet unless local policy specifies otherwise, as described in <xref target="sect-5" format="default"/>.</li>
    </ul>

        <t>
        In general, the Session-Sender cannot deterministically select a specific ECMP path.
            Instead, a set of IPv6 Flow Label values that map to distinct ECMP paths can be determined empirically and then used for ongoing monitoring.
            A separate STAMP session can be created for each selected IPv6 Flow Label value.
        </t>

        <t>
            Alternatively, within a single STAMP session, the Session-Sender may vary the IPv6 Flow Label value on a per-packet basis so that different ECMP paths are exercised over time.
        In this case, the resulting measurement represents an aggregate across the ECMP paths exercised over time.
        </t>

        <t>
        To limit Session-Sender and Session-Reflector state, operators can limit the number of IPv6 Flow Label values in use at any time and rotate among IPv6 Flow Label values when monitoring a large ECMP set.
        </t>

<t>
The considerations for loss measurement for different ECMP paths of an SRv6 path are outside the scope of this document.
</t>

    </section>

    <section anchor="sect-13" numbered="true" toc="default">
      <name>Implementation Status</name>
    <t>
    Editorial note: Please remove this section prior to publication.
    </t>

    <section anchor="sect-13.1" numbered="true" toc="default">
      <name>Cisco Implementation</name>

    <t>
    The following Cisco routing platforms running the IOS XR operating system have participated in 
    interoperability testing for the one-way measurement mode, the two-way measurement mode, and the loopback measurement mode for links and SRv6:
    </t>

    <t>
    *  Cisco 8000 (based on Cisco Silicon One ASIC)
      </t>

    <t>
    *  Cisco ASR9904 with Lightspeed line card and Tomahawk line card
      </t>

    <t>
    *  Cisco NCS5500 (based on Broadcom Jericho1 ASIC)
      </t>

    <t>
    *  Cisco NCS5700 (based on Broadcom Jericho2 ASIC)
      </t>


    </section>

    <section anchor="sect-13.2" numbered="true" toc="default">
      <name>Teaparty Implementation</name>

    <t>
    An open-source implementation of the Simple Two-Way Active Measurement Protocol <xref target="RFC8762" format="default"/> is available in Teaparty.
    </t>

    <t>
    https://github.com/cerfcast/teaparty
    </t>

    <t>
    An implementation of the solution specified in <xref target="RFC9503" format="default"/> is available at the following location:
    </t>

    <t>
    https://github.com/cerfcast/teaparty/commit/393abf9357a6c2439877d9bcf2dc426dd89c7158
    </t>

    <t>
    The features implemented are:
    </t>

    <t>
    1. Destination Node IPv4 or IPv6 Address TLV.
    </t>

    <t>
    2. Return Path TLV.
    </t>

    <t>
    There is also support for these TLVs in the Wireshark dissector:
    </t>

    <t>
    https://github.com/cerfcast/teaparty/commit/fb74e2e02396e9bb3ead017e8d9a0c187e3573e2
    </t>

    <t>
    Contact: 
    </t>
    <t>
    William Hawkins 
    </t>
    <t>
    University of Cincinnati
    </t>
    <t>
    Email: hawkinsw@obs.cr
    </t>


    </section>
    </section>
 
    <section anchor="sect-14" numbered="true" toc="default">
      <name>Operational and Manageability Considerations</name>

<t>
The operational considerations specified in <xref target="RFC8762" section="5" format="default"/> also apply to the procedures specified in this document. Further, the operation and management considerations for performance measurement based on STAMP specified in <xref target="RFC8762" section="3" format="default"/> also apply. The manageability considerations described in <xref target="RFC8402" section="9" format="default"/> apply to this specification.
</t>

<t>
The operational considerations specified in <xref target="RFC8986" format="default"/> also apply to the procedures specified in this document.
</t>

<t>
The procedures can be used to compute delay statistics, such as the average, minimum, maximum, and variance, as well as packet-loss statistics, such as the percentage of packets lost and the number of consecutive packets lost. They can also track STAMP session-state changes. Notification behavior for locally configured metric thresholds and STAMP session-state changes is described in <xref target="sect-14.4" format="default"/>.
</t>

<section anchor="sect-14.1" numbered="true" toc="default">
  <name>Measurement Mode and Parameters</name>

<t>
The measurement mode is configured for each STAMP session; this document specifies no default mode or general in-band negotiation of mode support:
</t>

<ul>
  <li><t>The Session-Sender cannot rely on an unsupported-mode indication or automatic fallback. Packets sent to an endpoint that lacks the required support may be dropped or processed according to its supported behavior, so the resulting measurement may be invalid.</t></li>
  <li><t>Operators should configure each Session-Sender and relevant Session-Reflector consistently and use a mode for which the required endpoint behavior is supported. If support cannot be established, operators should use a mutually supported mode or leave the session disabled.</t></li>
  <li><t>The Session-Reflector mode (Stateful or Stateless) is configured per session, and no default is specified for the two-way measurement mode. See <xref target="sect-5" format="default"/> for the mode-specific Stateful and Stateless requirements.</t></li>
  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the node at the end of the forward path does not need to maintain a STAMP session; the loopback with TSF measurement mode additionally requires support for the applicable End.TSF behavior.</t></li>
  <li><t>During staged deployment of End.TSF, operators should follow the capability verification procedures in <xref target="sect-9.1.1" format="default"/> before enabling loopback with TSF. Other endpoints can continue to use loopback without TSF or another mutually supported mode.</t></li>
</ul>

<t>
This document specifies no default measurement interval or packet transmission rate, and no mode-specific minimum or maximum interval. These values need to be configured for each session. Operators should choose them based on the desired measurement frequency, the capacity of the link or path and the processing capacity of the Session-Reflector, and any rate limits in the implementation. Operators should account for the aggregate traffic and processing load across sessions, SRv6 Segment Lists, links, LAG member micro-sessions, and ECMP probes when setting intervals and rates.
</t>
</section>

<section anchor="sect-14.2" numbered="true" toc="default">
  <name>MTU Considerations</name>

<t>
This document does not specify a default test packet size for SRv6 or link measurements:
</t>

<ul>
  <li><t>The packet size follows the STAMP packet format and any optional TLVs, including Extra Padding, used by a session.</t></li>
  <li><t>Operators should select a size that reflects the traffic being measured where appropriate.</t></li>
  <li><t>When checking the path MTU, operators should account for the IPv6 and UDP headers, SRH and Segment List, any inner or outer IP headers used in Encaps-Mode, the L2 header for link measurements, and optional TLVs.</t></li>
  <li><t>STAMP-Test packets must not exceed the path MTU and must not be fragmented.</t></li>
</ul>
</section>

<section anchor="sect-14.3" numbered="true" toc="default">
  <name>STAMP Session Scale</name>

<t>
When STAMP sessions are created for Segment Lists of SR Policies, operators need to consider the scalability of the resulting number of STAMP sessions. To manage the load, operators are advised to limit the number of sessions or increase their measurement intervals.
</t>

<t>
Monitoring different IPv6 Flow Label values separately can require a distinct STAMP session for each value and a mapping between each session and the corresponding data flow, which can limit the number of flows monitored. The ECMP measurement procedures in <xref target="sect-12" format="default"/> describe the tradeoffs between using separate sessions for probe values and varying values per packet. Link and LAG member measurements also contribute to the number of STAMP sessions and micro-sessions being monitored.
</t>
</section>

      <section anchor="sect-14.4" numbered="true" toc="default">
        <name>STAMP Session State Notification</name>
<t>
Threshold-based notifications for delay and packet-loss metrics are generated when locally configured thresholds are crossed. This document specifies no default threshold values; operators configure them according to service objectives and expected measurement variation. These metric notifications are distinct from session-state notifications. An active STAMP session may have metrics that remain within the configured thresholds, in which case no metric notifications are generated. A failed session does not transmit or receive test packets, so no metrics are computed.
</t>

<t>
Monitoring the STAMP session state allows the Session-Sender, in the two-way measurement mode, the loopback measurement mode, and the loopback with TSF measurement mode, to determine whether the STAMP test is idle, active, or failed and generate state-change notifications as specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.
</t>

<t> 
In one-way measurement mode, the Session-Reflector can track packet reception using a local receive status and generate status-change notifications as follows. This receive status is distinct from the Session-Sender's STAMP session state defined in <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>. In particular, the Session-Reflector's initial "waiting" status does not indicate that the Session-Sender is idle; the Session-Sender may be transmitting packets that are lost before reaching the Session-Reflector.
</t>

    <ul spacing="normal">
      <li>The receive status is initially reported as "waiting" when no Session-Sender test packets have been received.</li>
      <li>The receive status changes to "receiving" when one or more Session-Sender test packets are received.</li>
      <li>The receive status changes to "loss-detected" when N consecutive Session-Sender test packets are not received after the status has changed to "receiving", where N (the consecutive packet loss count) is a locally provisioned value. This document specifies no default value for N. Operators should choose N based on the measurement interval, expected transient loss, and the desired failure-detection time; a larger N reduces sensitivity to short loss bursts but delays failure detection.</li>
      <li>The receive status changes from "loss-detected" back to "receiving" when at least one Session-Sender test packet is again received.</li>
    </ul>

<t>
For LAG member link measurements, receive status is tracked per STAMP micro-session. Because STAMP-Test packets are transmitted over the link, SRv6 path, or L3 or L2 service being measured, a connectivity failure typically manifests as the continuous packet loss specified above, resulting in the receive status being reported as "loss-detected".
</t>

      </section>

      <section anchor="sect-14.5" numbered="true" toc="default">
        <name>Operational Considerations for TSF</name>

<t>
For End.TSF capability verification, including support for the selected TBA1 or TBA2 endpoint behavior and timestamp format, see <xref target="sect-9.1.1" format="default"/>.
</t>

<t>
The Session-Sender cannot determine from the returned timestamp whether the Session-Reflector wrote it in the requested format. If the Session-Reflector uses a different format, the Session-Sender may compute an incorrect delay metric.
</t>

<t>
Implementations are recommended to maintain counters for the following End.TSF events:
</t>

<ul spacing="normal">
<li>Packets received with End.TSF.</li>
<li>Packets for which End.TSF was invoked.</li>
<li>Packets dropped after receiving an unknown End.TSF endpoint behavior.</li>
<li>Packets forwarded after skipping an unknown End.TSF endpoint behavior.</li>
<li>Packets carrying End.TSF that were dropped because they were malformed.</li>
<li>Packets for which the End.TSF timestamp write failed.</li>
</ul>

<t>
Implementations should distinguish successful and failed End.TSF invocations, for example through implementation-specific counters or logs. Any implementation-specific notifications for sustained failures, malformed packets, or excessive packets with End.TSF should be rate-limited.
</t>

      </section>

      <section anchor="sect-14.6" numbered="true" toc="default">
        <name>Operational Considerations for Path Changes</name>

<t>
Operators should review STAMP session configuration when a monitored link, path, or service changes to ensure that it continues to match the monitoring objective.
</t>

<ul>
  <li><t>For monitoring active SRv6 forwarding paths, operators should create, activate, update, or remove sessions as needed to match the Segment Lists selected for the active Candidate Path as it is created, selected, or changes state, or as its Segment Lists change.</t></li>
  <li><t>For monitoring links, operators should configure sessions for the links selected for measurement and update them when link state changes. For LAG member measurements, they should configure a separate STAMP micro-session for each member link, as described in <xref target="sect-6.2" format="default"/>, and update the configuration when LAG membership changes.</t></li>
  <li><t>For assessing the readiness of standby or backup SRv6 paths, operators may also configure sessions for the corresponding Candidate Paths or Segment Lists. For standby or backup LAG member links, operators may configure the corresponding link micro-sessions. These measurements assess the tested path or member under the measurement conditions and do not represent traffic currently using the active forwarding path or member. Sessions and micro-sessions used to monitor links or standby paths contribute to the session scale and measurement load described in <xref target="sect-14.3" format="default"/>.</t></li>
</ul>

<t>
A change to the path used by an existing Segment List, for example because of fast reroute (FRR), or a change to the state of a monitored link or LAG member may affect the STAMP measurements: delay metrics may change, and packet loss may occur. Operators should investigate sudden changes in delay or packet-loss metrics for possible path or link changes, including FRR events.
</t>
      </section>

      <section anchor="sect-14.7" numbered="true" toc="default">
        <name>Destination UDP Port Number Considerations</name>

<t>
Configuration of the destination UDP port number depends on the measurement mode:
</t>

<ul>
  <li><t>For two-way and one-way measurement modes, the Session-Reflector receives STAMP-Test packets on UDP port number 862 by default. Any alternative destination UDP port number must be selected from the User Ports (1024-49151) or Dynamic Ports (49152-65535) ranges <xref target="RFC6335" format="default"/>; use of a User Port is subject to the network-impact study and agreement specified in <xref target="RFC8762" section="4.1"/>. For an alternative destination UDP port number, the Session-Sender and Session-Reflector must be configured to use it, and the Session-Reflector must be configured to receive STAMP-Test packets on that UDP port number.</t></li>
  <li><t>For the loopback measurement mode and the loopback with TSF measurement mode, see <xref target="sect-5.2" format="default"/> for the destination UDP port number requirements. The endpoint node forwarding the packet does not require configuration of a STAMP UDP port number.</t></li>
  <li><t>A Session-Reflector that is not configured to receive test packets on the selected UDP port number must drop them.</t></li>
</ul>
      </section>

    </section>

    <section anchor="sect-15" numbered="true" toc="default">
      <name>Security Considerations</name>
<t>
The security considerations in <xref target="RFC8762" format="default"/>, <xref target="RFC8972" format="default"/>, <xref target="RFC9503" format="default"/>, <xref target="RFC8754" format="default"/>, <xref target="RFC8986" format="default"/>, Section 9 of <xref target="RFC8402" format="default"/>, and <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/> also apply to the procedures specified in this document.
</t>

<t>
The measures specified in <xref target="RFC8762" section="7" format="default"/> to mitigate attacks also apply.
</t>

<t>
The security considerations specified in <xref target="RFC8986" format="default"/> are also applicable to the procedures described in this document.
</t>

<t>A secure transport for STAMP specified in <xref target="RFC8762" section="4.5" format="default"/> can be used.</t>

<t>
The procedures specified in this document are intended for deployment in a single network administrative domain. To mitigate threats, STAMP-Test packets must be filtered at administrative-domain boundaries. Additionally, the following considerations apply:
</t>

<ul>
  <li><t>The Session-Sender and Session-Reflector IP addresses are provisioned by the operator for the STAMP session. For link measurements, the operator provisions the peer IP and MAC addresses and the link or LAG member used by the session.</t></li>
  <li><t>The operator is assumed to have verified the integrity of the forward and return paths taken by the STAMP-Test packets and the link endpoints used for link measurements.</t></li>
  <li><t>The source UDP port number is selected as specified in <xref target="I-D.ietf-ippm-stamp-ext-hdr" section="3.1" format="default"/>.</t></li>
  <li><t><xref target="RFC8972" format="default"/> leaves SSID generation to the implementation. For SRv6 sessions, implementations can use a Cryptographically Secure Pseudorandom Number Generator <xref target="NIST-CSPRNG" format="default"/> to make SSID assignment less predictable and off-path attacks more difficult.</t></li>
</ul>

<t>
If desired, attacks can be mitigated by performing basic validation checks on the timestamp fields of STAMP-Test packets received by the Session-Sender. For example, verifying that T2 is later than T1 in the STAMP Reference Topology shown in <xref target="ure-reference-topology-two-way" format="default"/> requires clock synchronization between the Session-Sender and the Session-Reflector. In contrast, checking that T3 is greater than or equal to T2, or that T4 is later than T1, compares timestamps generated at the same node and does not require clock synchronization.
</t>

<t>
The effect of an individual invalid test packet on the measurement results is generally limited to the affected measurement cycle. However, repeated injection of invalid or replayed packets can cause sustained measurement disruption or resource consumption. Stateful measurement modes and End.TSF processing may also introduce additional resource-exhaustion risks.
</t>

<t>
A Session-Reflector must process a STAMP-Test packet received on a link or with an L3 or L2 service SID only in the context of that link or service, and must not forward it or reply to it in any other context. This document does not provide a mechanism for cross-service OAM interactions.
</t>

      <section anchor="sect-15.1" numbered="true" toc="default">
        <name>Security Considerations for Measurement Modes</name>

<t>
The procedures in this document introduce additional security considerations:
</t>

<ul spacing="normal">
  <li><t>For L3 and L2 service measurements (Sections 6.3.2, 6.3.3, 6.4.3, 6.4.4, 8.3, and 8.4), STAMP-Test packets use operator-selected addresses and are forwarded in a customer service context. If the destination address is not local to the intended Session-Reflector, or, for a loopback return packet, the Session-Sender address is not local or reachable in that service context, ordinary forwarding may send the packet toward a CE or drop it. This can expose STAMP-Test packets to an unintended endpoint or service. Operators should use addresses local to the relevant service context and filter STAMP-Test packets at service boundaries.</t></li>

  <li><t>For link measurements, STAMP-Test packets use operator-provisioned peer IP and MAC addresses. If these addresses or the selected link are incorrect, packets may be delivered to an unintended peer or may be dropped. Operators should verify the link endpoints and filter STAMP-Test packets at the relevant link boundaries.</t></li>

  <li><t>In one-way measurement mode, the Session-Reflector maintains per-session state, and unauthenticated STAMP-Test packets can cause state to be allocated or consumed. An attacker can exhaust state or other resources by sending such packets; filtering, rate limiting, and limits on state allocation can mitigate this risk.</t></li>

  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the returned packet is a self-addressed UDP packet. No node on the return path authenticates itself as the intended STAMP endpoint; in the loopback with TSF measurement mode, a node may write a timestamp but does not authenticate the forwarding node. Any node that receives the packet and has IP reachability to the Session-Sender can forward it to the Session-Sender. The returned packet does not identify the forwarding node. HMAC does not authenticate the forwarding node.</t></li>

  <li><t>In the loopback measurement mode and the loopback with TSF measurement mode, the Session-Sender ignores the Sequence Number field, so sequence-number-based replay detection is unavailable and replayed packets may be accepted as measurement results. Timestamp validation can help detect stale or inconsistent packets, but HMAC alone does not provide replay protection.</t></li>
</ul>

<t>
HMAC-SHA-256 in authenticated mode provides integrity protection for STAMP-Test packets, but it does not provide confidentiality or prevent eavesdropping. HMAC, as specified in <xref target="RFC8762" section="4.4" format="default"/>, is supported as follows:
</t>

<ul>
  <li><t>In two-way measurement mode, the Session-Sender and Session-Reflector validate the STAMP-Test packet each receives.</t></li>
  <li><t>In one-way measurement mode, the Session-Reflector validates the Session-Sender test packet it receives.</t></li>
  <li><t>In loopback measurement mode, the Session-Sender validates the returned Session-Sender test packet.</t></li>
</ul>

<t>
The STAMP-Test packets with an SRH can also use the HMAC authentication specified in <xref target="RFC8754" format="default"/>.
</t>

      </section>

      <section anchor="sect-15.2" numbered="true" toc="default">
        <name>Security Considerations for TSF</name>

<t>
The TSF uses the IANA-assigned endpoint behaviors TBA1 and TBA2 with timestamp formats and begin offsets.
Processing of these endpoint behaviors must be restricted to trusted nodes and trusted STAMP sessions. An attacker who can inject packets with End.TSF could cause unauthorized data-plane timestamping. Network operators must filter IPv6 packets carrying End.TSF at administrative-domain boundaries and must restrict the behavior to Session-Reflector nodes that support the applicable behavior.
</t>

<t>
The Session-Reflector writes the timestamp specified by the TBA1 or TBA2 behavior in the STAMP-Test packet payload. Implementations must validate the Endpoint Behavior, the timestamp format, and the available payload length before writing the timestamp. Implementations must perform bounds checking to prevent malformed packets from causing memory corruption, packet corruption, or denial-of-service conditions. Any malformed packet with End.TSF must be dropped.
</t>

      </section>

      <section anchor="sect-15.3" numbered="true" toc="default">
        <name>Privacy Considerations</name>

<t>
STAMP-Test packets and their IPv6/SRH and service encapsulations contain information such as source and destination IP addresses, UDP port numbers, SSIDs, SRv6 Segment Lists and SIDs, service SIDs, link-layer addresses, IPv6 Flow Labels, and timestamps. These fields, together with delay, loss, and session-state measurements, can be correlated with network inventory or subscriber records to identify users, devices, services, network paths, and activity patterns. This information is visible to nodes that process or observe the packets. HMAC provides integrity protection but does not encrypt these fields.
</t>

<t>
An attacker who can inject packets carrying the End.TSF endpoint behaviors could cause unauthorized data-plane timestamping.
STAMP-Test packets carrying the End.TSF endpoint behaviors are covered by the administrative-domain filtering requirement in this Section.
</t>

<t>
Measurement results, session state, and associated logs or notifications can expose similar information when retained or exported through management systems. Operators should limit collection, access, retention, and sharing to what is needed for operations, protect stored data and management interfaces, and use aggregation or remove identifying details when fine-grained records are not needed.
</t>

      </section>

    </section>
    <section anchor="sect-16" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>
  This document requests IANA to allocate the following code points
   in the First Come First Served "SRv6 Endpoint Behaviors" subregistry under the top-level "Segment Routing" registry.
      </t>

      <table anchor="tbl-iana-endpoint-behaviors" align="center">
         <name slugifiedName="name-srv6-endpoint-behaviors-reg">SRv6 Endpoint Behaviors</name>

          <thead>
            <tr>
              <th align="left" colspan="1" rowspan="1">Value</th>
              <th align="left" colspan="1" rowspan="1">Hex</th>
              <th align="left" colspan="1" rowspan="1">Endpoint Behavior</th>
              <th align="left" colspan="1" rowspan="1">Reference</th>
              <th align="left" colspan="1" rowspan="1">Change Controller</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">TBA1</td>
              <td align="left" colspan="1" rowspan="1">TBA1-HEX</td>
              <td align="left" colspan="1" rowspan="1">STAMP TSF with PTPv2</td>
              <td align="left" colspan="1" rowspan="1">This document</td>
              <td align="left" colspan="1" rowspan="1">IETF</td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">TBA2</td>
              <td align="left" colspan="1" rowspan="1">TBA2-HEX</td>
              <td align="left" colspan="1" rowspan="1">STAMP TSF with NTPv4</td>
              <td align="left" colspan="1" rowspan="1">This document</td>
              <td align="left" colspan="1" rowspan="1">IETF</td>
            </tr>
          </tbody>
      </table>

    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

    &RFC0768;
    &RFC0791;
    &RFC2119;
    &RFC5905;
    &RFC6335;
    &RFC6374;
    &RFC8174;
    &RFC8200;
    &RFC8402;
    &RFC8754;
    &RFC8762;
    &RFC8972;
    &RFC8986;
    &RFC9256;
    &RFC9350;
    &RFC9503;
    &RFC9534;
    &RFC9800;
    &I-D.ietf-ippm-stamp-ext-hdr;
    
    <reference anchor="IEEE.1588">
          <front>
            <title>1588-2008 IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems</title>
            <author>
              <organization>IEEE</organization>
            </author>
            <date month="March" year="2008"/>
          </front>
    </reference>

      </references>

      <references>
        <name>Informative References</name>

    &RFC0826;
    &RFC2113;
    &RFC4026;
    &RFC6234;
    &RFC4861;
    &RFC2681;
    &RFC6056;
    &RFC6398;
    &RFC6437;
    &RFC7404;
    &RFC9780;
    &RFC10052;
    &I-D.ietf-ippm-stamp-yang;

    <reference anchor="NIST-CSPRNG" target="https://doi.org/10.6028/NIST.SP.800-90Ar1">
          <front>
            <title>Recommendation for Random Number Generation Using Deterministic Random Bit Generators</title>
            <author>
              <organization>NIST Special Publication 800-90A Revision 1</organization>
            </author>
            <date month="January" year="2015"/>
          </front>
    </reference>

    <reference anchor="IEEE802.1AX">
          <front>
            <title>IEEE Standard for Local and Metropolitan Area Networks - Link Aggregation</title>
            <author>
              <organization>IEEE</organization>
            </author>
            <date month="May" year="2020"/>
          </front>
      <seriesInfo name="IEEE" value="Std 802.1AX-2020"/>
      <seriesInfo name="DOI" value="10.1109/IEEESTD.2020.9105034"/>
    </reference>

    <reference anchor="IANA-IPv6-REG" target="https://www.iana.org/assignments/iana-ipv6-special-registry" quoteTitle="true" derivedAnchor="IANA-IPv6-REG">
          <front>
            <title>IANA IPv6 Special-Purpose Address Registry</title>
            <author>
              <organization showOnFrontPage="true">IANA</organization>
            </author>
          </front>
    </reference>

    </references>
    </references>

    <section numbered="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
      <t>
The authors would like to thank Ianik Semco and Thierry Couture for their discussions on the use cases for Performance Measurement in Segment Routing. The authors would also like to thank Greg Mirsky, Gyan Mishra, Xie Jingrong, Zafar Ali, Boris Hassanov, Ruediger Geib, Liyan Gong, Zhenqiang Li, Maria Matejka, William Hawkins, and Mike Koldychev for reviewing this document and providing useful comments and suggestions. Additionally, Patrick Khordoc, Haowei Shi, Amila Tharaperiya Gamage, Pengyan Zhang, Ruby Lin, Senni Tan, and Radu Valceanu have helped improve the mechanisms described in this document.
      </t>
    </section>

  <section numbered="false" anchor="contributors">
  <name>Contributors</name>

   <t>The following people have substantially contributed to this document:</t>

   <artwork><![CDATA[Daniel Voyer
Cisco Systems, Inc.    
Email: davoyer@cisco.com

]]></artwork>


   <artwork><![CDATA[Amit Dhamija
Arrcus
India
Email: amitd@arrcus.com

]]></artwork>

    </section>

  </back>
</rfc>
