<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" docName="draft-jags-mpls-mna-hdr-02" category="std" ipr="trust200902" obsoletes="" updates="" xml:lang="en" sortRefs="false" symRefs="true" tocInclude="true" version="3" consensus="true">
  <!-- xml2rfc v2v3 conversion 3.12.0 -->
  <!-- Generated by id2xml 1.5.0 on 2020-03-06T17:47:05Z -->
    <front>
    <title abbrev="MPLS Network Action Encodings">MPLS Network Action (MNA) Header Encodings </title>
    <seriesInfo name="Internet-Draft" value="draft-jags-mpls-mna-hdr-02"/>
    <author fullname="Jaganbabu Rajamanickam" initials="J." role="editor" surname="Rajamanickam">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <postal>
          <street>Canada</street>
        </postal>
        <email>jrajaman@cisco.com</email>
      </address>
    </author>
    <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="Royi Zigler" initials="R." role="editor" surname="Zigler">
      <organization>Broadcom</organization>
      <address>
        <email>royi.zigler@broadcom.com</email>
      </address>
    </author>

    <author fullname="Haoyu Song" initials="H." role="editor" surname="Song">
      <organization>Futurewei Technologies</organization>
      <address>
        <email>haoyu.song@futurewei.com</email>
      </address>
    </author>

    <author fullname="Kireeti Kompella" initials="K." role="editor" surname="Kompella">
      <organization>Juniper Networks</organization>
      <address>
     <postal>
          <street>United States</street>
        </postal>
        <email>kireeti.ietf@gmail.com</email>
      </address>
    </author>

    <date day="10" month="October" year="2022"/>
    <workgroup>MPLS Working Group</workgroup>
    <abstract>
      <t>
This document defines the MPLS Network Action (MNA) Header encoding formats to carry Network Actions and optionally Ancillary Data in the label stack and post label stack. The MPLS Network Action can be used for example, to influence the forwarding decisions or to carry additional OAM information in the MPLS packet. This document addresses the MNA requirements specified in draft-ietf-mpls-mna-requirements. This document follows the MNA framework specified in draft-ietf-mpls-mna-fwk.

     </t>

    </abstract>
  </front>
  <middle>
    <section anchor="sect-1" numbered="true" toc="default">
      <name>Introduction</name>
      <t>
    <xref target="RFC3032" format="default"/> defines MPLS Header for carrying a stack of MPLS labels which are used to forward packets in an MPLS network.
    Today's new applications require the MPLS packets to carry network action indicators and optional Ancillary Data (AD) that can be used for example, in MPLS packet forwarding decision or for OAM purpose. 
    Ancillary Data can be used to carry additional information, for example, a network slice identifier, In-Situ OAM (IOAM) data, etc. Several MNA applications are described in <xref target="I-D.ietf-mpls-mna-usecases" format="default"/>. </t>
      <t>
   This document defines a solution to encode MPLS Network Actions (MNA) in an MPLS Label Stack those are efficient to process in hardware. 
   The MPLS Network Actions are encoded in the form of flags and opcodes. These MPLS Network Actions can be encoded without 
   Ancillary Data (AD) or with In-Stack Ancillary Data (ISD) or with Post-Stack Ancillary Data (PSD) (i.e., after the Bottom of the Stack (BOS)). 
   A new base Special Purpose Label (bSPL) (value TBA1) is to be assigned to indicate the presence of MPLS Network Action Sub-Stack (MNAS) in the MPLS packet.
   This document addresses the MNA requirements specified in <xref target="I-D.ietf-mpls-mna-requirements" format="default"/>.  
   This document follows the MNA framework specified in <xref target="I-D.ietf-mpls-mna-fwk" format="default"/>.
      </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", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in <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>Abbreviations</name>

    <t>The MNA terminology defined in <xref target="I-D.ietf-mpls-mna-fwk" format="default"/> and <xref target="I-D.ietf-mpls-mna-requirements" format="default"/> are used in this document.</t>

 <ul>
        <li>
   AD: Ancillary Data. </li>
        <li>
   BOS: Bottom Of Stack. </li>
        <li>
   IHS: I2E, HBH, Select Scope. </li>
        <li>
   I2E: Ingress-To-Egress. </li>
        <li>
   HBH: Hop-By-Hop Scope. </li>
        <li>
   ISD: In-Stack Data. </li>
        <li>
   IS-NA: In-Stack Network Action. </li>
        <li>
   IS-NAI-Opcode: In-Stack Network Action Opcode. </li>
        <li>
   LSE: 32-bit Label Stack Entry. </li>
        <li>
   MPLS: Multiprotocol Label Switching. </li>
        <li>
   MNA: MPLS Network Action. </li>
        <li>
   NAI: Network Action Indicator. </li>
        <li>
   NAI-OP: Network Action Indicator Opcode. </li>
        <li>
   NAL: Length of Network Action in number of LSEs, excluding the LSE for Opcode. </li>
        <li>
   NASL: Length of Network Action sub-stack in number of LSEs. </li>
        <li>
   NASI: Network Action Sub-Stack Indicator. </li>
        <li>
   NASS: Network Action Sub-Stack. </li>
        <li>
   PS-NA: Post-Stack Network Action. </li>
        <li>
   P,H: Post-Stack Network Action Presence and Post-Stack Hop-By-hop presence Indicator. </li>
        <li>
   PSD: Post-Stack Data. </li>
        <li>
   bSPL: Base Special Purpose Label in the range of 0-15. </li>
        <li>
   TC: Traffic Class. </li>
        <li>
   TTL: Time To Live. </li>

