<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE rfc [
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC8174 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8762 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8762.xml">
<!ENTITY RFC8972 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8972.xml">
<!ENTITY RFC9197 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9197.xml">
<!ENTITY RFC9326 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9326.xml">
<!ENTITY RFC3988 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3988.xml">
<!ENTITY RFC8201 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8201.xml">
<!ENTITY RFC9994 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9994.xml">
<!ENTITY RFC10052 SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.10052.xml">
<!ENTITY I-D.ietf-ippm-stamp-ext-hdr SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ippm-stamp-ext-hdr.xml">
<!ENTITY I-D.ietf-mpls-mna-ps-hdr SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-ps-hdr.xml">
<!ENTITY I-D.ietf-mpls-mna-ioam SYSTEM "https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-ioam.xml">
]>
<rfc submissionType="IETF" docName="draft-ietf-ippm-stamp-mpls-hdr-01" category="std" ipr="trust200902" consensus="true">
    <!-- Generated by id2xml 1.5.0 on 2020-02-06T01:41:26Z -->
    <?rfc sortrefs="no"?>
    <?rfc symrefs="yes"?>
    <?rfc strict="yes"?>
    <?rfc toc="yes"?>
    <front>
    <title abbrev="STAMP Reflecting MPLS MNA Headers">Simple Two-Way Active Measurement Protocol (STAMP) Extensions for Reflecting STAMP Packet MPLS Network Action Headers</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-ippm-stamp-mpls-hdr-01"/>    
    <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="Tianran Zhou" initials="T." surname="Zhou">
      <organization showOnFrontPage="true">Huawei</organization>
      <address>
        <postal>
          <country>China</country>
        </postal>
        <email>zhoutianran@huawei.com</email>
      </address>
    </author>

    <author fullname="Zhenqiang Li" initials="Z." surname="Li">
      <organization showOnFrontPage="true">China Mobile</organization>
      <address>
        <postal>
          <country>China</country>
        </postal>
        <email>lizhenqiang@chinamobile.com</email>
      </address>
    </author>

    <author fullname="Fabian Ihle" initials="F." surname="Ihle">
      <organization showOnFrontPage="true">University of Tuebingen</organization>
      <address>
        <postal>
          <city>Tuebingen</city>
          <country>Germany</country>
        </postal>
        <email>fabian.ihle@uni-tuebingen.de</email>
      </address>
    </author>

    <author fullname="Bin Wen" initials="B." surname="Wen">
      <organization>Comcast</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>Bin_Wen@cable.comcast.com</email>
      </address>
    </author>

    <date year="2026"/>
    <workgroup>IPPM Working Group</workgroup>

    <abstract>
        <t>
The Simple Two-Way Active Measurement Protocol (STAMP) and its optional extensions can be used for Edge-to-Edge (E2E) active measurements. In Situ Operations, Administration, and Maintenance (IOAM) data fields can be used for recording and collecting Hop-by-Hop (HBH) and E2E operational and telemetry information. This document extends STAMP to reflect MPLS Network Action Sub-Stacks and Post-Stack MPLS Headers, for HBH and E2E active measurements, for example, using the IOAM data fields.
    </t>
  </abstract>
    </front>

    <middle>

    <section title="Introduction" anchor="sect-1">

       <t>
The Simple Two-Way Active Measurement Protocol (STAMP) <xref target="RFC8762" format="default"/> provides capabilities for the measurement of various performance metrics in IP networks without the use of a control channel to pre-signal session parameters. <xref target="RFC8972" format="default"/> defines optional extensions in the form of TLVs for STAMP. STAMP-Test packets are transmitted along a path between a Session-Sender and a Session-Reflector to measure Edge-to-Edge (E2E) performance metrics, such as delay, delay variation, and packet loss along that path.
  </t>

  <t>
In Situ Operations, Administration, and Maintenance (IOAM) is used for recording and collecting operational and telemetry information while a packet traverses a path between two points in the network. The information from the collected IOAM data fields <xref target="RFC9197" format="default"/> can be used to support Hop-by-Hop (HBH) and E2E measurement use cases.
  </t>

  <t>
MPLS packets may carry MPLS Network Action (MNA) Sub-Stacks (NASes), as specified in <xref target="RFC9994" format="default"/>, and Post-Stack MPLS Headers (PSMHs) for the MNA type, as specified in <xref target="I-D.ietf-mpls-mna-ps-hdr" format="default"/>.
  </t>

  <t>
<xref target="I-D.ietf-mpls-mna-ioam" format="default"/> specifies MNA Sub-Stacks and PSMHs to carry the IOAM option types specified in <xref target="RFC9197" format="default"/> and <xref target="RFC9326" format="default"/> for an MPLS data plane.
  </t>

  <t>
It may be desirable in some contexts (e.g., diagnostics) to record and collect HBH and E2E operational and telemetry information using active measurement packets between two nodes in a network. This is achieved by using optional STAMP extensions to reflect MPLS NASes and PSMHs, as specified in this document. The procedure specified in this document uses existing implementations on midpoint nodes that support the NASes and PSMHs in the MPLS data plane; it imposes no additional requirements on those nodes.
  </t>

  <t>
