<?xml version="1.0" encoding="utf-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.5.25 (Ruby 2.7.5) -->


<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [

<!ENTITY RFC9012 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9012.xml">
<!ENTITY I-D.ietf-idr-segment-routing-te-policy SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-idr-segment-routing-te-policy.xml">
<!ENTITY RFC9256 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.9256.xml">
<!ENTITY RFC3032 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.3032.xml">
<!ENTITY RFC5462 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.5462.xml">
]>

<?rfc toc, sortrefs, symrefs, comments="yes"?>

<rfc ipr="trust200902" docName="draft-zzhang-idr-tunnel-encapsulation-label-stack-01" category="std" consensus="true">
  <front>
    <title abbrev="Label stacks in TEA">MPLS Label Stacks in Tunnel Encapsulation Attribute</title>

    <author initials="Z." surname="Zhang" fullname="Zhaohui Zhang">
      <organization>Juniper Networks</organization>
      <address>
        <email>zzhang@juniper.net</email>
      </address>
    </author>
    <author initials="S." surname="Hares" fullname="Susan Hares">
      <organization></organization>
      <address>
        <email>skh@ndzh.com</email>
      </address>
    </author>

    <date year="2022" month="October" day="11"/>

    <area>routing</area>
    <workgroup>idr</workgroup>
    

    <abstract>


<t>RFC 9012 defines an MPLS Label Stack sub-TLV for Tunnel Encapsulation
Attribute, and specifies that it is to be pushed BEFORE other labels.
This document clarifies the use case for that, defines a new
Tunnel Label Stack sub-TLV for a label stack to be pushed AFTER other
labels (e.g., the label embedded in the NLRI for a labeled address
family, and/or the stack in an MPLS Label Stack sub-TLV), and defines
two new Segment sub-TLVs to encode a segment list in a compact format.</t>



    </abstract>



  </front>

  <middle>


<section anchor="traffic-steering-after-tunnel-endpoint" title="Traffic Steering after Tunnel Endpoint">

<t><xref target="RFC9012"/> defines an MPLS Label Stack sub-TLV for Tunnel Encapsulation
Attribute and specifies that:</t>

<figure><artwork><![CDATA[
 "If a packet is to be sent through the tunnel identified in a
 particular TLV, and if that TLV contains an MPLS Label Stack sub-TLV,
 then the label stack appearing in the sub-TLV MUST be pushed onto the
 packet before any other labels are pushed onto the packet."
]]></artwork></figure>

<t>Specifically, the label stack in the sub-TLV is to be pushed BEFORE
any other labels are pushed. This may sound counter-intuitive, in that
if a label stack (e.g. for Segment Routing) is to be used to steer
traffic to the tunnel endpoint, the stack should be pushed AFTER other
labels (e.g. the label embedded in the NLRI).</t>

<t>This document clarifies that it is NOT for steering traffic to but for
steering AFTER the tunnel endpoint. Consider the following use case:</t>

<figure><artwork><![CDATA[
              controller
             .          .
            .            .
 site1 --- PE1 -------- PE2 --- site2
]]></artwork></figure>

<t>Two sites are connected to two PEs respectively, and traffic steering
is desired within each site not just among the PEs. While PE2
could push the label stack used for steering within site2, there may
be situations where PE2 is not a device capable of pushing a large label
stack so PE1 is tasked with pushing the label stack that is used after the
tunnel end point PE2, within site2.</t>

</section>
<section anchor="traffic-steering-to-the-tunnel-endpoint" title="Traffic Steering to the Tunnel Endpoint">

<t>Notice that in the above example, it may be desired that PE2 or the
controller wants PE1 to send service traffic to PE2 via a specific
path through the underlay network. The path may be an Segment Routing
path identified as a label stack encoded in the Tunnel Encapsulation
Attribute of the service routes that PE1 receives.</t>