</ul>
      </section>
    </section>

    <section anchor="sect-3" numbered="true" toc="default">
        <name>Overview</name>

        <t> 
      The solution for encoding MPLS Network Actions includes two high-level parts as shown in Figure 1. </t>
      <ul empty="true" spacing="normal">
          <li>  1. Network Action Sub-Stack Header - The Network Action Sub-Stack Indicator label indicates the presence of MPLS Network Action Sub-Stack in the MPLS label stack. The NASS encoding parameters indicate the structure of the NASS. 
              </li>

          <li>  2. In-Stack Network Actions Encoding - The encoding in which the MPLS Network Actions are carried in the MPLS header. 
          This includes Network Action Indicator (NAI) and Ancillary Data (AD). 
              The Network Action can be In-Stack and Post-Stack. </li>
      </ul>

        <figure anchor="SPL-Ext-Hdr-Format-isd">
          <name>Network Action Sub-Stack Header</name>
          <artwork name="" type="" align="left" alt=""><![CDATA[


 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI Label = bSPL (TBA1)          | TC  |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode    | Flag-Based NAIs or AD |R|NAL|S|P,H|IHS|  NASL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                                |<--NASS Param->|
     ]]></artwork>
        </figure>

    <t> Both parts of the encoding solution are described below.</t> 

    <section anchor="sect-3.1" numbered="true" toc="default">
        <name>Network Action Sub-Stack Header</name>

   <t> Network Action Sub-Stack Header contains NASI Label and NASS encoding parameters as described below. </t>
   <t> NASI Label: </t>
     <t>A new bSPL value (value TBA1) is assigned to indicate the presence of the MPLS Network Action Sub-Stack (NASS).  </t>
     <t>Note: The TC and TTL fields of the new bSPL are not re-purposed for NASS encoding parameters, as the penultimate node on the MPLS packet path may propagate TTL and TC fields from the transport (or forwarding) LSE to the next LSE on the label stack, overwriting the TTL and TC fields of the next LSE, as specified in Section 3.5 of <xref target="RFC3443" format="default"/>.  When the penultimate node is not aware of the NASI bSPL (value TBA1) e.g., in case of legacy network, this can cause NASS parameters in the TTL of the NASI label to be corrupted.</t>
   <t> NASS Encoding Parameters: </t>
   <t> The TTL field in the second LSE is used to encode NASS encoding parameters. The NASS encoding parameters contain scope and the length of NASS as well as presence flags for Post-Stack Network Action and Ancillary Data.</t>

   <t> NASS Scope: </t>
   <t>This indicates the scope (HBH / Select / I2E) of NASS for different nodes (e.g., midpoint nodes and egress node) where it needs to be processed. </t>

   <t> Separate NASS Per Scope: </t>
   <t>If a packet requires to carry both HBH and I2E scoped In-Stack NAs, then one NASS with scope of HBH and one NASS with scope I2E are added in the MPLS label stack. The I2E scoped NASS is added closer to the BOS whereas HBH and Select scoped NASS are added closer to the top of the label stack. This makes it easier for the midpoint nodes to process only the NASS with HBH scope in hardware. </t>

       <ul>
       <li> IHS (I2E, HBH, and Select Scope): This 2-bit value indicates the scope of In-Stack NAIs. </li>
       </ul>
        <table anchor="In-Stack-scope-tbl" align="center">
          <name>In-Stack NAI Scope Table </name>
          <thead>
            <tr>
              <th align="left"> Bits </th>
              <th align="left"> Scope </th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">00</td>
              <td align="left">I2E</td>
            </tr>
            <tr>
              <td align="left">01</td>
              <td align="left">HBH</td>
            </tr>
            <tr>
              <td align="left">10</td>
              <td align="left">Select</td>
            </tr>
            <tr>
              <td align="left">11</td>
              <td align="left">Reserved</td>
            </tr>
          </tbody>
       </table>

          <ul>
      <li>P,H (Post-Stack Network Action Presence and Post-Stack Hop-By-hop processing Indicator): </li>
       </ul>
    <ul empty="true">
      <li>This is 2-bit flag, where "P" bit indicates the presence of Post-Stack Network Actions and "H" bit indicates the presence of Post-Stack Hop-By-Hop and/or Select processing scope options. While encoding the Post-Stack NAs, the HBH/Select scope NAs MUST be encoded first (closer to the BOS) and then I2E.</li>
       </ul>
 
   <t> NASL (Network Action Sub-Stack Length): </t>
   <t> This is a 4-bit field in the TTL. This indicates the total length of the current NASS. This value does not include the first two LSEs in the NASS. This value is used by the ASICs to process the NASS. </t>

   <t> NAL (Network Action Length): </t>
   <t>
  The 2-bit field in TC is used to carry the number of additional LSEs used to carry the Ancillary Data for the Network Action. 
  It does not include the 1st LSE that contains the NAI-Opcode. </t>
   <t>In the case where the node does not support the NAI-Opcode value, the NA length is used to skip the NAI-Opcode and move to the next Opcode and continue processing.</t> 

   <t> R bit: </t>
      <t>R bit in the TC field is Reserved for future use. </t>

      </section>

    <section anchor="sect-3.2" numbered="true" toc="default">
        <name>In-Stack Network Action Encoding</name>

      <t>The MPLS Network Action encoding carried as part of the MPLS label stack uses Opcodes for indicating Network Actions (called NAI-Opcodes). </t>

      <t>The encoding format defined is flexible (e.g., stackable opcodes in desired order), extensible (by defining new NAI-Opcodes) and ASIC friendly (by using Sub-Stack Length, Opcode and Data in the same LSE). This encoding format also allows to carry the Flag-Based NAIs that do not require AD and the Flag-Based NAIs that require AD in the same packet.</t>

      <t>The opcode method of identifying a specific Network Actions are common in today's hardware ASICs (Similar to any IPv4/IPv6/VxLAN header processing), so this method is easy to be adopted by the existing hardware.  This will allow the hardware ASICs to serially or in-parallel process the Network Actions.</t>

      <figure anchor="mpls-label-format">
        <name>MPLS Label Stack Entry (LSE) Format</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              Label                    | TC  |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      NASI=bSPL (TBA1)                 | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode    |    Ancillary Data     |R|NAL|S|P,H|IHS|  NASL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode    |    Ancillary Data     |R|NAL|S| Ancillary Data|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    ]]></artwork>
      </figure>


    <t> In-Stack Network Actions are encoded in the TLV format. NAI-Opcode represents NA Indicator Type, NAL represents NA Length and Ancillary Data represents NA Value. </t>
      <ul spacing="normal">
        <li>  It uses MPLS Label field to carry the Network Action Indicator Opcode and associated In-Stack Ancillary Data (can be NAI Flags). </li>
        <li>  It uses Traffic Class (TC) field to carry the Length of the In-Stack Network Action's Ancillary Data. </li>
        <li>  It uses MPLS Label and Time-To-Live (TTL) fields to carry the In-Stack Ancillary Data (can be NAI Flags). </li>
      </ul>

      <t> NAI-Opcode: </t>
      <t>This is the first 8-bit value in the Label Field.</t>
      <t> Ancillary Data: </t>
      <t> This is the additional Data carried to process the Network Action specified by the NAI-Opcode. </t>
      <ul spacing="normal">
        <li> The 12 bits of the Label field is used to carry the Ancillary Data </li>
    <li> Apart from the Label field, part of AD is also carried in the 8-bit TTL field except for the 2nd LSE in the NASS. 
         If an application needs only 12-bit of AD, then 2nd LSE can be used for NAI-Opcode otherwise it can use the next LSE for 20-bit of AD.</li>
    <li> Some applications need to change the Ancillary Data for the same flow, in those cases the data is encoded in the the TTL field. </li>
      </ul>

      <t> NOTE: ECMP Hash Using Label Stack: </t>
      <ul empty="true" spacing="normal">
        <li> A midpoint node may use the entire MPLS Label Stack for ECMP hash computation hence the In-Stack MPLS extension header MUST NOT change the Label Field part of the Ancillary Data within the same traffic flow. But the TTL part of In-Stack Ancillary Data can change for the same traffic flow without affecting the ECMP hash. The In-Stack Network Action encoding defined above ensures this. </li>
      </ul>

      </section>

    </section>

    <section anchor="sect-J5" numbered="true" toc="default">
      <name>Reserved In-Stack MPLS Network Action Opcodes</name>

      <t> This opcode ranges from 1 to 255.  </t>

      <t>NAI-Opcode value of 0 is marked as invalid to avoid the label value from aliasing with the reserved bSPLs.</t> 

      <t>Some of the opcodes are reserved as described below for the basic functionality and the rest of the opcodes are assigned by IANA.</t>

       <ul>
         <li> IS-NAI-Opcode Value:1 (PSD Offset) - Opcode reserved to indicate the start offset of the Post-Stack Network Actions header after the MPLS Label Bottom of the Stack.  This can allow to carry Generic Control Word (0000b) <xref target="RFC4385" format="default"/> and G-ACh (0001b) [RFC5586] fields immediately after the BOS. Adding of this opcode is not required when the BOS data starts immediately after the Bottom of the Label Stack (i.e. when offset is 0) </li>
      </ul>


      <ul spacing="normal">
         <li> IS-NAI-Opcode Value:2 (Flag-Based NAIs with No AD) - Opcode reserved to carry the Flag-Based NAIs those do not require Ancillary Data. These NAI flag bits are carried in the Ancillary Data field of the Opcode.</li>
      </ul>
      <figure anchor="In-Stack-Flag-Based-NAI-Opcode">
        <name>In-Stack Flags-Based NA Encoding Format</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      NASI=bSPL (TBA1)                 | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |   Flag-Based NAIs     |R| 0 |S|P,H|IHS|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

    <ul empty="true">
      <li>The Flags bit position for a specific application will be maintained and allocated by IANA. </li>
    </ul>

    <ul>
      <li> IS-NAI-Opcode Value:3 (Flag-Based NAIs with ADs) - Opcode reserved to carry the Flag-based NAIs with ADs in the next LSEs. </li>
    </ul>

      <figure anchor="In-Stack-Ext-Hdr-2">
        <name>In-Stack Flag-Based NAs with Ancillary Data</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=3  |   Flag-Based NAIs     |R| 1 |S|P,H|IHS|NASL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|             Ancillary Data                |S|Ancillary Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

    <ul empty="true">
      <li> The NASS is carrying the reserved opcode 3 for Flags-Based NAIs that require ADs. </li>
      </ul>

      <ul>
        <li> IS-NAI-Opcode Value:4 (PSD Network Action Indicator Opcode) - Opcode reserved to indicate that a specific Post-Stack Network Action has to be executed in order with respect to the In-Stack Opcode. </li>
      </ul>
      <figure anchor="In-Stack-PSD-Opcode-Indicator">
        <name>In-Stack PSD Opcode Indicator Encoding Format</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      NASI=bSPL (TBA1)                 | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=4  |   Post-Stack-NAI      |R| 0 |S|P,H|IHS|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
    <ul empty="true">
        <li> A NAI-Opcode 4 is reserved to carry Post-Stack NA as AD. 
            This NAI-Opcode can be used to specify the ordering between In-Stack and Post-Stack Network Actions. </li>
    </ul>

    <ul>
        <li>IS-NAI-Opcode Value:5-254 (Application Defined Opcode) - MUST be assigned by IANA. When this opcode is allocated for a specific applications Network Action, the respective application MUST define the Ancillary Data format and other required attributes like functionality, scope (I2E / HBH/ SEL) of the Network Action. </li>
        <li>IS-NAI-Opcode Value:255 (Extended Opcode) - IANA Allocated for IS-NAI-Opcode range extension. This gives the extensibility for opcode range beyond 255. The Extended 8-bit opcode value will be encoded next to base opcode value 255. </li>
      </ul>
      <figure anchor="In-Stack-Extended-Opcode">
        <name>In-Stack Extended Opcode Encoding Format</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      NASI=bSPL (TBA1)                 | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |   Flag-Based NAIs     |R| 0 |S|P,H|IHS|NASL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|NAI-Opcode=255 |Ex-NAI-Opcode=9|  AD9  |R| 0 |S|    AD9        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      <ul empty="true">
        <li> In the above example, the extended Opcode "9" is encoded in the packet. In this case only 12 bits of AD could be encoded in the same LSE, if the application requires to encode more than 12 bits then it had to use next LSE to encode the rest of the AD. </li>
      </ul>

    </section>

    <section anchor="sect-J6" numbered="true" toc="default">
      <name>Post-Stack MPLS Network Action Encoding </name>
      <t> Based on the P and H flags, the Post-Stack Network Actions are processed. The details of the Post-Stack Network Action Extension Header encoding is specified in <xref target="I-D.song-mpls-extension-header" format="default"/>. </t>
    </section>

    <section anchor="sect-J6.a" numbered="true" toc="default">
      <name>Network Action Processing Order</name>
      <t> Depending on the application, each NA will be processed at different stages of the ASICs pipeline. But in some cases, there may be contention between processing two NAs at the same stage of ASICs, in those cases the processing order should be maintained, so that the result of the packet forwarding and OAM data collection will be predictable.</t>
       <section anchor="sect-J6.a1" numbered="true" toc="default">
              <name>In-Stack NA Processing Order</name>
        <t> This section talks about maintaining the ordering between the In-Stack NA processing. </t>
        <t> The order of processing the NA should follow the order of NAs encoded in the NASS. </t>
      <figure anchor="In-Stack-NA-Ordering-1">
        <name>Example In-Stack NA Processing Order</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 0 |S|P,H|IHS|NASL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=5  |    Ancillary Data5    |R| 0 |S|Ancillary Data5|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      <t> In the above example, a node will process the Flags-Based-NAIs first and then the NAI-Opcode "5". </t> 
      <t> In some cases, some Flag-Based NAIs may need to be processed before the NAI-Opcode "5" and some Flag-Based NAIs may need to be process after the NAI-Opcode "5". </t>
      <figure anchor="In-Stack-NA-Ordering-2">
        <name>Example In-Stack NA Processing Order</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |      0x01             |R| 0 |S|P,H|IHS|NASL=2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=5  |    Ancillary Data5    |R| 0 |S|Ancillary Data5|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |      0x02             |R| 0 |S|   0x00        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
    <t> In the above example, the Flag-Based NAI "0x1" is processed before the NAI-Opcode "5" and the Flags-Based NAI "0x2" is processed after the NAI-Opcode "5". </t>

        </section>
       <section anchor="sect-J6.a2" numbered="true" toc="default">
              <name>Post-Stack NA Processing Order</name>
              <t> Post-Stack NAs follow ordering specified in <xref target="I-D.song-mpls-extension-header" format="default"/>.</t>
       </section>

       <section anchor="sect-J6.a3" numbered="true" toc="default">
              <name>Mix of In-Stack and Post-Stack NA Processing Order</name>
       <t> In some cases, Post-Stack NA needs to be processed before In-Stack NA. This section describes how to prioritize the Post-Stack NAs over the In-Stack NAs. </t>
      <figure anchor="In-Stack-NA-Ordering-3">
        <name>Example Post-Stack and In-Stack NA Processing Order</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |      0x01             |R| 0 |S|P,H|IHS|NASL=2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=4  |    Post-Stack-NAI6    |R| 0 |S| PS-NAI6       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=5  |    Ancillary Data5    |R| 0 |S|Ancillary Data5|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

       <t> In the above example, the Flag-Based NAIs required to be processed first, followed by the Post-Stack NA "6" and then In-Stack NAI-Opcode "5". The NAI-Opcode "4" is a reserved opcode which can be used for ordering between the In-Stack and Post-Stack. In this example, the AD field of the NAI-Opcode "4" carries the Post-Stack NA that is processed before processing the NAI-Opcode "5".</t>

       </section>
    </section>


    <section anchor="sect-J9" numbered="true" toc="default">
      <name>Handling of Unsupported Network Actions</name>
      <t>When a node encounters an unsupported NAI-Opcode in the NASS it is processing, the node skips processing that NAI-Opcode using the NAL field and moves to processing the next NAI-Opcode.</t>

      <t>When a node encounters a Flag-based NAI that it doesn’t support, it stops further processing the Flag-Based NAIs in that NAI-Opcode. This is because the Flag-Based NAI may or may not have AD and a node will not be able to know the length for each Flag-Based-NAI.</t>

     <t>The node MUST NOT drop the packet when it encounters any NA in the MNA NASS that it does not support.</t>

    </section>


    <section anchor="sect-J99" numbered="true" toc="default">
      <name>MNA for Segment Routing Label Stack</name>

     <t> 
     For packets with Segment Routing [RFC8662] MPLS label stack, a copy of NASS with HBH and Select scope is placed at regular depth throughout the MPLS label stack, 
     with the understanding that the current copy of the NASS will eventually rise to the top of the label stack.
     </t>

     <t> 
     For HBH scope, every node processes the current copy of the NASS and the node that pops the forwarding label that exposes the NASS will not remove it but
     forward it to the next node (i.e., segment endpoint node). The segment endpoint node that receives the NASS at the top of the label stack has to remove it.
     </t>

     <t> 
     For I2E scope, only one copy of NASS needs to be added and it is added near the bottom of the stack.
     </t>
    </section>


    <section anchor="sect-J10" numbered="true" toc="default">
      <name>Node Capability Signaling</name>
      <t> The node capability for the MPLS Network Action must be signaled before the MPLS Encapsulating node can add the necessary MPLS Network Action in the MPLS Label Stack.  The capability signaling will be added in LDP, RSVP-TE, BGP, IS-IS, OSPF, BGP-LS, etc. This is outside the scope of this document.
      </t>
    </section>

    <section anchor="sect-J11" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>The security considerations in <xref target="RFC3032" format="default"/> also apply to the procedures defined in this document.
    The NASI Label (bSPL TBA1) MUST NOT be exposed on the node which does not support it. </t>
    </section>

    <section anchor="sect-J12" numbered="true" toc="default">
      <name>Backward Compatibility</name>

      <ul spacing="normal">
       <li> For the legacy node that does not advertise the MPLS Network Action capability, the Encapsulating node MUST make sure that the MPLS Network Action Sub-Stack indicator is not at the top of the MPLS Label Stack to avoid dropping the packets. Based on the signalling, if the MPLS egress node is not capable of the processing MPLS Network Actions then it should not add MNA in the packet. In the worst case, if the legacy routes that does not understand the new bSPL allocated then those routers will drop the packets.</li> 
      <li> The MPLS Network Action Encoding format is designed to make sure that it does not alias with any reserved bSPL. </li> 
      <li> The MPLS Network Actions can co-exist with the existing GAL / G-ACh based encoding of data. </li>
      <li>The TC and
      TTL fields of the NASI bSPL are not re-purposed for encoding, as the
      penultimate node on the MPLS packet path may propagate TTL from
      the transport (or forwarding) label to the next label on the label
      stack, overwriting the TTL on the next label.  When the penultimate node is not aware
      of the NASI bSPL (value TBA1), this can cause encoding format flags
      in the TTL of the NASI (label TBA1) label to be corrupted.</li>

    </ul>

    </section>

    <section anchor="sect-J12.1a" numbered="true" toc="default">
      <name>Processing In-Stack MPLS Network Actions</name>
      <t> Encapsulating Node: </t>
      <ul spacing="normal">
        <li> MUST NOT add In-Stack MPLS Network Action Sub-Stack if the decapsulation node is not capable of In-Stack MPLS Network Action.</li>
        <li> SHOULD NOT change the IS-NAI-Opcode and the first 12 bits of the In-Stack Ancillary Data for the same packet flow to avoid ECMP path change. </li>
        <li> MAY change In-Stack Ancillary Data part present only in the TTL field for the same packet flow. </li>
        <li> MUST ensure that the penultimate node does not remove the NASS.</li>
      </ul>
      <t> Midpoint Node: </t>
      <ul spacing="normal">
        <li> MUST ignore the IS-NAI-Opcode that are not supported.  </li>
        <li> MUST NOT add In-Stack NASS if the decapsulation node is not capable of In-Stack MPLS Network Actions.</li>
        <li> SHOULD NOT change the IS-NAI-Opcode and the first 12 bits of the In-Stack Ancillary Data for the same packet flow. </li>
        <li> MAY change In-Stack Ancillary Data part present only in the TTL field for the same packet flow. </li>
        <li> MAY remove the IS-NAI-Opcode and its Ancillary Data for all matching packet flow. </li>
      </ul>
      <t> Penultimate Node: </t>
      <ul spacing="normal">
        <li> MUST ignore the IS-NAI-Opcode that are not supported.  </li>
        <li> MUST NOT remove the NASS when it is exposed after removing the forwarding (transport) label. </li>
      </ul>
      <t> Decapsulating Node: </t>
      <ul spacing="normal">
        <li> MUST remove the MPLS Network Action Sub-Stack. </li>
      </ul>
    </section>

    <section anchor="sect-J13" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>Below are the IANA actions which this document is requesting.</t>

      <t>The registries created by this document will be collected in a new registry grouping called “MPLS Network Action,” 
      which will be located at https://www.iana.org/assignments/mpls-network-action.</t>
      
      <section anchor="sect-J13.10" numbered="true" toc="default">
        <name>IANA Considerations for MNA NASS Encoding Parameters</name>
        <t>IANA is requested to create a new registry with name "MNA NASS Encoding Parameters" to assign the bit position and the meaning to the Parameters that re-purpose TTL and TC fields in the Label Stack Entry (LSE).</t>

        <table anchor="iana-fif-tbl" align="center">
          <name>MNA NASS Encoding Parameters Registry</name>
          <thead>
            <tr>
              <th align="left"> Bit Position</th>
              <th align="left"> Description</th>
              <th align="left"> Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">20-31</td>
              <td align="left">IETF Review</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
       </table>

       <t>Following NASS Encoding Parameter values are assigned from this registry. </t>
        <table anchor="iana-is-fiflag-tbl" align="center">
          <name>MNA NASS Encoding Parameter Values</name>
          <thead>
            <tr>
              <th align="left"> Value</th>
              <th align="left"> Description</th>
              <th align="left"> Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">28-31</td>
              <td align="left">In-Stack Network Action Sub-Stack Length (NASL)</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">26-27</td>
              <td align="left">In-Stack Scope value E2H/HBH/SEL(IHS)</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">25</td>
              <td align="left">Post-Stack Hop-By-Hop Processing Indicator</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">24</td>
              <td align="left">Post-Stack Network Action Presence Indicator </td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">23</td>
              <td align="left">End of Stack (S)</td>
              <td align="left">RFC 3032</td>
            </tr>
            <tr>
              <td align="left">21-22</td>
              <td align="left">In-Stack Network Action Length (NAL)</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">20</td>
              <td align="left">Reserved Bit (R)</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>

      </section>

      <section anchor="sect-J13.1" numbered="true" toc="default">
        <name>IANA Considerations Flag-Based Network Actions</name>
        <t>IANA is requested to create a new registry with name "In-Stack MPLS Network Action Indicator Flags" to assign a bit position and the meaning to the Flag-Based Network Action upon the user request. Based on the need this registry can be extended beyond 12 bit positions. </t>
        <table anchor="iana-nafif-tbl-1" align="center">
          <name>In-Stack MPLS Network Action Indicator Flags Registry</name>
          <thead>
            <tr>
              <th align="left"> Bit Position</th>
              <th align="left"> Description</th>
              <th align="left"> Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">11-0</td>
              <td align="left">Unassigned</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>

      </section>

      <section anchor="sect-J13.2" numbered="true" toc="default">
          <name>IANA Considerations for I2E and HBH/Select IS-NAI-Opcode</name>

        <t>IANA is requested to create a new registry with name "I2E In-Stack MPLS Network Action Indicator Opcodes" to assign IS-NAI-Opcode values.
   All code-points in the range 1 through 175 in this registry shall be
   allocated according to the "IETF Review" procedure as specified in
   <xref target="RFC8126" format="default"/>.  Code points in the range 176 through 239 in this
   registry shall be allocated according to the "First Come First
   Served" procedure as specified in <xref target="RFC8126" format="default"/>. 
   Remaining code-points are allocated according to <xref target="iana-is-fioc-reg-tbl" format="default"/>:
        </t>
        <table anchor="iana-is-fioc-reg-tbl" align="center">
          <name>I2E In-Stack MPLS Network Action Indicator Opcodes Registry</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">0 - 175</td>
              <td align="center">IETF Review</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">176 - 239</td>
              <td align="center">First Come First Served</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">240 - 251</td>
              <td align="center">Experimental Use</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">252 - 254</td>
              <td align="center">Private Use</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>

        <t>Following I2E IS-NAI-Opcode Indicator values are assigned from this registry. </t>
        <table anchor="iana-is-fioc-tbl" align="center">
          <name>I2E In-Stack Network Action Indicator Opcode Values</name>
          <thead>
            <tr>
              <th align="left"> Value</th>
              <th align="left"> Description</th>
              <th align="left"> Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0</td>
              <td align="left">Reserved</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">1</td>
              <td align="left">Offset of start of Post-Stack Network Action Header</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">2</td>
              <td align="left">Flag-Based Network Action Indicators with No AD</td>
              <td align="left">This document</td>
            </tr>
        <tr>
              <td align="left">3</td>
              <td align="left">Flag-Based Network Action Indicators with AD</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">4</td>
              <td align="left">Post-Stack Network Action Indicator</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">255</td>
              <td align="left">Opcode Range Extension Beyond 255</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>


    <t>IANA is requested to create a new registry with name "HBH and Select In-Stack MPLS Network Action Indicator Opcodes" to assign IS-NAI-Opcode values.
   This registry is also used for Select scope.
   All code-points in the range 1 through 175 in this registry shall be
   allocated according to the "IETF Review" procedure as specified in
   <xref target="RFC8126" format="default"/>.  Code points in the range 176 through 239 in this
   registry shall be allocated according to the "First Come First
   Served" procedure as specified in <xref target="RFC8126" format="default"/>. 
   Remaining code-points are allocated according to <xref target="iana-is-fioc-reg-tbl" format="default"/>:
        </t>
        <table anchor="iana-is-fioc-reg-tbl-2" align="center">
        <name>HBH and Select In-Stack MPLS Network Action Indicator Opcodes Registry</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">0 - 175</td>
              <td align="center">IETF Review</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">176 - 239</td>
              <td align="center">First Come First Served</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">240 - 251</td>
              <td align="center">Experimental Use</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">252 - 254</td>
              <td align="center">Private Use</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>

    <t>Following HBH and Select IS-NAI-Opcode Indicator values are assigned from this registry. </t>
        <table anchor="iana-is-fioc-tbl-2" align="center">
        <name>HBH and Select In-Stack Network Action Indicator Opcode Values</name>
          <thead>
            <tr>
              <th align="left"> Value</th>
              <th align="left"> Description</th>
              <th align="left"> Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0</td>
              <td align="left">Reserved</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">1</td>
              <td align="left">Offset of start of Post-Stack Network Action Header</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">2</td>
              <td align="left">Flag-Based Network Action Indicators with No AD</td>
              <td align="left">This document</td>
            </tr>
        <tr>
              <td align="left">3</td>
              <td align="left">Flag-Based Network Action Indicators with AD</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">4</td>
              <td align="left">Post-Stack Network Action Indicator</td>
              <td align="left">This document</td>
            </tr>
            <tr>
              <td align="left">255</td>
              <td align="left">Opcode Range Extension Beyond 255</td>
              <td align="left">This document</td>
            </tr>
          </tbody>
        </table>

      </section>

      <section anchor="sect-J13.6" numbered="true" toc="default">
        <name>IANA Considerations for NASI bSPL Label</name>
        <t>IANA is requested to allocate a value TBA1 for the NASI bSPL label from the "Base Special-Purpose MPLS Label Values" registry to indicate the presence of MNA Sub-Stack in MPLS header.</t>
      </section>

    </section>

    <section anchor="sect-J14" numbered="true" toc="default">
      <name>Appendix</name>

    <section anchor="sect-J7" numbered="true" toc="default">
      <name>Network Action Encoding Examples</name>
    <section anchor="sect-J7.1" numbered="true" toc="default">
      <name>Example-1 - Flag-Based In-Stack NA without AD</name>

      <figure anchor="In-Stack-Ext-Hdr-1-a">
        <name>Example NASS with In-Stack Network Action Encoding Carrying Flag-Based NA</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 0 |S|P,H|IHS|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      
      <t> Second LSE: </t>
      
      <t> Label Field: </t>
      <ul>
        <li> NAI-Opcode is set to "2". </li>
        <li> Next 12 bits are used to encode the Flag-Based Network Actions that do not need Ancillary Data. Each bit encoded is a unique Flag-Based Network Action. This bit position will be assigned by IANA. For example, an application A can be allocated Flag position as "2" and another application B can be allocated Flag position as "5". If application A and B needs to set their Network Actions then the bit positions "2" and "5" will be set to 1. </li>
      </ul>
      <t> TC Field: </t>
      <ul empty="true" spacing="normal">
        <li> NAL - This value depends on the number of LSEs carrying the NAI Flags in the MPLS In-Stack header is carrying. In this case, the packet is carrying only bit position "1" and "3", both in one LSE, the NAL will be set to "0".</li>
      </ul>
      <t> TTL Field: </t>
      <ul empty="true" spacing="normal">
        <li> NASL value is set to "0" as no additional LSEs are encoded.</li>
      </ul>

      <figure anchor="In-Stack-Ext-Hdr-1-a-ext">
        <name>Example NASS carrying Flag-Based NA with more than 12 Flags</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  | TC  |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 1 |S|P,H|IHS|NASL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1| Additional Flag-Based NAIs                |S|Flag-Based-NAIs|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      <t>In this example, let us assume that an application-C has been allocated a Flag position of "21" by IANA, If the application-C needs to execute its Network Action on the MPLS packet then the 2nd bit in the third Label field will be set to indicate the Flags position "13".</t>
      <t> NAL is set to "1" indicates the Flag-Based NAIs are also encoded in the next LSE.</t>
      <t> NASL is set to "1" indicates the additional In-Stack LSE is encoded. </t>
      <t> While encoding the Additional Ancillary Data in the 3rd LSE, the Most Significant bit MUST be set to "1" to prevent from aliasing with the reserved bSPLs.</t>
    </section>

    <section anchor="sect-J7.2" numbered="true" toc="default">
      <name>Example-2 - In-Stack NA with 12-bit AD </name>

      <figure anchor="In-Stack-Ext-Hdr-2a">
        <name>Example NASS carrying In-Stack Network Action that requires Ancillary Data</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=6  |   Ancillary Data6     |R| 0 |S|P,H|IHS|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      <t> In this example, the NASS is carrying only the In-Stack Network Action that requires 12-bit Ancillary Data. </t>
      <t> The 8-bit value contains the NAI-Opcode.  </t>
      <t> Next 12 bits carries the AD for the NAI-Opcode "6". </t> 
      <t> No additional LSE is encoded so NAL value is set to "0". </t>
       
    </section>

    <section anchor="sect-J7.3" numbered="true" toc="default">
      <name>Example-3 - Carry only Post-Stack NA Indicator </name>

      <figure anchor="In-Stack-Ext-Hdr-3">
        <name>Example NASS carrying only Post-Stack NA Indicator</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |               0       |R| 0 |S|P,H|IHS|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>
      <t> In this example, the NASS is carrying only the indicator for the presence of Post-Stack NA and its Hop-By-Hop Option. </t>
      <t> In this case only "P" and "H" bits are set to "1" as required. </t>

    </section>

    <section anchor="sect-J7.4" numbered="true" toc="default">
      <name>Example-4 - In-Stack NA with more than 20-bit AD</name>
      <t> An In-Stack Network Action may require more than 20 bits of Ancillary Data. In this example, the following Ancillary Data encoding is used. </t>

      <figure anchor="In-Stack-Ext-Hdr-Format-4-with-more-AD">
        <name>Example In-Stack Network Action With Additional Ancillary Data Encoding Format</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  | TC  |S|      TTL      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 0 |S|P,H|IHS|NASL=2 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=8  |    Ancillary Data8    |R| 1 |S|Ancillary Data8|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|                  Ancillary Data8          |S|Ancillary Data8|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

    <t> In this example, the In-Stack NAI-Opcode "8" requires more than 20 bits of Ancillary Data to be encoded. The NA and AD are encoded in the 3rd and 4th LSEs. </t>
    <t> Third LSE: </t>
    <t> Label Field </t>
    <ul spacing="normal">
    <li> The 8-bit in the Label Field carries the NAI-Opcode value "8". </li>
    <li> Next 12 bits in the Label Field carries the part of AD. </li>
    </ul>
    <t> TC Field </t>
    <ul empty="true" spacing="normal">
    <li> The 2-bit of the TC field carries Network Action Length (NAL). In this case, since it uses additional LSE to carry its AD the NAL value is set to "1". </li>
    </ul>
    <t> TTL Field </t>
    <ul empty="true" spacing="normal">
    <li> This 8-bit field carries second part of the AD. </li>
    </ul>
    
    <t> Fourth LSE: </t>
    <t> Label Field </t>
    <ul spacing="normal">
    <li> The first bit in the Label field MUST be set to "1". This is to prevent aliasing the label field with other bSPLs on the legacy routers. The AD value encoded could vary and it cannot be controlled. If we assume in the above example, the application encodes the 4th LSEs Label field as value "7", then legacy node could miss-understood for Entropy label indicator and may start processing the packet accordingly, which could end-up in wrong packet forwarding behaviour. </li>
    <li> Next 19 bits in the Label field carries 3rd part of AD. </li>
    </ul>
    <t> TC Field </t>
    <ul empty="true" spacing="normal">
      <li> 3-bit TC field carries the continuation of 3rd part of AD. </li>
    </ul>
    <t> TTL Field </t>
    <ul empty="true" spacing="normal">
      <li> 8-bit TTL field carries the rest of AD. </li>
    </ul>
    
    </section>

    <section anchor="sect-J7.5" numbered="true" toc="default">
      <name>Example-5 - Carry Both I2E and HBH Scope NASS </name>

      <figure anchor="In-Stack-both-scope-Ext-Hdr-5">
        <name>Example NASS carrying Both I2E and HBH Scope NAs</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 0 |S|P,H|H01|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=6  |   Ancillary Data6     |R| 0 |S|P,H|E00|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

      <t> In this example, one NASS is added for HBH scope with IHS field set to 01b and another NASS is added for I2E scope with IHS field set to 00b.</t>

    </section>

    <section anchor="sect-J7.6" numbered="true" toc="default">
      <name>Example-6 - Carry Both Select and HBH Scope NASS </name>

      <figure anchor="In-Stack-both-scope-Ext-Hdr-6">
        <name>Example NASS carrying Both Select and HBH Scope NAs</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[

 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=2  |    Flag-Based NAIs    |R| 0 |S|P,H|H01|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                                                               .
.                                                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|     NASI=bSPL (TBA1)                  |  TC |S|     TTL       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NAI-Opcode=6  |   Ancillary Data6     |R| 0 |S|P,H|S10|NASL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     ]]></artwork>
      </figure>

      <t> In this example, one NASS is added for HBH scope with IHS field set to 01b and another NASS is added for Select scope with IHS field set to 10b.</t>

    </section>
    </section>



    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization/>
            </author>
            <date year="1997" month="March"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>

        <reference anchor="RFC3032" target="https://www.rfc-editor.org/info/rfc3032" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3032.xml">
          <front>
            <title>MPLS Label Stack Encoding</title>
            <author initials="E." surname="Rosen" fullname="E. Rosen">
              <organization/>
            </author>
            <author initials="D." surname="Tappan" fullname="D. Tappan">
              <organization/>
            </author>
            <author initials="G." surname="Fedorkow" fullname="G. Fedorkow">
              <organization/>
            </author>
            <author initials="Y." surname="Rekhter" fullname="Y. Rekhter">
              <organization/>
            </author>
            <author initials="D." surname="Farinacci" fullname="D. Farinacci">
              <organization/>
            </author>
            <author initials="T." surname="Li" fullname="T. Li">
              <organization/>
            </author>
            <author initials="A." surname="Conta" fullname="A. Conta">
              <organization/>
            </author>
            <date year="2001" month="January"/>
          </front>
          <seriesInfo name="RFC" value="3032"/>
          <seriesInfo name="DOI" value="10.17487/RFC3032"/>
        </reference>

         <reference anchor="RFC8126" target="https://www.rfc-editor.org/info/rfc8126" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml">
          <front>
            <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
            <author initials="M." surname="Cotton" fullname="M. Cotton">
              <organization/>
            </author>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization/>
            </author>
            <author initials="T." surname="Narten" fullname="T. Narten">
              <organization/>
            </author>
            <date year="2017" month="June"/>
          </front>
          <seriesInfo name="BCP" value="26"/>
          <seriesInfo name="RFC" value="8126"/>
          <seriesInfo name="DOI" value="10.17487/RFC8126"/>
        </reference>
         <reference anchor="RFC3443" target="https://www.rfc-editor.org/info/rfc3443" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3443.xml">
          <front>
            <title>Time To Live (TTL) Processing in Multi-Protocol Label Switching (MPLS) Networks </title>
            <author initials="P." surname="Agarwal" fullname="P. Agarwal">
              <organization/>
            </author>
            <author initials="B." surname="Akyol" fullname="B. Akyol">
              <organization/>
            </author>
            <date year="2003" month="January"/>
          </front>
          <seriesInfo name="BCP" value="26"/>
          <seriesInfo name="RFC" value="8126"/>
          <seriesInfo name="DOI" value="10.17487/RFC8126"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization/>
            </author>
            <date year="2017" month="May"/>
                    </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
       </references>
      <references>
        <name>Informative References</name>

        <reference anchor="I-D.song-mpls-extension-header" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.song-mpls-extension-header.xml" target="https://www.ietf.org/archive/id/draft-song-mpls-extension-header-10.txt">
          <front>
            <title>MPLS Extension Header</title>
            <author fullname="Haoyu Song">
              <organization>Futurewei Technologies</organization>
            </author>
            <author fullname="Zhenbin Li">
              <organization>Huawei</organization>
            </author>
            <author fullname="Tianran Zhou">
              <organization>Huawei</organization>
            </author>
            <author fullname="Loa Andersson">
              <organization>Bronze Dragon Consulting</organization>
            </author>
            <author fullname="Zhaohui Zhang">
              <organization>Juniper Networks</organization>
            </author>
            <author fullname="Rakesh Gandhi">
              <organization>Cisco Systems</organization>
            </author>
            <author fullname="Jaganbabu Rajamanickam">
              <organization>Cisco Systems</organization>
            </author>
            <author fullname="Jisu Bhattacharya">
              <organization>Cisco Systems</organization>
            </author>
            <date month="September" day="01" year="2022"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-song-mpls-extension-header-10"/>
        </reference>

       <reference anchor="I-D.ietf-mpls-mna-fwk" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-fwk.xml" target="https://www.ietf.org/archive/id/draft-ietf-mpls-mna-fwk-01.txt">
          <front>
            <title>MPLS Network Actions Framework</title>
            <author fullname="Loa Andersson">
            </author>
            <author fullname="Stewart Bryant">
            </author>
            <author fullname="Matthew Bocci">
            </author>
            <author fullname="Tony Li">
            </author>
            <date month="September" day="08" year="2022"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-mpls-mna-fwk-01.txt"/>
        </reference>

        <reference anchor="I-D.ietf-mpls-mna-requirements" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-requirements.xml" target="https://www.ietf.org/archive/id/draft-ietf-mpls-mna-requirements-03.txt">
          <front>
            <title>Requirements for MPLS Network Action Indicators and MPLS Ancillary Data</title>
            <author fullname="Matthew Bocci">
              <organization>Nokia</organization>
            </author>
            <author fullname="Stewart Bryant">
              <organization>University of Surrey 5GIC</organization>
            </author>
            <author fullname="John Drake">
              <organization>Juniper Networks</organization>
            </author>
         
            <date month="August" day="19" year="2022"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-mpls-mna-requirements-03.txt"/>
        </reference>

        <reference anchor="I-D.ietf-mpls-mna-usecases" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-usecases.xml" target="https://www.ietf.org/archive/id/draft-ietf-mpls-mna-usecases-00.txt">
          <front>
            <title>Usecases for MPLS Indicators and Ancillary Data</title>
            <author fullname="Tarek Saad">
              <organization>Juniper Networks</organization>
            </author>
            <author fullname="Kiran Makhijani">
              <organization>Futurewei Technologies</organization>
            </author>
            <author fullname="Haoyu Song">
              <organization>Futurewei Technologies</organization>
            </author>
            <date month="May" day="19" year="2022"/>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-mpls-mna-usecases-00"/>
        </reference>

        <reference anchor="RFC5586" target="https://www.rfc-editor.org/info/rfc5586" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5586.xml">
          <front>
            <title>MPLS Generic Associated Channel</title>
            <author initials="M." surname="Bocci" fullname="M. Bocci" role="editor">
              <organization/>
            </author>
            <author initials="M." surname="Vigoureux" fullname="M. Vigoureux" role="editor">
              <organization/>
            </author>
            <author initials="S." surname="Bryant" fullname="S. Bryant" role="editor">
              <organization/>
            </author>
            <date year="2009" month="June"/>
          </front>
          <seriesInfo name="RFC" value="5586"/>
          <seriesInfo name="DOI" value="10.17487/RFC5586"/>
        </reference>

        <reference anchor="RFC4385" target="https://www.rfc-editor.org/info/rfc4385" xml:base="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4385.xml">
          <front>
            <title>Pseudowire Emulation Edge-to-Edge (PWE3) Control Word for Use over an MPLS PSN</title>
            <author initials="S." surname="Bryant" fullname="S. Bryant">
              <organization/>
            </author>
            <author initials="G." surname="Swallow" fullname="G. Swallow">
              <organization/>
            </author>
            <author initials="L." surname="Martini" fullname="L. Martini">
              <organization/>
            </author>
            <author initials="D." surname="McPherson" fullname="D. McPherson">
              <organization/>
            </author>
            <date year="2006" month="February"/>
          </front>
          <seriesInfo name="RFC" value="4385"/>
          <seriesInfo name="DOI" value="10.17487/RFC4385"/>
        </reference>

      </references>
    </references>
    <section numbered="false" anchor="acknowledgments" toc="default">
      <name>Acknowledgments</name>
      <t>
      The authors of this document would like to thank the MPLS Working Group Design Team for the discussions and comments
      on this document. The authors would also like to thank Amanda Baber for reviewing the IANA Considerations and providing many useful suggestions.
      </t>

    </section>
    <section numbered="false" anchor="contributors" toc="default">
      <name>Contributors</name>
      <t>The following people have substantially contributed to this document:</t>

          <figure anchor="contrib">
     <artwork name="" type="" align="left" alt=""><![CDATA[

Jisu Bhattacharya
Cisco Systems, Inc.
Email: jisu@cisco.com


Bruno Decraene
Orange
Email: bruno.decraene@orange.com


Weiqiang Cheng
China Mobile
Email: chengweiqiang@chinamobile.com


Xiao Min
ZTE Corp.
Email: xiao.min2@zte.com.cn


Luay Jalil
Verizon
Email: luay.jalil@verizon.com


Jie Dong
Huawei Technologies
Huawei Campus, No. 156 Beiqing Rd.
Beijing  100095
China
Email: jie.dong@huawei.com


Tianran Zhou
Huawei Technologies
China
Email: zhoutianran@huawei.com


Bin Wen
Comcast
Email: Bin_Wen@cable.comcast.com


Sami Boutros
Ciena
Email: sboutros@ciena.com


Tony Li 
Juniper Networks 
United States 
Email: tony.li@tony.li 


John Drake 
Juniper Networks 
United States 
Email: jdrake@juniper.net 


    ]]></artwork>
      </figure>

    </section>
  </back>
</rfc>