This document does not cover use cases in which NAS or PSMH lengths change along the path, or in which NASes or PSMHs are added to or removed from the MPLS header of a Session-Sender test packet along the path.
A PSMH can be defined for types other than MNA. This document concerns only PSMHs for the MNA type <xref target="I-D.ietf-mpls-mna-ps-hdr" format="default"/>.
  </t>

    </section>

    <section title="Conventions Used in This Document" anchor="sect-2">

    <section title="Requirements Language" anchor="sect-2.1">
    <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 title="Terminology" anchor="sect-2.2">
    <t>This document uses terms defined in <xref target="RFC8762" format="default"/>, specifically Session-Sender, Session-Reflector, Session-Test packet, and symmetric.</t>
    <t>This document uses terms defined in <xref target="RFC8972" format="default"/>, specifically STAMP TLV Flags and Sub-TLVs.</t>
    </section>

    <section title="Abbreviations" anchor="sect-2.3">
    <texttable anchor="abbreviations" title="Abbreviations">
      <ttcol align="left">Abbreviation</ttcol>
      <ttcol align="left">Meaning</ttcol>
      <ttcol align="left">Reference</ttcol>
      <c>E2E</c><c>Edge-to-Edge</c><c><xref target="RFC9197"/></c>
      <c>HBH</c><c>Hop-by-Hop</c><c><xref target="RFC9994"/></c>
      <c>IOAM</c><c>In Situ Operations, Administration, and Maintenance</c><c><xref target="RFC9197"/></c>
      <c>MPLS</c><c>Multiprotocol Label Switching</c><c><xref target="RFC9994"/></c>
      <c>MNA</c><c>MPLS Network Action</c><c><xref target="RFC9994"/></c>
      <c>MTU</c><c>Maximum Transmission Unit</c><c><xref target="RFC9994"/></c>
      <c>NAS</c><c>Network Action Sub-Stack</c><c><xref target="RFC9994"/></c>
      <c>PSMH</c><c>Post-Stack MPLS Header</c><c><xref target="I-D.ietf-mpls-mna-ps-hdr"/></c>
      <c>STAMP</c><c>Simple Two-Way Active Measurement Protocol</c><c><xref target="RFC8762"/></c>
      <c>TLV</c><c>Type-Length-Value</c><c><xref target="RFC8972"/></c>
    </texttable>
    </section>

    <section title="STAMP Reference Topology" anchor="sect-2.4">
  <t>
  In the "STAMP Reference Topology" shown in <xref target="stamp-reference-topology"/>, the STAMP Session-Sender S1 initiates a Session-Sender test packet, and the STAMP Session-Reflector R1 transmits a reply Session-Reflector test packet. The Session-Reflector test packets are transmitted to the Session-Sender S1 on the same path (i.e., the same set of links and nodes as shown in <xref target="stamp-reference-topology"/>) or on a different path in the reverse direction from the path taken towards the Session-Reflector R1. Node M1 is a midpoint node that does not perform any STAMP processing. A STAMP-Test packet is not required to transit through the same midpoint node M1 in both directions.
  </t>

    <figure anchor="stamp-reference-topology">
        <name>STAMP Reference Topology</name>
    <artwork name="" type="" align="left" alt=""><![CDATA[
             T1                                       T2
            /                                           \
   +-------+    Test Packet  +-------+                   +-------+
   |       | - - - - - - - - |       | - - - - - - - - ->|       |
   |   S1  |=================|   M1  |===================|   R1  |
   |       |<- - - - - - - - |       | - - - - - - - - - |       |
   +-------+                 +-------+ Reply 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.
</t>

<t>
All four timestamps are used by the Session-Sender to measure the two-way delay metric as ((T4 - T1) - (T3 - T2)). 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>
Timestamps T1 and T2 are used by the Session-Sender to measure the one-way delay metric as (T2 - T1), also referred to as the near-end (forward direction) delay metric. Note that the delay value (T4 - T3), measured by the Session-Sender, is referred to as the far-end (backward direction) one-way delay metric. The computation of the one-way delay metric requires the clocks on the Session-Sender and Session-Reflector to be synchronized using either PTPv2 or NTPv4.
</t>
    </section>
    </section>

    <section title="Overview" anchor="sect-3">
<t>
As specified in <xref target="RFC8972" format="default"/>, the Session-Sender test packets and the Session-Reflector test packets are symmetric in size when including all optional TLVs (but excluding transport and network headers). A Session-Reflector reflects all received STAMP TLVs from the Session-Sender test packet.
</t>

<t>
As specified in <xref target="RFC8762" format="default"/>, STAMP-Test packets are transmitted with IP/UDP headers. Since midpoint nodes do not process the UDP headers in the packets, they are agnostic to the STAMP-Test packets in the payload.
</t>

<t>
STAMP-Test packets may carry MPLS headers containing NASes and PSMHs. This document defines procedures and STAMP extensions for a Session-Reflector to reflect the received MPLS NASes and PSMHs back to the Session-Sender for both unidirectional and bidirectional measurement types (see <xref target="sect-5"/>).
</t>

<t>
The IPv4/IPv6 and UDP headers follow the procedure specified in Section 3.1 of <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>, and IPv4/IPv6 UDP checksum handling for STAMP-Test packets follow the procedure specified in Section 8 of <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/>.
</t>


    </section>

    <section title="Reflecting MPLS Header MNA Data" anchor="sect-4">

    <section title="Reflected MPLS Header MNA Data TLV" anchor="sect-4.1">

<t>
    This document defines the &quot;Reflected MPLS Header MNA Data&quot; TLV for STAMP (Type TBA1). A Session-Sender uses this TLV to request reflection of a Network Action Sub-Stack (NAS) or Post-Stack MPLS Header (PSMH) received in its test packet. The TLV is carried in Session-Sender and Session-Reflector test packets, and a STAMP-Test packet MAY carry one or more TLVs of this type. The same TLV type is used for NASes and PSMHs. The format of the TLV is shown in <xref target="stamp-reflected-mna-data"/>.
</t>

        <figure anchor="stamp-reflected-mna-data">
        <name>Reflected MPLS Header MNA Data TLV</name>
    <artwork name="" type="" align="left" alt=""><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |STAMP TLV Flags|  Type=TBA1    |         Length                |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                  Requested MPLS Header MNA Data (8 octets)    |
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                  Received MPLS Header MNA Data                |
 ~                     (Length - 8 octets)                       ~
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
    </figure>

<t>
The "Reflected MPLS Header MNA Data" TLV fields are defined as follows:
</t>

<list style="symbols">
<li><t>STAMP TLV Flags: The STAMP TLV Flags follow the procedures specified in <xref target="RFC8972" section="4" format="default"/>.</t></li>
<li><t>Type: MUST be set to TBA1.</t></li>
<li><t>Length: A two-octet field containing the total length, in octets, of the NAS or PSMH to be reflected. It includes the lengths of the Requested MPLS Header MNA Data field and the Received MPLS Header MNA Data field.</t></li>
<li><t>Requested MPLS Header MNA Data: A fixed 8-octet field containing the first 8 octets of the target NAS or PSMH to be reflected.</t>
<t>This field disambiguates which NAS or PSMH in the received MPLS header the Session-Reflector MUST copy into the "Reflected MPLS Header MNA Data" TLV when multiple NASes or PSMHs of the same length are present.</t>
<t>For matching, the mutable 13-bit Ancillary Data field in a NAS and the 16-bit Post-Stack Data field in a PSMH are excluded from the first 8 octets.</t>
<t>If all octets in this field are zero, the Session-Reflector MUST match the first NAS or PSMH in the MPLS header with the matching length.</t></li>
<li><t>Received MPLS Header MNA Data: A variable-length field containing the remaining (Length - 8) octets of the NAS or PSMH after its first 8 octets, copied from the received MPLS header by the Session-Reflector.</t>
<t>In Session-Sender test packets, this field MUST be initialized to all zeros.</t></li>
</list>

<t>
When a Session-Reflector recognizes the received &quot;Reflected MPLS Header MNA Data&quot; TLV but cannot use it to reflect a received NAS or PSMH, it MUST return the &quot;Reflected MPLS Header MNA Data&quot; TLV with the Conformant Reflected Packet STAMP TLV flag set to 1 in the STAMP TLV Flags, following the procedure specified in <xref target="RFC10052" format="default"/>.

This can occur, for example, if:
</t>

<list style="symbols">
<li><t>
The requested length does not match the length of the received NAS or PSMH.
</t></li>

<li><t>
The Session-Reflector cannot access the received NASes or PSMHs from the data plane, or the data plane does not support NASes or PSMHs.
</t></li>

<li><t>
No NAS or PSMH matches the requested data and length, or the NAS or PSMH is invalid.
</t></li>

<li><t>
More than one NAS or PSMH of the requested length matches a non-zero Requested MPLS Header MNA Data field, excluding the mutable fields specified above.
</t></li>
</list>

    </section>

    <section title="Procedure for Reflecting MPLS MNA Data" anchor="sect-4.2">

<t>
For each NAS or PSMH in a Session-Sender test packet that the Session-Sender requires the Session-Reflector to reflect, the Session-Sender MUST add a corresponding &quot;Reflected MPLS Header MNA Data&quot; TLV to the test packet. The Session-Sender requests a copy of that NAS or PSMH in the corresponding TLV in the Session-Reflector test packet. 
</t>

<t>
An example of a STAMP-Test packet carrying NASes, a PSMH, and their corresponding &quot;Reflected MPLS Header MNA Data&quot; TLVs is shown in <xref target="stamp-generic-reflected-mna-data"/>.
</t>

        <figure anchor="stamp-generic-reflected-mna-data">
        <name>Example Session-Sender and Session-Reflector Test Packet with &quot;Reflected MPLS Header MNA Data&quot; TLVs</name>
    <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | MPLS Header                                                   |
 ~                                                               ~
 +---------------------------------------------------------------+
 | MNA Sub-Stack-1 [RFC9994]                                     |
 ~                                                               ~
 +---------------------------------------------------------------+
 ~ ...                                                           ~
 +---------------------------------------------------------------+
 | MNA Sub-Stack-N [RFC9994]                                     |
 ~                                                               ~
 +---------------------------------------------------------------+
 ~ ...                                                           ~
 +---------------------------------------------------------------+
 | Post-Stack MPLS Header-1 [I-D.ietf-mpls-mna-ps-hdr]           |
 ~                                                               ~
 +---------------------------------------------------------------+
 | IP Header                                                     |
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 +---------------------------------------------------------------+
 | STAMP Packet [RFC8972]                                        |
 ~                                                               ~
 +---------------------------------------------------------------+
 | Reflected MPLS Header MNA Data-1 TLV (TBA1)                   |
 | MNA Sub-Stack                                                 |
 ~                                                               ~
 +---------------------------------------------------------------+
 ~ ...                                                           ~
 +---------------------------------------------------------------+
 | Reflected MPLS Header MNA Data-M TLV (TBA1)                   |
 | MNA Sub-Stack                                                 |
 ~                                                               ~
 +---------------------------------------------------------------+
 | Reflected MPLS Header MNA Data-1 TLV (TBA1)                   |
 | Post-Stack MPLS Header                                        |
 ~                                                               ~
 +---------------------------------------------------------------+

   Note: Value of M <= N        
]]></artwork>
    </figure>