<t>PE1 needs to impose the label stack AFTER it imposes other labels
like service labels or the labels for traffic steering at site2
after the traffic arrives at PE2. Obviously, a new sub-TLV is needed
to encode the label stack for steering traffic to the tunnel endpoint,
as the existing MPLS Label Stack sub-TLV is for steering after traffic
reaches the tunnel endpoint.</t>

<section anchor="tunnel-label-stack-sub-tlv" title="Tunnel Label Stack sub-TLV">

<t>This document defines a new Tunnel Label Stack sub-TLV for that purpose.
It has exactly the same syntax as the existing MPLS Label Stack sub-TLV.
Section 3.6 of <xref target="RFC9012"></xref> applies to this new sub-TLV, with the following
differences:</t>

<t><list style="symbols">
  <t>A new tunnel type will be allocated by IANA</t>
  <t>The label stack MUST be imposed AFTER other labels are pushed.</t>
</list></t>

<t>Both the existing MPLS Label Stack sub-TLV and the new Tunnel Label
Stack sub-TLV MAY be present in a tunnel TLV.</t>

</section>
</section>
<section anchor="compact-segment-list" title="Compact Segment List">

<t>Section 2.4.4 of <xref target="I-D.ietf-idr-segment-routing-te-policy"/> specifies
a Segment List sub-TLV that is optional in a tunnel TLV. It encodes
a segment list in an SR Policy tunnel, containing zero or more Segment
sub-TLVs.</t>

<t>Each Segment sub-TLV specifies a segment of various types defined in
Section 4 of <xref target="RFC9256"/>. For example, if a segment list is a 10-label
stack, then the Segment List sub-TLV for it has 10 sub-TLVs,
each being a Type A Segment as defined in 2.4.4.2.1 of <xref target="I-D.ietf-idr-segment-routing-te-policy"/>:</t>

