<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
  <!ENTITY I-D.ietf-mpls-mna-fwk SYSTEM
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-fwk.xml"> 
  <!ENTITY I-D.ietf-mpls-mna-requirements SYSTEM 
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-requirements.xml">
  <!ENTITY I-D.ietf-mpls-mna-usecases SYSTEM 
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-mpls-mna-usecases.xml">
  <!ENTITY I-D.song-mpls-extension-header SYSTEM 
    "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.song-mpls-extension-header.xml">
  <!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
  <!ENTITY RFC3032 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3032.xml">
  <!ENTITY RFC3209 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3209.xml">
  <!ENTITY RFC3443 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3443.xml">
  <!ENTITY RFC4377 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4377.xml">
  <!ENTITY RFC4385 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4385.xml">
  <!ENTITY RFC5462 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5462.xml">
  <!ENTITY RFC5586 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5586.xml">
  <!ENTITY RFC8174 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
  <!ENTITY RFC8662 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8662.xml">
  <!ENTITY RFC9017 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9017.xml">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" docName="draft-jags-mpls-mna-hdr-04" 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="MNA Sub-Stack">MPLS Network Action (MNA)
    Sub-Stack Solution</title>
    <seriesInfo name="Internet-Draft" value="draft-jags-mpls-mna-hdr-04"/>
    <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 year="2022"/>
    <workgroup>MPLS Working Group</workgroup>
    <abstract>
      <t>
	This document defines the MPLS Network Action (MNA) sub-stack
	solution for carrying Network Actions and Ancillary Data
	in the label stack. MPLS Network Actions can be used to
	influence packet forwarding decisions, carry additional OAM
	information in the MPLS packet, or perform user-defined
	operations. 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 the
	  encoding of the MPLS label stack, the basic structure used
	  to define a forwarding path. Forthcoming applications
	  require MPLS packets to perform special network actions and
	  carry optional Ancillary Data (AD) that can affect the
	  packet forwarding decision or trigger OAM logging.
	  Ancillary Data can be used to carry additional information,
	  such as a network slice identifier or an entropy value for
	  load balancing.  Several MNA applications are described in
	  <xref target="I-D.ietf-mpls-mna-usecases"
	  format="default"/>. User-defined network actions allow new,
	  local actions to be defined.
	</t>
	<t>
	  This document defines the syntax and semantics of network
	  actions encoded within an MPLS Label Stack.  Network actions
	  can be encoded with or without Ancillary Data (AD), either
	  in or after the label stack.  In stack actions and ancillary
	  data are contained in a Network Action Sub-Stack (NAS),
	  which is recognized by a new base Special Purpose Label
	  (bSPL) (value TBA). This document addresses the requirements
	  specified in <xref target="I-D.ietf-mpls-mna-requirements"
	  format="default"/>.  This document follows the 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 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> 

      <table anchor="abbreviations">
	<name>Abbreviations</name>
	<thead>
	  <tr>
	    <th align='left'>Abbreviation</th>
	    <th align='left'>Meaning</th>
	    <th align='left'>Reference</th>
	  </tr>
	</thead>
	<tbody>
	  <tr>
	    <td>AD</td>
	    <td>Ancillary Data</td>
	    <td><xref target="I-D.ietf-mpls-mna-requirements"/></td>
	  </tr>
	  <tr>
	    <td>bSPL</td>
	    <td>Base Special Purpose Label</td>
	    <td><xref target="RFC9017"/></td>
	  </tr>
	  <tr>
	    <td>BOS</td>
	    <td>Bottom Of Stack</td>
	    <td><xref target="RFC3032"/></td>
	  </tr>
	  <tr>
	    <td>HBH</td>
	    <td>Hop-By-Hop Scope</td>
	    <td><xref target="I-D.ietf-mpls-mna-fwk"/></td>
	  </tr>
	  <tr>
	    <td>I2E</td>
	    <td>Ingress-To-Egress Scope</td>
	    <td><xref target="I-D.ietf-mpls-mna-fwk"/></td>
	  </tr>
	  <tr>
	    <td>IHS</td>
	    <td>I2E, HBH, or Select Scope</td>
	    <td>This document</td>
	  </tr>
	  <tr>
	    <td>ISD</td>
	    <td>In-Stack Data</td>
	    <td><xref target="I-D.ietf-mpls-mna-requirements"/></td>
	  </tr>
	  <tr>
	    <td>LSE</td>
	    <td>Label Stack Entry</td>
	    <td><xref target="RFC3032"/></td>
	  </tr>
	  <tr>
	    <td>MNA</td>
	    <td>MPLS Network Actions</td>
	    <td><xref target="I-D.ietf-mpls-mna-fwk"/></td>
	  </tr>
	  <tr>
	    <td>NAI</td>
	    <td>Network Action Indicator</td>
	    <td><xref target="I-D.ietf-mpls-mna-requirements"/></td>
	  </tr>
	  <tr>
	    <td>NAL</td>
	    <td>Network Action Length</td>
	    <td>This document</td>
	  </tr>
	  <tr>
	    <td>NAS</td>
	    <td>Network Action Sub-Stack</td>
	    <td><xref target="I-D.ietf-mpls-mna-fwk"/></td>
	  </tr>
	  <tr>
	    <td>NASI</td>
	    <td>Network Action Sub-Stack Indicator</td>
	    <td>This document</td>
	  </tr>
	  <tr>
	    <td>NASL</td>
	    <td>Network Action Sub-Stack Length</td>
	    <td>This document</td>
	  </tr>
	  <tr>
	    <td>OAM</td>
	    <td>Operations And Management</td>
	    <td><xref target="RFC4377"/></td>
	  </tr>
	  <tr>
	    <td>P</td>
	    <td>Post-Stack Network Action Presence Indicator</td>
	    <td>This document</td>
	  </tr>
	  <tr>
	    <td>PSD</td>
	    <td>Post-stack data</td>
	    <td>
	      <xref target="I-D.ietf-mpls-mna-requirements"/> and
	      <xref target="I-D.ietf-mpls-mna-fwk"/>
	    </td>
	  </tr>
	  <tr>
	    <td>TC</td>
	    <td>Traffic Class</td>
	    <td><xref target="RFC5462"/></td>
	  </tr>
	  <tr>
	    <td>TTL</td>
	    <td>Time To Live</td>
	    <td><xref target="RFC3032"/></td>
	  </tr>
	</tbody>
      </table>
    </section>
  </section>

  <section anchor="sect-3" numbered="true" toc="default">
    <name>Overview</name>

    <t>
      The MPLS Network Action Sub-Stack (NAS) is a set of Label Stack
      Entries (LSEs) that appear as part of an MPLS Label Stack and
      serve to encode information about the network actions that
      should be invoked for the encapsulated packet. Multiple NASs may
      appear in a label stack and the packet may contain Post-Stack
      Data, including additional network actions, as specified in
      <xref target="I-D.song-mpls-extension-header"/>.
    </t>
    <t>
      Network actions and their optional Ancillary Data (AD) may be
      encoded as part of the NAS as a series of LSEs.
    </t>
  </section>

  <section>
    <name>Label Stack Entry Formats</name>

    <t>
      The NAS uses a variety of different formats of LSEs for
      different purposes. This section describes the syntax of the
      various formats while the overall structure of the NAS and the
      semantics of the various LSEs are described in the sections
      below.
    </t>
    
    <section anchor="LSE-A">
      <name>LSE Format A: The MNA Sub-Stack Indicator</name>

      <t>
	LSE Format A is a traditional LSE, as described in <xref
	target="RFC3032"/> and <xref target="RFC5462"/>.
      </t>

      <figure>
	<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      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>
    </section>

    <section anchor="LSE-B">
      <name>LSE Format B: The initial opcode</name>
  
      <t>
	LSE Format B is used to encode the first opcode in the NAS,
	plus a number of other fields about the NAS.
      </t>
      
      <figure>
	<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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode    |        Data             |P|IHS|S|Res|U|O|  NASL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>

      <ul>
	<li>
	  Opcode (7 bits) : The operation code for this LSE. See
	  <xref target="Opcodes"/>.
	</li>
	<li>Data (13 bits) : Opcode specific data</li>
	<li>
	  P (1 bit) : If set, it indicates the presence of post-stack
	  network actions.
	</li>
	<li>
	  IHS (2 bits) : The scope of the sub-stack. See <xref
	  target="Scope"/>.
	</li>
	<li>
	  S (1 bit) : The Bottom of Stack <xref
	  target="RFC3032"/>.
	</li>
	<li>
	  Res (2 bits) : Reserved bits. These must be transmitted as
	  zero and ignored upon receipt.
	</li>
	<li>
	  U (1 bits): Unknown Action Handling. See <xref
	  target="UOH"/>.
	</li> 
	<li>
	  O (1 bit) : If set, then the ordering of network actions
	  is semantically significant. See <xref target="Ordering" />.
	</li>
	<li>
	  NASL (4 bits) : The Network Action Sub-Stack Length
	  (NASL). The number of additional LSEs in the sub-stack, not
	  including the leading Format A LSE and the Format B LSE.
	</li>
      </ul>
    </section>

    <section anchor="LSE-C">
      <name>LSE Format C: Subsequent opcodes</name>
      
      <t>
	LSE Format C is used to encode the subsequent opcodes in the
	NAS.
      </t>

      <figure>
	<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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode    |             Data              |S|  Data |  NAL  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>

      <ul>
	<li>Opcode (7 bits) : The operation code for this LSE. See
	<xref target="Opcodes"/>.</li>
	<li>Data (16 bits + 4 bits) : Opcode specific data</li>
	<li>
	  S (1 bit) : The Bottom of Stack <xref
	  target="RFC3032"/>.
	</li>
	<li>
	  NAL (4 bits): Network Action Length. The number of LSEs of
	  additional data, encoded in LSE Format D (<xref
	  target="LSE-D"/>) following this LSE.
	</li>
      </ul>
    </section>

    <section anchor="LSE-D">
      <name>LSE Format D: Additional Ancillary Data</name>
      
      <t>
	LSE Format D is used to encode additional ancillary data that
	did not fit in the LSE with the preceding opcode.
      </t>
      <figure>
	<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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|                   Data                    |S|     Data      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>

      <ul>
	<li>
	  1 (1 bit) : The most significant bit MUST be set. This
	  prevents legacy implementations from misinterpreting this
	  LSE as containing a special label.
	</li>
	<li>
	  S (1 bit) : The Bottom of Stack <xref
	  target="RFC3032"/>.
	</li>
	<li>Data (22 bits + 8 bits) : Opcode specific data</li>
      </ul>
    </section>

  </section>

  <section anchor="sect-3.1" numbered="true" toc="default">
    <name>The MNA Sub-Stack</name>

    <t>
      The MNA Sub-Stack MUST begin with a Format A LSE (<xref
      target="LSE-A"/>). The label field of the LSE contains the MNA bSPL
      (value TBA) to indicate the presence of the MNA Sub-Stack.
    </t> 
    <t>
      The TC and TTL fields of the first LSE retain their traditional
      semantics, as the penultimate node on the path may copy the TTL
      and TC fields from the preceding 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"/>.  If the node performing this copy is not
      aware of MNA, this could overwrite the values in the first LSE
      of the MNA sub-stack.
    </t>

    <t>
      The second LSE in a NAS MUST be a Format B LSE (<xref
      target="LSE-B"/>). This LSE contains an initial opcode plus
      additional fields that describe the NAS.
    </t>

    <t>
      A NAS MAY contain more Format C (<xref target="LSE-C"/>) and
      Format D (<xref target="LSE-D"/>) LSEs, up to the length encoded
      in the NASL field. All Format D LSEs MUST follow a Format C LSE
      and be included in that LSE's NAL field.
    </t>

    <section anchor="Opcodes">
      <name>Opcodes</name>
      <t>
	The opcode is a 7-bit field that indicates the semantics of
	its LSE. Several opcodes are assigned special semantics (<xref
	target="SpecialOpcodes"/>), others act as Network Action
	Indicators and are allocated through IANA (<xref
	target="Allocation"/> and <xref target="IANAOpcodes"/>).
      </t>
    </section>

    <section anchor="Data">
      <name>Data</name>
      <t>
	The data field carries opcode specific data. This may be
	ancillary data for a network action.
      </t>
      <t>
	To preserve backward compatibility, if a network action
	encodes data that will change during packet forwarding, then
	that data MUST be in the least significant 4 bits in the data
	field of a Format C LSE (<xref target="LSE-C"/>) or the least
	significant 8 bits of a Format D LSE (<xref
	target="LSE-D"/>). Some legacy implementations may use the
	label field in all LSEs when computing ECMP decisions and
	modifying the label field might disrupt that packet's flow.
      </t>
    </section>	

    <section anchor="Scope">
      <name>Scope</name>
      <t>
	The IHS field in the Format B LSE indicates the scope of the
	In-Stack and Post-Stack NAIs encoded in the NAS. Scope defines
	which nodes along the MPLS path should perform the network
	actions found within the NAS.  The specific values of the IHS
	field are as follows:
      </t>
      <table anchor="In-Stack-scope-tbl" align="center">
	<name>IHS Scope Values</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>

      <t>
      </t>
      <ul empty="true" spacing="normal">
	<li>
	  Hop-By-Hop (HBH) - All nodes along the path MUST process the NAS.
	</li>
	<li>
	  Select - Only specific nodes along the path will perform the action.
	</li>
	<li>
	  Ingress To Egress (I2E) - The NAS MUST be processed only by
	  the egress node.
	</li>
      </ul>
      <t>
	A single NAS carries only one of the three scopes
	(HBH/Select/I2E). To support multiple scopes for a single
	packet, multiple NASs may be included in a single label stack.
      </t>
      <t>
	The egress node is included in the HBH scope. This implies
	that the penultimate node MUST NOT remove the last copy of a
	HBH NAS. The egress node MAY receive a NAS at the top of the
	label stack.
      </t>
      <t>
	An I2E scope NAS MUST be encoded after any HBH or Select scope
	NASs. This makes it easier for the transit nodes to process a
	NAS with HBH or Select scope.
      </t>
      <t>
	Forwarding and egress nodes should process at most a single
	NAS per scope.
      </t>
    </section>

    <section anchor="UOH">
      <name>Unknown Action Handling</name>

      <t>
	The Unknown Action Handling (U) field in a Format B LSE
	(<xref target="LSE-C"/>) is a 1-bit value that defines the action to
	be taken by a node that does not understand an action within
	the NAS. The different types of Unknown Action
	Handling actions are defined below. 
      </t>

      <table anchor="UOH-tbl" align="center">
	<name>Unknown Action Handling</name>
	<thead>
          <tr>
            <th align="left"> Bit </th>
            <th align="left"> Action </th>
          </tr>
	</thead>
	<tbody>
          <tr>
            <td align="left">0</td>
            <td align="left">Skip to the next NA </td>
          </tr>
          <tr>
            <td align="left">1</td>
            <td align="left">Drop the packet</td>
          </tr>
	</tbody>
      </table>

    </section>

    <section anchor="Ordering">
      <name>Ordering</name>

      <t>
	If the 'O' bit is set in a Format B LSE (<xref
	target="LSE-B"/>) then it indicates that the network actions
	encoded in the NAS MUST be processed in the order that they
	appear in the NAS, from the top of the NAS to the bottom. NAI
	encoded as flags MUST be processed from the most significant
	bit to the least significant bit.
      </t>
    </section>

    <section>
      <name>Examples</name>
      <t>
	A minimal NAS would have the following format, where the Label
	field would contain the MNA bSPL and the NASL value would be
	0:
      </t>
      <figure>
	<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      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode    |        Data             |P|IHS|S|Res|U|O|  NASL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>
      
      <t>
	A more complex NAS might have multiple opcodes and additional
	Ancillary Data. This example has two opcodes and two
	additional LSEs of AD.
      </t>

      <figure>
	<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      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode    |        Data             |P|IHS|S|Res|U|O|  NASL |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode    |             Data              |S|  Data |  NAL  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|                   Data                    |S|     Data      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|                   Data                    |S|     Data      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>
      <t>
	In this example, the NASL field would have value 3 and the NAL
	field would have value 2.
      </t>
    </section>

  </section>

  <section anchor="SpecialOpcodes" numbered="true" toc="default">
    <name>Special Opcodes</name>

    <section>
      <name>bSPL Protection</name>

      <t>
	Opcode: 0
      </t>
      <t>
	Purpose: Legacy implementations may scan the label stack
	looking for bSPL values. As long as the opcode field is
	non-zero, an LSE cannot be misinterpreted as containing a
	bSPL. Opcode 0 is therefore reserved and is not used.
      </t>
    </section>

    <section anchor="sect-J5.2a" numbered="true" toc="default">
      <name>PSD Offset</name>
      
      <t>
	Opcode: 1
      </t>
      <t>
	Purpose: This opcode carries the start offset of the
	Post-Stack Action Header (PAH) (<xref
	target="I-D.song-mpls-extension-header" format="default"/> )
	within the PSD.
      </t>
      <t>
	LSE Format: B
      </t>
      <t>
	Data: The data value of the LSE contains the offset from the
	MPLS BOS in units of 4 octets.  This allows the Generic
	Control Word (0000b) <xref target="RFC4385" format="default"/>
	and G-ACh (0001b) <xref target="RFC5586"/> fields to be placed
	immediately after the BOS. In the absence of this opcode, the
	PSD is encoded immediately after the MPLS BOS.  A data value
	of 1 indicates that the PAH starts 4 octets after the BOS.
      </t>
      <t>
	Scope: This opcode can be used with any scope.
      </t>

    </section>

    <section anchor="sect-J5.2b" numbered="true" toc="default">
      <name>Flag-Based NAIs without AD</name>
      <t>
	Opcode: 2
      </t>
      <t>
	Purpose: Network actions that do not require Ancillary Data
	do not require an entire LSE. A single flag can be used to
	indicate each of these network actions.
      </t> 
      <t>
	LSE Formats: B, C, D
      </t>
      <t>
	Data: The data field carries Network Action Indicators, which
	should be evaluated from the most significant bit to the least
	significant bit. If there are sufficient NAI, then Format D
	LSEs may be used to encode more flags for more network
	actions. Flags are allocated from the "Network Action Flags
	Without Ancillary Data" registry (<xref
	target="IANAFlags"/>). If flags need to be evaluated in a
	different order, multiple LSEs using this opcode may be used
	to specify the requested order. If this opcode is used with
	LSE Format B, then only 13 flags may be carried.
      </t>
      <t>
	Scope: This opcode can be used with any scope.
      </t>
      <t>
	This opcode MAY be used with no flags set in the data field to
	signify that no operation is to be performed. This can be
	used, for example, if the first action to be performed cannot
	be encoded in a Format B LSE.
      </t>
    </section>

    <section anchor="sect-J5.2c" numbered="true" toc="default">
      <name>Flag based NAIs with AD</name>
      <t>
	Opcode: 3
      </t>
      <t>
	Purpose: This opcode supports flag-based network actions that have
	Ancillary Data.
      </t>
      <t>
	LSE Formats: C, D
      </t>
      <t>
	Data: The data field carries Network Action Indicators, which
	should be evaluated from the most significant bit to the least
	significant bit. Format D LSEs are used to encode the
	associated Ancillary Data, which appears in the same order as
	the flags. Flags are allocated from the "Network Action Flags
	With Ancillary Data" registry (<xref target="IANAFlagsAD"/>). If
	flags need to be evaluated in a different order, multiple LSEs
	using this opcode may be used to specify the requested order.
      </t>
      <t>
	Scope: This opcode can be used with any scope.
      </t>
      <t>
	If a flag contained within this opcode is unknown and is
	skipped per <xref target="UOH"/>, then the length of its
	associated ancillary data will also be unknown. Any subsequent
	flags within the opcode will not have the correct associated
	ancillary data, so all subsequent flags SHOULD be treated as
	unknown actions and also skipped.
      </t>
    </section>

    <section anchor="sect-J5.2d" numbered="true" toc="default">
      <name>PSD-ISD Ordering</name>
      <t>
	Opcode: 4
      </t>
      <t>
	Purpose: In cases where the ordering of network action is
	significant and where some of the network actions reside in
	PSD, this opcode can be used to insert PSD network actions
	into the order of execution. The 'P' bit and 'O' bit MUST be
	set in the NAS's Format B LSE if this opcode is used.
      </t>
      <t>
	LSE Format: B, C, D
      </t>
      <t>
	Data: The data field contains one or more 8-bit Next Header
	(NH) indicators <xref target="I-D.song-mpls-extension-header"
	format="default"/>. When used with LSE Format B, only one NH
	indicator is carried.  Two indicators MAY be carried in a
	Format C LSE, and if Format D LSEs are used, each may carry up
	to three indicators.  The indicators are the stored
	concatenated in the most significant bits of the data
	field. If multiple indicators are carried, the most
	significant NH indicator is evaluated to the least
	significant. Indicators do not span LSEs. If some indicator
	positions are not to be used, then the indicator should be set
	to No Next Header (NONE).
      </t>
      <t>
	Scope: This opcode can be used with any scope.
      </t>
    </section>

    <section anchor="sect-J5.2g" numbered="true" toc="default">
      <name>Extension Opcode</name>

      <t>
	Opcode: 127
      </t>
      <t>
	Purpose: This opcode is reserved to extend the current opcode
	range beyond 127. Future use of this opcode is out of scope.
      </t> 

    </section>

  </section>

  <section anchor="Placement" numbered="true" toc="default">
    <name>NAS placement in the Label Stack</name>

    <t>
      Regardless of whether packets are being forwarded based on
      Segment Routing <xref target="RFC8662"/> or on RSVP-TE <xref
      target="RFC3209"/>, the node adding an NAS to the label stack
      will need to place a copy of the NAS where it can be read by the
      relevant nodes. Each node along the path will have a Maximum
      MPLS Stack Inspection depth, and if the NAS is to be processed
      by a particular node, then the entire NAS must be placed so
      that it is within this depth by the time the packet reaches the
      node.
    </t>
    <t>
      If the label stack is deep, several copies of the NAS may need
      to be encoded in the label stack.
    </t>
    <t>
      For a NAS with HBH scope, every node will processes the top copy
      of the NAS. The node that pops the forwarding label that exposes
      the NAS MUST NOT remove it. Instead, it forwards the packet with
      the NAS at the top of stack to the next node (e.g., the segment
      endpoint node). The node that receives the NAS at the top of the
      label stack has to remove it.
    </t>
    <t>
      For a NAS with Select scope, it is processed by the node that
      brings it to the top of stack and then the NAS is removed from
      the stack.
    </t>
    <t>
      For I2E scope, only one copy of the NAS needs to be added at the
      bottom of the stack.
    </t>
  </section>

  <section anchor="Signaling" numbered="true" toc="default">
    <name>Node Capability Signaling</name>
    <t>
      The head-end node which is adding a NAS MUST make sure that the
      egress node removes the NAS. The head-end node MUST make sure
      that the NAS can be processed by the appropriate transit and
      egress nodes.
    </t>

    <ul>
      <li>
	Each participating node MUST signal the network actions that
	it supports.
      </li> 
      <li>
	Each participating node MUST signal its Maximum MPLS Stack
	Inspection Depth. This will allow the head-end node to place
	a copy of an NAS at the correct stack depth.
      </li> 
    </ul>

    <t>
      The above capability signaling will be added in appropriate
      protocols. Signaling details are outside the scope of this
      document.
    </t>

  </section>

  <section anchor="sect-J12.1a" numbered="true" toc="default">
    <name>Processing the Network Action Sub-Stack</name>

    <t>
      This section defines the specific responsibilities for nodes
      along a MPLS path.
    </t>

    <section>
      <name> Encapsulating Node Responsibilities </name>

      <t>
	The encapsulating node MAY add NASs to the label stack in
	accordance with its policies, the placement restrictions in
	<xref target="Placement"/>, and the limitations learned
	from <xref target="Signaling"/>.
      </t>
      <t>
	The encapsulating node MUST NOT add a NAS to the label stack
	if the decapsulation node does not support MNA.
      </t>
      <t>
	If there is an existing label stack, the encapsulating node
	SHOULD NOT change the first 20 bits of each LSP in the label
	stack to avoid ECMP path change.
      </t>
      <t>
	If the encapsulating node is also a transit node, then it MUST
	also respect transit node responsibilities.
      </t>
    </section>

    <section>
      <name> Transit Node Responsibilities </name>
      <t>
	Transit nodes SHOULD NOT change the first 20 bits in the LSEs
	in the label stack.
      </t>
      <t>
	A transit node MAY change the Ancillary Data found in the
	least significant 8 bits of an LSE.
      </t>
      <t>
	Transit nodes MUST process the NASs in the label stack,
	respecting <xref target="Ordering"/> if requested by the NAS.
      </t>
      <t>
	A transit node MUST respect the Unknown Action Handling value
	encoded in the NAS.
      </t>
    </section>

    <section>
      <name> Penultimate Node Responsibilities </name>
      <t>
	In addition to the transit node responsibilities above, the
	penultimate node MUST NOT remove the last copy of a HBH or I2E
	NAS when it is exposed after removing the forwarding
	(transport) label. This allows the egress node to process the
	NAS.
      </t>
    </section>

    <section>
      <name> Decapsulating Node Responsibilities </name>
      <t>
	The decapsulating node MUST remove any NAS it receives.
      </t>
    </section>
  </section>

  <section anchor="Allocation" numbered="true" toc="default">
      <name>Network Action Indicator Allocation Procedures</name>

      <t>
	This section discusses the procedures and requirements for a
	allocating a new opcode or flag as a network action indicator
	(NAI) for a network action. A request for an NAI may make
	requests from any combination of the "Network Action Opcodes",
	"Network Action Flags With Ancillary Data", or "Network Action
	Flags Without Ancillary Data" registries.
      </t>
      <t> 
	A request for a new NAI should include the following information: 
      </t>

      <ul>
	<li>
	  Scope: The request must specify at-least one scope (I2E,
	  HBH, Select) for the Network Action. The request MAY specify
	  more than one scope. 
	</li>
	<li> 
	  Ancillary Data: A request should specify the quantity,
	  syntax, and semantics of any associated Ancillary Data. The
	  Ancillary Data MAY be variable length, but the length MUST
	  be computable based on the data present in the NAS.
	</li>
        <li> 
	  Processing: The request should specify the detailed
	  procedure for processing the network action.
	</li>
      </ul>

      <t>
	A request for a new NAI may request any combination of flags
	or an opcode. This decision should optimize for eventual
	encoding efficiency. If the NAI does not require any ancillary
	data, then a flag is preferred as only one bit is used in the
	encoding. If ancillary data is required, then the optimal
	choice may depend on how the action is likely to be combined
	with other actions. If the action is unlikely to be used in
	combination with other actions and at most 20 bits of
	ancillary data is required, then an opcode may be preferred as
	the encoding will only consume a single LSE. If the action is
	likely to be combined with other actions, then a flag is more
	likely to be optimal.
      </t>
    </section>

  <section anchor="sect-J12" numbered="true" toc="default">
    <name>Backward Compatibility</name>

    <t>
      This section discusses interactions between MNA capable and
      legacy, non-MNA capable nodes.
    </t>
    <t> 
      An MNA encapsulating node MUST ensure that the MPLS
      Network Action Sub-Stack indicator is not at the top of the MPLS Label
      Stack when the packet arrives at a non-MNA capable node. If such
      a packet did arrive at a non-MNA capable node, it will most
      likely be dropped.
    </t> 
    <t> 
      Legacy nodes may scan the label stack, potentially looking for a
      label field containing a bSPL. To ensure that the LSE formats
      described herein do not appear to contain a bSPL value, the
      opcode value of 0 has been reserved. By ensuring that there is a
      non-zero value in the high order 7 bits, we are assured that the
      high order 20 bits cannot be misinterpreted as containing a bSPL
      value (0-15).
    </t>
    <t>
      The TC and TTL fields of the Format A LSE 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.  If the penultimate node is a legacy node, it might
      perform this action, potentially corrupting other values stored
      in the TC and TTL fields. To protect against this, we retain the
      TC and TTL fields in the Format A LSE.
    </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 this document.
    </t>
    <t> 
      In addition, MNA creates a new dimension in security
      concerns:
    </t>
      <ul>
	<li>
	  The actions of an encapsulating node can affect any or all
	  of the nodes along the path. In the most common and benign
	  situations, such as a syntactically incorrect packet, this
	  could result in packet loss or corruption.
	</li>
	<li>
	  The semantics of a network action are unbounded and may be
	  insecure. A network action could be defined that made
	  arbitrary changes to the memory of the forwarding router,
	  which could then be used by the encapsulating node to
	  compromise every MNA capable router in the network. The IETF
	  needs to ensure that only secure network actions are
	  defined.
	</li>
	<li>
	  The MNA architecture supports locally defined network
	  actions. For such actions, there will be limited oversight
	  to ensure that the semantics do not create security
	  issues. Implementors and network operators will need to
	  ensure that locally defined network actions do not
	  compromise the security of the network.
	</li>
      </ul>
  </section>

  <section anchor="sect-J13" numbered="true" toc="default">
    <name>IANA Considerations</name>

    <section anchor="sect-J13.6" numbered="true" toc="default">
      <name>MNA bSPL Label</name>
      <t>
	This document requests that IANA allocate a value (TBA) for
	the MNA bSPL label from the "Base Special-Purpose MPLS Label
	Values" registry to indicate the presence of an MNA Sub-Stack in
	the label stack. The description of the value should be "MPLS
	Network Actions". The reference should be this document.
      </t> 
    </section>


    <section>
      <name>MPLS Network Actions Parameters</name>
      
      <t>
	This document requests that IANA create a new registry group
	called "MPLS Network Actions Parameters" within the
	"Multiprotocol Label Switching Architecture (MPLS)" registry
	group.  The registries described below should belong to
	this new registry group.
      </t>
    </section>
    
    <section anchor="IANAFlags" numbered="true" toc="default">
      <name>Network Action Flags With Ancillary Data</name>
      <t>
	This document requests that IANA create a new registry with
	the name "Network Action Flags With Ancillary
	Data". Registration requests should comply with <xref
	target="Allocation"/>.  The registration procedure for this
	registry is "IETF Review".  The fields in this registry are
	"Bit Position" (integer), "Description" (string), and
	"Reference" (string).
      </t>
      <t>
	Bit Position refers to the position relative to the most
	significant bit in LSE Format C Data fields. Bit Position
	0 is the most significant bit a LSE Format C Data field. There
	are 20 bit positions currently available, 0-19. This registry
	may be extended in the future. Further opcodes would need to
	be defined to carry additional flag ranges.
      </t> 
      <t>
	The initial assignments for this registry are:
      </t>
      <table anchor="iana-nafif-tbl-2" align="center">
        <name>Network Action Flags Without Ancillary Data 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">0-15</td>
            <td align="left">Unassigned</td>
            <td align="left"></td>
          </tr>
          <tr>
            <td align="left">16-19</td>
            <td align="left">Private Use</td>
            <td align="left">This document</td>
          </tr>
        </tbody>
      </table>

    </section>

    <section anchor="IANAFlagsAD">
      <name>Network Action Flags Without Ancillary Data</name>
      <t>
	This document requests that IANA create a new registry with
	the name "Network Action Flags Without Ancillary
	Data". Registration requests should comply with <xref
	target="Allocation"/>.  The registration procedure for this
	registry is "IETF Review".  The fields in this registry are
	"Bit Position" (integer), "Description" (string), and
	"Reference" (string).
      </t>
      <t>
	Bit Position refers to the position relative to the most
	significant bit in LSE Format B or C Data fields and any
	subsequent Format D LSEs. Bit Position 0 is the most
	significant bit a LSE Format B or C Data field. Bit Position
	20 is the most significant bit in the first LSE Format D Data
	field. There are 20 bits available in LSE Format C and 30
	available in LSE Format D. There are at most 15 Format D LSEs
	per opcode, so there are at most 20 + 15 * 30 = 470 bit
	positions. The Bit Position is an integer with value 0-469.
      </t> 
      <t>
	The initial assignments for this registry are:
      </t>
      <table anchor="iana-nafif-tbl-1" align="center">
        <name>Network Action Flags With Ancillary Data 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">0-15</td>
            <td align="left">Unassigned</td>
            <td align="left"></td>
          </tr>
          <tr>
            <td align="left">16-19</td>
            <td align="left">Private Use</td>
            <td align="left">This document</td>
          </tr>
          <tr>
            <td align="left">20-469</td>
            <td align="left">Unassigned</td>
            <td align="left"></td>
          </tr>
        </tbody>
      </table>
    </section>

    <section anchor="IANAOpcodes" numbered="true" toc="default">
      <name>Network Action Opcodes</name>

      <t>
	This document requests that IANA create a new registry with
	the name "Network Action Opcodes". Registration requests
	should comply with <xref target="Allocation"/>. The
	registration procedure for this registry is "IETF Review". The
	fields are "Opcode" (integer), "Description" (string), and
	"Reference" (string). Opcode is an integer 0-127.
      </t>
      <t>
	The initial assignments for this registry are:
      </t>
      <table anchor="iana-is-fioc-reg-tbl" align="center">
        <name> Network Action Opcodes Registry</name>
        <thead>
          <tr>
            <th align="left">Opcode</th>
            <th align="center">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 without 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">PSD-ISD Ordering</td>
            <td align="left">This document</td>
          </tr>
          <tr>
            <td align="left">5-110</td>
            <td align="left">Unassigned</td>
            <td align="left"></td>
          </tr>
          <tr>
            <td align="left">111-126</td>
            <td align="left">Private Use</td>
            <td align="left"></td>
          </tr>
          <tr>
            <td align="left">127</td>
            <td align="left">Opcode Range Extension Beyond 127</td>
            <td align="left">This document</td>
          </tr>
        </tbody>
      </table>
    </section>

  </section>

  <section anchor="sect-J14" numbered="true" toc="default">
    <name>Appendix A: Examples</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>Network Action Flags without AD</name>

        <figure anchor="In-Stack-Ext-Hdr-1-a">
          <name>NAS with Network Action 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Label=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Opcode=2   |         Flags           |P|IHS|S|Res|U|O| NASL=0|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          ]]></artwork>
        </figure>
 
        <t>
	  This is an example of an NAS with Flag-Based NAIs without
	  Ancillary Data.
	</t>
      
        <t>
	  Details:
	</t>
        <ul empty="true" spacing="normal">
          <li> Opcode=2: This opcode to indicates that the LSE carries Flag-Based NAIs without AD. </li>
          <li> Data: The data field carries the Flag-Based NAIs. </li>
          <li>
	    S: This is the bottom of stack bit. Set if and only if
	    this LSE is the bottom of the stack.
	  </li>
          <li> U: Action to be taken if one of the NAIs are not recognized by the processing node.</li>
          <li> NASL: The NASL field is set to "0", as there are no additional LSEs. </li>
      </ul>

      <figure anchor="In-Stack-Ext-Hdr-1-a-ext">
        <name>Network Action Flags without AD using LSE Format D</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=MNA bSPL                   | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode=2  |        Data=0           |P|IHS|S|Res|U|O| NASL=2|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode=2  |        Flag-Based NAIs        |0| NAIs  | NAL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1| Additional Flag-Based NAIs                |S|Flag-Based-NAIs|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>
      <t>
	In this example, the NAS contains a Format B LSE with no flags
	set, indicating no operation. The next LSE uses Format C, but
	the Network Action Flag is not in a bit position contained
	within the Format C LSE, so a single Format D LSE has been
	added to the NAS to carry the flag.
      </t>
      <t>
	NAL is set to "1" to indicate that Flag-Based NAIs are also
	encoded in the next LSE.
      </t> 
      <t>
	NASL is set to "2" to indicate that 2 additional LSEs are
	used.
      </t> 
    </section>

    <section anchor="sect-J7.2" numbered="true" toc="default">
      <name>Network Action Opcode with AD </name>

      <figure anchor="In-Stack-Ext-Hdr-2a">
        <name>Network action opcode 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      MNA-Label=bSPL (TBA)             | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Opcode=8  |      Ancillary Data     |P|IHS|S|Res|U|O| NASL=0|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>
      <t>
	In this example, the NAS is carrying only one Network
	Action that requires 13 bits of Ancillary Data. 
      </t>
      <t>
	Details on the Second LSE
      </t>
      <ul empty="true" spacing="normal">
          <li> Opcode=8: A network action allocated outside of this document.</li>
          <li> Data: The data field contains 13 bits of ancillary data. </li>
      </ul>
   
    </section>

    <section anchor="sect-J7.4" numbered="true" toc="default">
      <name>Network Action Opcode with more AD</name>
      <t>
	A network action may require more Ancillary Data than can fit
	in a single LSE. In this example, a Format D LSE is added to
	carry additional Ancillary Data.
      </t>

      <figure anchor="In-Stack-Ext-Hdr-Format-4-with-more-AD">
        <name>Network Action With Additional 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Label=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2  |            Data=0         |P|IHS|0|Res|U|O| NASL=2|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Opcode=9 |        Ancillary Data           |0|  AD   | NAL=1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1|            Ancillary Data                 |S|Ancillary Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>

      <t>
	In this example, opcode 9 requires more than one LSE's worth of
	Ancillary Data, so a Format D LSE is added.
      </t>

      <t>
	Details on the third LSE:
      </t>
      <ul empty="true" spacing="normal">
        <li> Opcode=9: An opcode allocated outside of this document</li>
        <li> Ancillary Data: Most significant bits of Ancillary data</li>
        <li> AD: 4 bits of additional Ancillary Data</li>
      </ul>

      <t> Details on the fourth LSE: </t>
      <ul empty="true" spacing="normal">
        <li> Ancillary Data: 22 bits of additional Ancillary data.</li>
        <li> Ancillary Data: 8 bits of additional Ancillary Data.</li>
      </ul>
    
    </section>

  </section>

  <section anchor="sect-J6" numbered="true" toc="default">
    <name>Post-Stack Network Action Encoding </name>
    <t>
      The details of Post-Stack Network Action Extension Header
      encodings are specified in <xref
      target="I-D.song-mpls-extension-header" format="default"/>.
    </t>

    <section anchor="sect-J6.1a" numbered="true" toc="default">
      <name> NAS that only indicates Post-Stack NAs </name>

      <figure anchor="MNA-Carrying-only-PSD">
        <name>NAS encoding only Post-Stack 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Label=MNA bSPL              | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Opcode=2   |            0            |1|IHS|S|Res|U|O| NASL=0|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                                                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                             |1|               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                                                        