<t>
When a Session-Sender test packet contains multiple NASes or PSMHs that the Session-Sender requires the Session-Reflector to reflect, the corresponding &quot;Reflected MPLS Header MNA Data&quot; TLVs MUST appear in the same order as those headers in the test packet.

When the Session-Sender does not require the Session-Reflector to reflect a NAS or PSMH in the Session-Reflector test packet, the Session-Sender MUST NOT add a corresponding &quot;Reflected MPLS Header MNA Data&quot; TLV to its test packet. In this case, the number of TLVs (M in <xref target="stamp-generic-reflected-mna-data"/>) is less than the number of NASes and PSMHs (N in <xref target="stamp-generic-reflected-mna-data"/>).
</t>

<t>
The number of &quot;Reflected MPLS Header MNA Data&quot; TLVs MUST NOT exceed the total number of NASes and PSMHs in the Session-Sender test packet.
</t>

<t>
In Session-Sender test packets, the Received MPLS Header MNA Data field MUST be initialized to all zeros.

If multiple NASes or PSMHs of the same length are present and the Session-Sender requires the Session-Reflector to reflect only some of them, the Session-Sender MUST populate the Requested MPLS Header MNA Data field (see <xref target="stamp-reflected-mna-data"/>) with the first 8 octets of the NAS or PSMH to be reflected. For matching, the mutable 13-bit Ancillary Data field in a NAS and the 16-bit Post-Stack Data field in a PSMH are excluded from those octets.
For each requested NAS or PSMH, the non-zero Requested MPLS Header MNA Data value MUST match exactly one NAS or PSMH of the requested length, excluding those mutable fields. An all-zero value continues to select the first NAS or PSMH of the matching length. If the requested NAS or PSMH cannot be uniquely selected under these rules, the Session-Sender MUST NOT request selective reflection of that header.
</t>