<figure><artwork><![CDATA[
  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |     Type      |   Length      |     Flags     |   RESERVED    |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |          Label                        | TC  |S|       TTL     |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>

<t>It is clear that this is not efficient on-the-wire encoding format,
and it involves additional encoding/decoding processing.</t>

<t>To address this inefficiency, this document specifies two new types of Segment sub-TLVs,
each encoding a label stack or an SRv6 SID list respectively.
A new segment type may be added in a future revision to encode a compressed SRv6 SID list.</t>

<t>Note that, while each new type is called a Segment sub-TLV in a
Segment List sub-TLV, it actually encodes a segment list (a label stack or an SRv6 SID list).
A Segment List sub-TLV MAY have a mixed Segment sub-TLVs of any types, e.g., a Type A segment that
encodes one label and another new segment type that encodes a label stack.
The actual segment list is a concatenation of all the labels in this example.</t>

<section anchor="segment-type-l" title="Segment Type L">

<t>The Type L Segment Sub-TLV encodes multiple SR-MPLS SIDs.  The format
is as follows and is used to encode MPLS Label fields as specified in
<xref target="RFC3032"/> <xref target="RFC5462"/>:</t>

<figure><artwork><![CDATA[
  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |     Type TBD1   |   Length      |     Flags     |   RESERVED  |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |          Label                        | TC  |S|       TTL    //
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 //          Repeated Label Entries                              |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>

<t>The Type TBD1 is to be assigned by IANA from the “SR Policy Segment List
 Sub-TLVs” under the “BGP Tunnel Encapsulation” registry.</t>

<t>The Length value is (4 * number of labels + 2).</t>

<t>Other fields are as defined in 2.4.4.2.1 of <xref target="I-D.ietf-idr-segment-routing-te-policy"/>.</t>

</section>
<section anchor="segment-type-m" title="Segment Type M">

<t>The Type M Segment Sub-TLV encodes multiple SRv6 SIDs with optional
SRv6 Endpoint Behavior and SID Structure:</t>

<figure><artwork><![CDATA[
  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |   Type TBD2     |   Length      |     Flags     |   RESERVED  |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 //                       SRv6 SID (16 octets)                  //
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 //                       Repeated SRv6 SIDs                    //
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 //     SRv6 Endpoint Behavior and SID Structure (optional)     //
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork></figure>

<t>The Type TBD2 is to be assigned by IANA from the “SR Policy Segment List
 Sub-TLVs” under the “BGP Tunnel Encapsulation” registry.</t>

<t>The Length value is (16 * number of SIDs + 2) when SRv6 Endpoint Behavior
and SID Structure is not present. If it is present, the Length value is
increased by 8.</t>

<t>Other fields are as defined in 2.4.4.2.2 of <xref target="I-D.ietf-idr-segment-routing-te-policy"/>.</t>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>This document does not introduce any new security issues besides
what is already discussed in RFC9012 and <xref target="I-D.ietf-idr-segment-routing-te-policy"/>.</t>

</section>
<section anchor="iana-assignments" title="IANA Assignments">

<t>IANA is requested to assign a new sub-TLV type for “Tunnel Label Stack”
from “BGP Tunnel Encapsulation Attribute Sub-TLVs” registry,
in the 0~127 range.</t>

<t>IANA is requested to assign two new sub-TLV types from the “SR Policy Segment List
Sub-TLVs” under the “BGP Tunnel Encapsulation” registry, for Type L and Type M
segments respectively.</t>

</section>
<section anchor="acknowledgements" title="Acknowledgements">

<t>The authors thank Eric Rosen and John Scudder for their valuable comments
and suggestions.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>

&RFC9012;
&I-D.ietf-idr-segment-routing-te-policy;
&RFC9256;
&RFC3032;
&RFC5462;


    </references>




  </back>

<!-- ##markdown-source:
H4sIAMzJRWMAA91aUXPbNhJ+x6/Yc17iVqQtxUkTPdVJlJ47jpOxdLm53twD
REISaorgEaAUJc399ttdgBRFyU7Sc+Y6ZRpVJIHF7uLbb3ehRFEkEpPqfD6E
ys2ip0I47TI1hNdvL8dwKacqg7GTyY0FncOkynN8MMoTWdgqk06bHM6dK/W0
ckrI6bRUq2GYZrfTRuciNUkulyg4LeXMRR8+LGQ+j3RaRo6FRqotNMpIRMQi
otO+SKRTc1Nuhig1FaLQQ3Am6YE1pSvVzOK3zdJ/ScxyqXJnhdBFicPKyrrB
6emz04GQpZJDKE3l0GCxRptxfXGzHoIQD+DjcDg1OlNlgToomCZF/+yTELJy
C4OCBECEfwENskP4Jf6FDOAH3i68N4tKw/a5KXGFn6tcF6qEK+XWpryx/EYt
pc6G4J3w469+SJwrJ3ZXGcd/RZ1ta5VxZWUO26dBkr1Z/JinHxYxWi9EFEUg
p9aVMkGJ169ewLPT/gBSNdO5soACursLtppGk8t3MDPlwV0WzS73cH4KtlCJ
nmmU5hbSgcb/8KuBqYKisguVwvPRqzfXIzBugdbzdtpYTBY4DKFQ0RZBksmy
FqKgsgoSiR+kA0ntbTWGXK1F0Os2taVfxeNuV5fzV5PRtVdFeFXgoYrncY8X
9tPUcqrSFAcjYOnp1eX1RVsuvpFpin63YiaXOtuwI05YVxUWxal3OPfYuy4Y
JRAPZBaM1Zy9EUaxGzEYTKpwaRteZto6Fk/4LnBfSbWldLHf7aVO00wRiicY
XjOd4MpKlQhzwGhTrT1NC6NzRMXHj39BYBAuPn26J2QcAMZQMErh6GKGqqPe
N6qFFEuWuQUG5HzBXvRUgFGJL0gIb4b0IgpZOp3goqjG5TvvSj3z8CP9EpM7
iVFzlxE9LwqXyls77/dOFoWS7LEAgNrw138bT1pYwmUMva+1YpOmCt1DDtjs
AB4wTrvzwpT4SIix91UiM0JT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