~                   Post-Stack Network Actions                  ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                                                               ~
~                           Payload                             ~
~                                                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        ]]></artwork>  
      </figure>

      <t>
	In some cases the NAS may encode only the presence of
	Post-Stack NAs. In this case, the P-Bit is set. The IHS field
	indicates the scope of the Post-Stack NAs (I2E, HBH, Select).
      </t>

    </section>

    <section anchor="sect-J6.1b" numbered="true" toc="default">
      <name> NAS with both in-stack and post-stack NAs </name>

      <figure anchor="MNA-Carrying-ISD-PSD">
        <name>NAS with in-stack and post-stack 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Label=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |            0            |1|IHS|0|Res|U|O| NASL=1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |        Flag-Based NAIs        |S| NAIs  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                                                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                             |1|               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~              Post-Stack Network Actions Encoding              ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                                                               ~
~                           Payload                             ~
~                                                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        ]]></artwork>  
      </figure>

      <t>
	In some cases the NAS may encode in-stack NAs and indicate the
	presence of post-stack NAs. In this case, P-Bit is set.  The
	NASL is set to "1", indicating the presence of one additional
	LSE.  The IHS field indicates the scope of both the in-stack
	and post-stack NAs.
      </t>

    </section>

    <section anchor="sect-J6.1c" numbered="true" toc="default">
      <name> NASs with multiple scopes </name>

      <figure anchor="MNA-Carrying-ISD-PSD-Diff-Scope">
        <name>NASs with multiple scopes</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=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |            0            |0| 1 |0|Res|U|O| NASL=1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