<t>
When a Session-Reflector supports the &quot;Reflected MPLS Header MNA Data&quot; TLV and receives a Session-Sender test packet containing a valid NAS or PSMH and a corresponding TLV, the following rules apply:

<list style="numbers">

<li>
<t>
If the Requested MPLS Header MNA Data field in the received TLV is non-zero and exactly one NAS or PSMH of the requested length matches the field, the Session-Reflector MUST select that NAS or PSMH. For matching, the mutable 13-bit Ancillary Data field in a NAS and the 16-bit Post-Stack Data field in a PSMH are excluded.
</t>
<t>
If a non-zero Requested MPLS Header MNA Data field matches more than one NAS or PSMH of the requested length, excluding those mutable fields, the Session-Reflector MUST return the &quot;Reflected MPLS Header MNA Data&quot; TLV with the Conformant Reflected Packet STAMP TLV flag set to 1 in the STAMP TLV Flags, following the procedure specified in <xref target="RFC10052" format="default"/>, and MUST NOT copy data from any of the matching headers.
 </t>
<t>
If the Requested MPLS Header MNA Data field is all zeros, the Session-Reflector MUST select the first NAS or PSMH with the matching length and copy its first 8 octets into the Requested MPLS Header MNA Data field of the TLV.
</t>
<t>
If no NAS or PSMH matches the requested data and length, the Session-Reflector MUST return the &quot;Reflected MPLS Header MNA Data&quot; TLV with the Conformant Reflected Packet STAMP TLV flag set to 1 in the STAMP TLV Flags, following the procedure specified in <xref target="RFC10052" format="default"/>.
</t>
</li>

<li>
<t>The Session-Reflector MUST copy the portion of the NAS or PSMH after its first 8 octets into the Received MPLS Header MNA Data field in the Session-Reflector test packet.</t>
</li>

<li>
<t>When multiple NASes or PSMHs are present, the Session-Reflector MUST process them in their order in the received test packet, beginning with the top of the label stack, and copy each into its corresponding &quot;Reflected MPLS Header MNA Data&quot; TLV in the Session-Reflector test packet, if such a TLV is present.</t>
</li>

<li>
<t>When a Session-Reflector receives a Session-Sender test packet containing a NAS or PSMH without a corresponding &quot;Reflected MPLS Header MNA Data&quot; TLV, it cannot copy that header into the Session-Reflector test packet.</t>
</li>

</list>
</t>

<t>
Because this procedure leverages existing implementations at midpoint nodes, it imposes no additional requirements when NASes and PSMHs are carried in STAMP-Test packets. Midpoint nodes process these headers using the procedures specified in their defining documents.
</t>



    </section>

    <section title="MTU Considerations" anchor="sect-4.3">
    <t>
    Each Session-Sender and Session-Reflector MUST determine the applicable path MTU for the direction in which it transmits STAMP-Test packets. This information may be provisioned, collected through management protocols, learned through a mechanism such as MTU signaling for Label Distribution Protocol <xref target="RFC3988" format="default"/> or Path MTU Discovery for IPv6 <xref target="RFC8201" format="default"/>, or distributed by a control protocol. The mechanisms for obtaining this information are outside the scope of this document.
    </t>
    <t>
    The transmitting node MUST ensure that the complete STAMP-Test packet, including all applicable MPLS, IP, UDP, STAMP, and &quot;Reflected MPLS Header MNA Data&quot; TLV fields, does not exceed the applicable path MTU. If the packet exceeds this limit, the node MUST remove complete &quot;Reflected MPLS Header MNA Data&quot; TLVs one at a time, starting with the last TLV in the packet, until the packet fits. The remaining TLVs MUST retain their relative order. If removing all such TLVs does not bring the packet within the path MTU, the node MUST NOT transmit it.
    </t>
    <t>
    The Session-Reflector MUST return requested TLVs that it can process in the order received. The Session-Sender can identify MTU-driven removal by comparing the ordered TLV sequence it sent with the sequence returned by the Session-Reflector; an intentionally unrequested header has no corresponding TLV in the Session-Sender packet. The Conformant Reflected Packet STAMP TLV flag does not indicate MTU-driven removal.
    </t>
    </section>

    <section title="Receiving MPLS Headers from the Data Plane" anchor="sect-4.4">
<t>
For the HBH and Ingress-to-Egress (I2E) scopes, the penultimate node MUST NOT remove the last copy of the NASes and PSMHs. As a result, the egress node receives them, as specified in <xref target="RFC9994" section="9.3" format="default"/> (&quot;Penultimate Node Responsibilities&quot;) and <xref target="I-D.ietf-mpls-mna-ps-hdr" section="6.3" format="default"/> (&quot;Penultimate Node Responsibilities&quot;).
</t>

<t>
For the &quot;Select&quot; scope, the NAS and its corresponding PSMH are removed from a packet at the transit node that processes the NAS. Therefore, they are not received by the egress node.
</t>

<t>
STAMP-Test packets carrying MPLS headers with NASes for the HBH and I2E scopes and PSMHs for HBH and E2E measurements are received by the egress node that hosts the Session-Reflector. When the egress data plane processes these packets, it MUST provide the MPLS headers containing the NASes and PSMHs from the Session-Sender test packets to the Session-Reflector for both unidirectional and bidirectional measurement types (see <xref target="sect-5"/>).
</t>

<t>
Similarly, when the ingress data plane processes the received STAMP-Test packets in the reverse direction, it MUST provide the MPLS headers containing the NASes and PSMHs from the Session-Reflector test packets to the Session-Sender for the bidirectional measurement type (see <xref target="sect-5"/>).
</t>

    </section>

    </section>

    <section title="Unidirectional and Bidirectional Measurements" anchor="sect-5">

    <section title="MNA Header Control Sub-TLV" anchor="sect-5.1">