| Opcode=2    |        Flag-Based NAIs        |0| NAIs  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Label=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Opcode=2   |            0            |1| 0 |1|Res|U|O| NASL=0|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~              Post-Stack Network Actions Encoding              ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
~                                                               ~
~                           Payload                             ~
~                                                               ~
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        ]]></artwork>  
      </figure>

      <t>
	In some cases the label stack may need to carry in-stack NAs
	with Hop-By-Hop scope and post-stack NAs with I2E scope. In
	this case, there will be two NASs in the label stack. In this
	case, the first NAS will encode the in-stack NA with the
	Hop-By-Hop scope and the second NAS will encode the presence
	of I2E scoped Post-Stack NAs.
      </t>

    </section>
  </section>

  <section anchor="sect-J6.a" numbered="true" toc="default">
    <name>Network Action Processing Order</name>
    <t>
      The semantics of a network action can vary widely and the
      results of processing one network action may affect the
      processing of a subsequent network action. To ensure that MNA
      has deterministic results, it may be necessary to specify the
      order in which actions are evaluated. See <xref
      target="Ordering"/>.
    </t>
      
    <section anchor="sect-J6.a1" numbered="true" toc="default">
      <name>Network Action Processing Order</name>
      <figure anchor="In-Stack-NA-Ordering-1">
        <name>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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Label=MNA bSPL              | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=8    |      Ancillary Data     |P|IHS|S|Res|U|1| NASL=2|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=7    |      Ancillary Data7          |S|  AD7  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |      Flag-Based NAIs          |S|  NAI  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        ]]></artwork>
      </figure>

      <t>
	In this example, opcode 8 is processed first, then opcode 7,
	and then the network action flags are processed from most
	significant to least significant.
      </t>
      <t>
	In a different case, some Flag-Based NAIs may need to be
	processed before opcode 7 and some Flag-Based NAIs
	may need to be processed after Opcode 7. This can done
	by causing some NAIs to appear earlier in the NAS.
      </t>

      <figure anchor="In-Stack-NA-Ordering-2">
        <name>Interleaving network actions</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=MNA bSPL           | TC  |S|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=8    |      Ancillary Data     |P|IHS|S|Res|U|1| NASL=3|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |        0x01                   |S|  NAI  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=7    |      Ancillary Data7          |S|  AD7  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |        0x02                   |S|  NAI  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        ]]></artwork>
      </figure>
      <t> 
	In the above example, opcode 8 is processed first, then
	Flag-Based NAI 0x1 is processed before opcode 7, and
	finally NAI 0x2 is processed.
      </t>

    </section>

    <section anchor="sect-J6.a2" numbered="true" toc="default">
      <name>Post-Stack NA Processing Order</name>
      <t>
	By default, post-stack NAs follow the ordering specified in
	<xref target="I-D.song-mpls-extension-header"
	format="default"/>. However, the PSD-ISD ordering opcode can
	be used to override the default ordering and interleave PSD
	actions with in-stack actions.
      </t> 
    </section>

    <section anchor="sect-J6.a3" numbered="true" toc="default">
      <name>A mix of in-stack and post-stack NAs</name>
      <t>
	In some cases, post-stack NAs needs to be processed before
	in-stack NAs. This section shows how to prioritize the
	post-stack NAs over in-stack NAs.
      </t>
      <figure anchor="In-Stack-NA-Ordering-3">
        <name>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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|          Label=MNA bSPL               | TC  |0|    TTL        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=8    |      Ancillary Data     |1|IHS|0|Res|U|O| NASL=3|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=2    |        Flag-Based NAIs        |0| NAIs  | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=4    |       Post-Stack NH 6         |0|PS-NAI | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Opcode=7    |      Ancillary Data           |S|  AD   | NAL=0 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

        ]]></artwork>
      </figure>

      <t>
	In the above example, opcode 8 is processed first, then the
	Flag-Based NAIs, followed by Post-Stack NH 6, and finally
	opcode 7.
      </t>

    </section>
  </section>
 </section>
 </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
	&I-D.ietf-mpls-mna-fwk;
	&I-D.ietf-mpls-mna-requirements;
	&I-D.ietf-mpls-mna-usecases;
	&I-D.song-mpls-extension-header;
	&RFC2119;
	&RFC3032;
	&RFC3209;
	&RFC3443;
	&RFC4377;
	&RFC4385;
	&RFC5462;
	&RFC5586;
	&RFC8174;
	&RFC8662;
	&RFC9017;
      </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 Open 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. The authors would like to thank Loa
      Andersson, Stewart Bryant and Greg Mirsky for reviewing our
      draft 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>