<t>
This document defines the &quot;MNA Header Control&quot; Sub-TLV (Type TBA2) for the &quot;Reflected Test Packet Control&quot; TLV (Type 12) specified in <xref target="RFC10052" format="default"/>.
The format of the &quot;MNA Header Control&quot; Sub-TLV is shown in <xref target="stamp-mna-header-control-sub-tlv"/>.
</t>

   <figure anchor="stamp-mna-header-control-sub-tlv">
        <name>MNA Header Control Sub-TLV</name>
    <artwork name="" type="" align="left" alt=""><![CDATA[
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 | Sub-TLV Flags |  Type = TBA2  |         Sub-TLV Length = 0    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
    </figure>

<t>
The MNA Header Control Sub-TLV fields are defined as follows:
<list style="symbols">
<li><t>Sub-TLV Flags: An eight-bit field. The format, values, and interpretation of flags are as defined for STAMP TLV Flags <xref target="RFC8972" format="default"/>. Flag values are taken from the &quot;STAMP TLV Flags&quot; registry <xref target="IANA-STAMP" format="default"/>.</t></li>
<li><t>Type: MUST be set to TBA2.</t></li>
<li><t>Sub-TLV Length: A two-octet field equal to the length of the Data field in octets. It MUST be set to 0.</t></li>
</list>
</t>

<t>
When a Session-Reflector receives a Session-Sender test packet with the &quot;MNA Header Control&quot; Sub-TLV, and the Session-Reflector supports this Sub-TLV, the following rules apply:

<list style="numbers">
<li><t>The Session-Reflector MUST add locally generated matching NASes and PSMHs, subject to the relevant MPLS data-plane specifications, in the same order as the NASes and PSMHs received in the Session-Sender test packet. The generated headers need not be byte-for-byte copies of the received headers.</t></li>

<li><t>In the absence of the &quot;MNA Header Control&quot; Sub-TLV in the received Session-Sender test packet, a Session-Reflector omits adding locally generated matching NASes and PSMHs in the Session-Reflector test packet corresponding to the received NASes and PSMHs, based on its local policy. This does not preclude the Session-Reflector from adding MPLS headers independently of the received MPLS headers.</t></li>

<li><t>The NASes and PSMHs received in Session-Sender test packets MUST be copied and reflected in the corresponding &quot;Reflected MPLS Header MNA Data&quot; TLVs to the Session-Sender, regardless of whether the &quot;MNA Header Control&quot; Sub-TLV is present.</t></li>

<li><t>If the Session-Reflector cannot add a new matching NAS or PSMH to the Session-Reflector test packet, the Session-Reflector MUST return the &quot;Reflected Test Packet Control&quot; TLV (Type 12) <xref target="RFC10052" format="default"/> with the Conformant Reflected Packet STAMP TLV flag set to 1 in the Sub-TLV Flags of the &quot;MNA Header Control&quot; Sub-TLV, following the procedure specified in <xref target="RFC10052" format="default"/>. This can occur, for example, when the Session-Reflector does not support the NAS or PSMH, or cannot access the received NASes and PSMHs from the data plane.</t></li>

</list>
</t>

<t>
STAMP-Test packets MUST NOT carry more than one &quot;MNA Header Control&quot; Sub-TLV in a &quot;Reflected Test Packet Control&quot; TLV (Type 12) <xref target="RFC10052" format="default"/>.
If the &quot;Reflected Test Packet Control&quot; TLV (Type 12) in the Session-Sender test packet contains more than one &quot;MNA Header Control&quot; Sub-TLV,
the Session-Reflector MUST return the &quot;Reflected Test Packet Control&quot; TLV (Type 12) with 
the Conformant Reflected Packet STAMP TLV flag set to 1 in the Sub-TLV Flags of each &quot;MNA Header Control&quot; Sub-TLV, using the procedure specified in <xref target="RFC10052" format="default"/>.
</t>

    </section>

    <section title="Procedure for MNA Header Control" anchor="sect-5.2">

<t>
This document defines two measurement types: unidirectional and bidirectional measurements.
These types relate only to whether the Session-Reflector adds new matching NASes and PSMHs for the reverse path.
The Session-Reflector still copies and reflects the received NASes and PSMHs into the corresponding &quot;Reflected MPLS Header MNA Data&quot; TLVs (see <xref target="sect-4.1"/>) in both measurement types.
</t>

<t>
The measurement type for a STAMP session is locally provisioned on the STAMP Session-Sender.
</t>

<t>
In the bidirectional measurement type:
</t>

<t>A Session-Reflector adds locally generated matching NASes and PSMHs, including Ancillary Data, to the MPLS header of the Session-Reflector test packets in the same order as the NASes and PSMHs received in the Session-Sender test packets for the reverse-direction measurement. These headers need not be byte-for-byte copies of the received headers; their length and content are local decisions at the Session-Reflector.
</t>

<t>
The STAMP Session-Sender enables this type by adding the &quot;MNA Header Control&quot; Sub-TLV (see  <xref target="sect-5.1"/>) for the &quot;Reflected Test Packet Control&quot; TLV (Type 12) <xref target="RFC10052" format="default"/> to the Session-Sender test packets.
</t>

<t>
In the unidirectional measurement type:
</t>

<t> A Session-Reflector omits adding new matching NASes and PSMHs to the MPLS header of its test packets in response to the NASes and PSMHs received in the Session-Sender test packets, based on its local policy. This does not preclude the Session-Reflector from adding MPLS headers independently. 
</t>

<t>
This type is the default if the &quot;MNA Header Control&quot; Sub-TLV is absent from the Session-Sender test packet.
</t>


    </section>

    </section>

    <section title="Use Case of Reflecting IOAM Data Fields" anchor="sect-6">
    <t>
IOAM is used for recording and collecting operational and telemetry information while a packet traverses a path between two points in the network. The IOAM data fields are specified in <xref target="RFC9197" format="default"/>. Examples of data recorded by IOAM Trace Options include per-hop information, such as node ID, timestamp, queue depth, interface identifier, and interface load. The information collected can be used for monitoring paths, proof-of-transit, and troubleshooting failures in the network. IOAM can be used with STAMP-Test packets for active measurements. The procedures and STAMP extensions specified in this document can be used to reflect the collected IOAM data fields back to the Session-Sender, where the Session-Sender can use this information to support HBH and E2E measurement use cases.
</t>

<t>
<xref target="I-D.ietf-mpls-mna-ioam" format="default"/> defines MNA extensions for NASes and PSMHs to carry the IOAM option types specified in <xref target="RFC9197" format="default"/> for an MPLS data plane. The STAMP Session-Sender and Session-Reflector test packets carry IOAM option types in NASes and PSMHs for recording and collecting HBH and E2E operational and telemetry information for active measurements, as shown in <xref target="stamp-reflected-mna-data-tlv"/>. 
</t>

        <figure anchor="stamp-reflected-mna-data-tlv">
        <name>Example STAMP Session-Sender and Session-Reflector Test Packet for IOAM with &quot;Reflected MPLS Header MNA Data&quot; TLV</name>
    <artwork name="" type="" align="left" alt=""><![CDATA[
 +---------------------------------------------------------------+
 | MPLS Header                                                   |
 +---------------------------------------------------------------+
 | IOAM MNA Sub-Stack [I-D.ietf-mpls-mna-ioam]                   |
 ~                                                               ~ 
 +---------------------------------------------------------------+
 | IOAM Post-Stack MPLS Header [I-D.ietf-mpls-mna-ioam]          |
 ~                                                               ~ 
 +---------------------------------------------------------------+
 | IP Header                                                     |
 +---------------------------------------------------------------+
 | UDP Header                                                    |
 +---------------------------------------------------------------+
 | STAMP Packet [RFC8972]                                        |
 +---------------------------------------------------------------+
 | Reflected MPLS Header MNA Data TLV (TBA1)                     |
 | IOAM MNA Sub-Stack                                            |
 ~                                                               ~
 +---------------------------------------------------------------+
 | Reflected MPLS Header MNA Data TLV (TBA1)                     |
 | IOAM Post-Stack MPLS Header                                   |
 ~                                                               ~
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
    </figure>

<t>
The Session-Sender, midpoint nodes, and the Session-Reflector process the IOAM data fields, as specified in <xref target="RFC9197" format="default"/>. Note that using the IOAM option type &quot;Incremental Trace Option-Type&quot; is not supported by <xref target="I-D.ietf-mpls-mna-ioam" format="default"/>.
</t>

<t>
IOAM Direct Exporting <xref target="RFC9326" format="default"/> is applicable to STAMP-Test packets for on-path telemetry use cases.
In this case, the Session-Reflector is not required to reflect the IOAM option type, since no IOAM data fields would be recorded in the STAMP-Test packets.
Hence, the Session-Sender omits a corresponding &quot;Reflected MPLS Header MNA Data&quot; TLV in Session-Sender test packets for the IOAM Direct Exporting option type.
</t>


    </section>

    <section title="Operational Considerations" anchor="sect-7">

    <t>
    The operational considerations specified in <xref target="RFC8762" format="default"/>, <xref target="RFC10052" format="default"/>, <xref target="RFC9994" format="default"/>, and <xref target="I-D.ietf-mpls-mna-ps-hdr" format="default"/> apply to the procedures and extensions specified in this document.
    </t>

    <t>
    In addition, the management and deployment considerations specified in <xref target="RFC9197" format="default"/> apply when using the IOAM data fields specified in that document.
    </t>

    <t>
    An implementation must provide the ability to provision the measurement type as unidirectional or bidirectional, as specified in <xref target="sect-5"/>.
    </t>

    <t>
    Additionally, an operator may provision a local policy on a Session-Reflector not to copy and reflect the received MPLS NASes and PSMHs in Session-Reflector test packets to avoid exposing the collected network information to Session-Senders.
    </t>

    <t>
    The operational cosniderations related to the STAMP Session State notification specified in Section 9.2 of <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/> and Rate Limiting specified in Section 9.3 of <xref target="I-D.ietf-ippm-stamp-ext-hdr" format="default"/> also apply to the procedure specified in this document.
    </t>

    <section title="Verifying Received MPLS Headers" anchor="sect-7.1">

    <t>
    The procedure in <xref target="sect-4.2"/> uses the first 8 octets of each NAS or PSMH to disambiguate the target header when multiple NASes or PSMHs of the same length are present. The mutable 13-bit Ancillary Data field in a NAS and the 16-bit Post-Stack Data field in a PSMH are excluded from matching, as specified in <xref target="sect-4.1"/> and <xref target="sect-4.2"/>. An operator should verify that the non-mutable bits in the first 8 octets used for matching remain unchanged in transit when only some headers are to be copied and reflected in STAMP TLVs.
    </t>

    <t>
    Additionally, the procedure in <xref target="sect-4.4"/> requires the data plane on the ingress and egress nodes to provide the received MPLS headers to the Session-Sender and the Session-Reflector, respectively.
    </t>

    <t>
    For the reasons mentioned above, an operator should verify that the NASes and PSMHs are received correctly at the Session-Reflector and the Session-Sender.
    </t>

    </section>

    </section>

    <section title="Security Considerations" anchor="sect-8">

    <t>
    The security considerations specified in <xref target="RFC8762" format="default"/>, <xref target="RFC8972" format="default"/>, <xref target="RFC9994" format="default"/>, <xref target="RFC10052" format="default"/>, and <xref target="I-D.ietf-mpls-mna-ps-hdr" format="default"/> apply to the procedures and extensions specified in this document.

    In addition, the security considerations specified in <xref target="RFC9197" format="default"/> and <xref target="I-D.ietf-mpls-mna-ioam" format="default"/> also apply when using IOAM data fields.
    </t>

    <t>
    The procedures specified in this document are intended for deployment in a single network administrative domain.
    It is assumed that the operator has verified the integrity of the forward and reverse direction paths used to transmit STAMP-Test packets so that collected network information is not exposed to an undesired node.
    </t>

    <t>
    If desired, attacks can be mitigated by performing basic validation checks of the timestamp fields in received reply test packets at the Session-Sender. For example, verifying that T2 is later than T1 in the STAMP Reference Topology shown in <xref target="stamp-reference-topology"/> requires clock synchronization between the Session-Sender and 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. The minimal state associated with this protocol also limits the extent of measurement disruption caused by a corrupt or invalid test packet to a single test cycle.
    </t>

    <t>
    Furthermore, implementations MUST NOT assign STAMP Session-IDs <xref target="RFC8972" format="default"/> in a predictable
    manner to protect against off-path attacks. To avoid predictability, implementations can leverage a Cryptographically Secure Pseudorandom Number Generator
    <xref target="NIST-CSPRNG" format="default"/>.
    </t>

    </section>

    <section title="Implementation Status" anchor="sect-9">
    <t>
    Editorial note: Please remove this section prior to publication.
    </t>

    <t>
    An open-source implementation of STAMP with optional TLVs specified in <xref target="RFC8972" format="default"/>, MPLS Network Action (with In-Stack and Post-Stack Data), and the IOAM preallocated trace option <xref target="RFC9197" format="default"/> is available for the Tofino2 platform. It supports unidirectional and bidirectional measurement types for Hop-by-Hop delay measurements across four transit nodes using the extensions specified in this document.
    </t>

    <t>
    - https://github.com/uni-tue-kn/stamp-mpls-mna-poc
    </t>

    <t>
    Contact: 
    </t>
    <t>
    Fabian Ihle
    </t>

    <t>
    University of Tuebingen
    </t>
    <t>
    Germany
    </t>

    <t>
    Email: fabian.ihle@uni-tuebingen.de
    </t>

    </section>

    <section title="IANA Considerations" anchor="sect-10">

<t>
IANA is requested to allocate the following TLV from the IETF Review range of the &quot;STAMP TLV Types&quot; registry under the Simple Two-way Active Measurement Protocol (STAMP) TLV Types registry group:
</t>

    <table anchor="iana-tlv-type-tbl" align="center">
      <name>STAMP TLV Type</name>
        <thead>
          <tr>
            <th align="left">Value</th>
            <th align="center">Description</th>
            <th align="left">Reference</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left">TBA1 </td>
            <td align="center">Reflected MPLS Header MNA Data</td>
            <td align="left">This document</td>
          </tr>
        </tbody>
    </table>

<t>
IANA is requested to allocate the following sub-TLV from the IETF Review range of the &quot;STAMP Sub-TLV Types&quot; registry under the Simple Two-way Active Measurement Protocol (STAMP) TLV Types registry group:
</t>

   <table anchor="iana-tlv-type-tbl2" align="center">
       <name>Sub-TLV Type for Reflected Test Packet Control TLV</name>
        <thead>
          <tr>
            <th align="left">Value</th>
            <th align="center">Description</th>
            <th align="center">TLV Used</th>        
            <th align="left">Reference</th>
          </tr>
        </thead>
    
        <tbody>
          <tr>
            <td align="left">TBA2</td>
            <td align="center">MNA Header Control</td>
            <td align="center">Reflected Test Packet Control</td>
            <td align="left">This document</td>
        </tr>

        </tbody>
    
    </table>

    <t>Note to the RFC Editor: Please replace all occurrences of TBA1 and TBA2 with the values assigned by IANA.</t>

    </section>

    </middle>

    <back>

    <references title="Normative References">
    &RFC2119;
    &RFC8174;
    &RFC8762;
    &RFC8972;
    &RFC9994;
    &RFC10052;
    &I-D.ietf-ippm-stamp-ext-hdr;
    &I-D.ietf-mpls-mna-ps-hdr;
    &I-D.ietf-mpls-mna-ioam;

      <reference anchor="IANA-STAMP" target="https://www.iana.org/assignments/stamp-tlv-types">
        <front>
          <title>Simple Two-way Active Measurement Protocol (STAMP) TLV Types</title>
          <author>
            <organization>IANA</organization>
          </author>
        </front>
      </reference>
    </references>

    <references title="Informative References">
    &RFC3988;
    &RFC8201;
    &RFC9197;
    &RFC9326;

    <reference anchor="NIST-CSPRNG">
          <front>
            <title>Recommendation for Random Number Generation Using Deterministic Random Bit Generators</title>
            <author>
              <organization>NIST Special Publication 800-90A</organization>
            </author>
            <date month="January" year="2012"/>
          </front>
    </reference>

    </references>

    <section title="Acknowledgments" numbered="no" anchor="acknowledgments">

    <t>
    The authors of this document would like to thank Greg Mirsky for reviewing
    this document and providing review comments.
    The authors would also like to thank Fabian Ihle for implementing the
    solution defined in this document in Tofino2. 
    </t>

    </section>

    </back>

    </rfc>
