RFC 8029

Detecting Multiprotocol Label Switched (MPLS) Data-Plane Failures

๐Ÿ“… published March 2017, from ietf

RFC 8029: Detecting Multiprotocol Label Switched (MPLS) Data-Plane Failures โœจ

Okay bestie, here's the title block tea ๐Ÿต before we dive in:

  • Series: IETF, Request for Comments 8029 ๐ŸŽ€
  • Authors: K. Kompella (Juniper Networks, Inc.), G. Swallow, C. Pignataro (Ed.), N. Kumar (Cisco), S. Aldrin (Google), and M. Chen (Huawei) ๐Ÿ‘‘
  • Category: Standards Track, dated March 2017 ๐Ÿ“…
  • ISSN: 2070-1721 ๐ŸŒˆ
  • Obsoletes: RFCs 4379, 6424, 6829, and 7537 ๐Ÿ’€
  • Updates: RFC 1122 ๐Ÿฆ‹

Abstract

okay so this doc is giving "simple and efficient" ๐Ÿ’… and it's all about catching data-plane failures in Multiprotocol Label Switching (MPLS) Label Switched Paths (LSPs). ๐Ÿ” It defines a probe called an "MPLS echo request" and a response called an "MPLS echo reply" that brings back the result of the probe. The request is meant to carry enough info to check that the data plane is working correctly, and to check the data plane against the control plane, so you can pinpoint where things went wrong. ๐ŸŽฏ

This document obsoletes RFCs 4379, 6424, 6829, and 7537, and updates RFC 1122. ๐Ÿซถ


Status of This Memo

this one is an Internet Standards Track document, no cap ๐Ÿ”ฅ

It's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community. It went through public review and got approved for publication by the Internet Engineering Steering Group (IESG). โœจ If you want more on Internet Standards, check out Section 2 of RFC 7841. ๐Ÿ“š

Info about the current status, any errata, and how to give feedback lives at http://www.rfc-editor.org/info/rfc8029. ๐ŸŒธ


The copyright belongs to the IETF Trust and the people listed as authors, copyright (c) 2017, all rights reserved. ๐Ÿ”’

This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents, which you can find at http://trustee.ietf.org/license-info, as they stand on the publication date. Please actually read these, bestie, because they spell out your rights and restrictions. ๐Ÿ™ˆ Any code pulled out of this document has to include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions, and it comes with no warranty, as the Simplified BSD License describes.

This document might include stuff from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. Some of the copyright holders for that older material may not have given the IETF Trust permission to allow modifications outside the IETF Standards Process. So unless you get a proper license from those copyright holders, this doc can't be modified outside the IETF Standards Process, and derivative works can't be made outside it either. The exceptions are formatting it for publication as an RFC or translating it into languages other than English. ๐ŸŒ


Table of Contents ๐Ÿ“–

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   5
     1.1.  Conventions . . . . . . . . . . . . . . . . . . . . . . .   5
     1.2.  Structure of This Document  . . . . . . . . . . . . . . .   6
     1.3.  Scope of This Specification . . . . . . . . . . . . . . .   6
   2.  Motivation  . . . . . . . . . . . . . . . . . . . . . . . . .   7
     2.1.  Use of Address Range 127/8  . . . . . . . . . . . . . . .   8
     2.2.  Router Alert Option . . . . . . . . . . . . . . . . . . .  10
   3.  Packet Format . . . . . . . . . . . . . . . . . . . . . . . .  11
     3.1.  Return Codes  . . . . . . . . . . . . . . . . . . . . . .  16
     3.2.  Target FEC Stack  . . . . . . . . . . . . . . . . . . . .  17
       3.2.1.  LDP IPv4 Prefix . . . . . . . . . . . . . . . . . . .  19
       3.2.2.  LDP IPv6 Prefix . . . . . . . . . . . . . . . . . . .  19
       3.2.3.  RSVP IPv4 LSP . . . . . . . . . . . . . . . . . . . .  20
       3.2.4.  RSVP IPv6 LSP . . . . . . . . . . . . . . . . . . . .  20
       3.2.5.  VPN IPv4 Prefix . . . . . . . . . . . . . . . . . . .  21
       3.2.6.  VPN IPv6 Prefix . . . . . . . . . . . . . . . . . . .  22
       3.2.7.  L2 VPN Endpoint . . . . . . . . . . . . . . . . . . .  23
       3.2.8.  FEC 128 Pseudowire - IPv4 (Deprecated)  . . . . . . .  23
       3.2.9.  FEC 128 Pseudowire - IPv4 (Current) . . . . . . . . .  24
       3.2.10. FEC 129 Pseudowire - IPv4 . . . . . . . . . . . . . .  25
       3.2.11. FEC 128 Pseudowire - IPv6 . . . . . . . . . . . . . .  26
       3.2.12. FEC 129 Pseudowire - IPv6 . . . . . . . . . . . . . .  27
       3.2.13. BGP Labeled IPv4 Prefix . . . . . . . . . . . . . . .  28
       3.2.14. BGP Labeled IPv6 Prefix . . . . . . . . . . . . . . .  28
       3.2.15. Generic IPv4 Prefix . . . . . . . . . . . . . . . . .  29
       3.2.16. Generic IPv6 Prefix . . . . . . . . . . . . . . . . .  29
       3.2.17. Nil FEC . . . . . . . . . . . . . . . . . . . . . . .  29
     3.3.  Downstream Mapping (Deprecated) . . . . . . . . . . . . .  30
     3.4.  Downstream Detailed Mapping TLV . . . . . . . . . . . . .  30
       3.4.1.  Sub-TLVs  . . . . . . . . . . . . . . . . . . . . . .  34
       3.4.2.  Downstream Router and Interface . . . . . . . . . . .  40
     3.5.  Pad TLV . . . . . . . . . . . . . . . . . . . . . . . . .  41
     3.6.  Vendor Enterprise Number  . . . . . . . . . . . . . . . .  41
     3.7.  Interface and Label Stack . . . . . . . . . . . . . . . .  42
     3.8.  Errored TLVs  . . . . . . . . . . . . . . . . . . . . . .  43
     3.9.  Reply TOS Octet TLV . . . . . . . . . . . . . . . . . . .  44
   4.  Theory of Operation . . . . . . . . . . . . . . . . . . . . .  44
     4.1.  Dealing with Equal-Cost Multipath (ECMP)  . . . . . . . .  44
     4.2.  Testing LSPs That Are Used to Carry MPLS Payloads . . . .  45
     4.3.  Sending an MPLS Echo Request  . . . . . . . . . . . . . .  46
     4.4.  Receiving an MPLS Echo Request  . . . . . . . . . . . . .  47
       4.4.1.  FEC Validation  . . . . . . . . . . . . . . . . . . .  53

     4.5.  Sending an MPLS Echo Reply  . . . . . . . . . . . . . . .  54
       4.5.1.  Addition of a New Tunnel  . . . . . . . . . . . . . .  55
       4.5.2.  Transition between Tunnels  . . . . . . . . . . . . .  56
     4.6.  Receiving an MPLS Echo Reply  . . . . . . . . . . . . . .  56
     4.7.  Issue with VPN IPv4 and IPv6 Prefixes . . . . . . . . . .  58
     4.8.  Non-compliant Routers . . . . . . . . . . . . . . . . . .  59
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .  59
   6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  61
     6.1.  TCP and UDP Port Number . . . . . . . . . . . . . . . . .  61
     6.2.  MPLS LSP Ping Parameters  . . . . . . . . . . . . . . . .  61
       6.2.1.  Message Types, Reply Modes, Return Codes  . . . . . .  61
       6.2.2.  TLVs  . . . . . . . . . . . . . . . . . . . . . . . .  62
       6.2.3.  Global Flags  . . . . . . . . . . . . . . . . . . . .  64
       6.2.4.  Downstream Detailed Mapping Address Type  . . . . . .  64
       6.2.5.  DS Flags  . . . . . . . . . . . . . . . . . . . . . .  65
       6.2.6.  Multipath         Types . . . . . . . . . . . . . . .  66
       6.2.7.  Pad Type  . . . . . . . . . . . . . . . . . . . . . .  66
       6.2.8.  Interface and Label Stack Address Type  . . . . . . .  67
     6.3.  IPv4 Special-Purpose Address Registry . . . . . . . . . .  67
   7.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  67
     7.1.  Normative References  . . . . . . . . . . . . . . . . . .  67
     7.2.  Informative References  . . . . . . . . . . . . . . . . .  68
   Appendix A.  Deprecated TLVs and Sub-TLVs (Non-normative) . . . .  72
     A.1.  Target FEC Stack  . . . . . . . . . . . . . . . . . . . .  72
       A.1.1.  FEC 128 Pseudowire - IPv4 (Deprecated)  . . . . . . .  72
     A.2.  Downstream Mapping (Deprecated) . . . . . . . . . . . . .  72
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  77
   Contributors  . . . . . . . . . . . . . . . . . . . . . . . . . .  77
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  78

1. Introduction โœจ

bestie, this section is the setup: it's the same detect-data-plane-failures vibe as the Abstract, just with a bit more detail ๐Ÿฆ‹ It defines the "MPLS echo request" probe and the "MPLS echo reply" response that brings back the result. The request is supposed to carry enough info to check the data plane is working, plus a way to verify the data plane against the control plane, so faults can be localized. ๐ŸŽฏ

Here's the big-brain part: MPLS echo requests follow the same data path that normal MPLS packets would traverse. ๐Ÿ›ค๏ธ The main job is to validate the data plane, and the secondary job is to verify the data plane against the control plane. Checking the control plane is valuable too, but it isn't covered in this document. ๐Ÿ™ˆ

This doc makes special use of the address range 127/8. That's an exception to the behavior defined in RFC 1122 [RFC1122], and this specification updates that RFC. The reasoning behind the change and the details of this exceptional use are in Section 2.1 below. ๐Ÿ’…

This document obsoletes RFC 4379 [RFC4379], RFC 6424 [RFC6424], RFC 6829 [RFC6829], and RFC 7537 [RFC7537]. ๐Ÿ’€

1.1. Conventions

Okay, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document get interpreted as described in RFC 2119 [RFC2119]. These are the official "this is a rule" words, so read them carefully ๐Ÿ”ฅ

The term "Must Be Zero" (MBZ) shows up in object descriptions for reserved fields. These fields MUST be set to zero when sent, and they get ignored on receipt. ๐Ÿงธ

Terminology about L2 and L3 Virtual Private Networks (VPNs) is defined in [RFC4026]. ๐ŸŒ

Since this doc talks about the MPLS Time to Live (TTL) way more than the IP TTL, the authors went with a convention: unqualified "TTL" means "MPLS TTL," and "IP TTL" is the TTL value in the IP header. โœจ

1.2. Structure of This Document

The body of this memo has four main parts: motivation, MPLS echo request/reply packet format, LSP ping operation, and a reliable return path. ๐Ÿงฉ

First-time readers are encouraged to skip the actual packet formats and read the "Theory of Operation" (Section 4) first. The document is structured the way it is to avoid forward references, so this is the move ๐Ÿ’–

1.3. Scope of This Specification โœจ

okay so the main goal of this doc is giving us a clean, updated LSP ping spec ๐Ÿ’…

[RFC4379] is the one that defines the basic MPLS LSP validation mechanism, and it's what you use for fault detection and isolation ๐Ÿ” this doc also brings in a bunch of updates to MPLS LSP ping, like:

  • Update all references and citations.
    • Obsoleted RFCs 2434, 2030, and 3036 are respectively replaced with RFCs 5226, 5905, and 5036.
    • Some informative references were also published as RFCs: RFCs 4761, 5085, 5885, and 8077.
  • Incorporate all outstanding RFC errata.
    • See [Err108], [Err742], [Err1418], [Err1714], [Err1786], [Err2978], [Err3399].
  • Replace EXP with Traffic Class (TC), based on the update from RFC 5462.
  • Incorporate the updates from RFC 6829, by adding the pseudowire (PW) Forwarding Equivalence Classes (FECs) advertised over IPv6 and obsoleting RFC 6829.
  • Incorporate the updates from RFC 7506, by adding the IPv6 Router Alert Option (RAO) for MPLS Operations, Administration, and Maintenance (OAM).
  • Incorporate newly defined bits on the Global Flags field from RFCs 6425 and 6426.
  • Update the IPv4 addresses used in examples to utilize the documentation prefix. Add examples with IPv6 addresses.
  • Incorporate the updates from RFC 6424, by deprecating the Downstream Mapping TLV (DSMAP) and adding the Downstream Detailed Mapping TLV (DDMAP); updating two new Return Codes; adding the motivations of tunneled or stitched LSPs; updating the procedures, IANA considerations, and security considerations; and obsoleting RFC 6424.
  • Incorporate the updates from RFC 7537, by updating the IANA Considerations section and obsoleting RFC 7537.
  • Finally, obsolete RFC 4379.

2. Motivation ๐Ÿซถ

when an LSP fails to deliver user traffic, the MPLS control plane can't always catch it ๐Ÿ˜ญ so we need a tool that lets users spot those traffic "black holes" or misrouting within a reasonable amount of time, plus a way to isolate the faults ๐Ÿ•ต๏ธโ€โ™€๏ธ

this doc describes a mechanism that does exactly that, and it's modeled on the ping/traceroute vibe you already know ๐Ÿฆ‹ ping (ICMP echo request [RFC0792]) handles connectivity checks, and traceroute handles hop-by-hop fault localization as well as path tracing. this doc specifies a "ping" mode and a "traceroute" mode for testing MPLS LSPs.

the basic idea is to check that packets belonging to a particular FEC actually end their MPLS path on a Label Switching Router (LSR) that is an egress for that FEC ๐Ÿ‘‘ the proposal is to send a packet (called an "MPLS echo request") along the same data path as the other packets in that FEC. the echo request also carries info about the FEC whose MPLS path is being verified, and it gets forwarded just like any other packet in that FEC. in "ping" mode (basic connectivity check), the packet should reach the end of the path, and then it goes to the control plane of the egress LSR, which verifies whether it really is an egress for the FEC. in "traceroute" mode (fault isolation), the packet is sent to the control plane of each transit LSR, which runs various checks to confirm it really is a transit LSR for this path. that LSR also sends back extra info so the control plane can be checked against the data plane, aka making sure forwarding matches what the routing protocols decided the path should be ๐Ÿง 

an LSP traceroute may cross a tunneled or stitched LSP on its way to the destination ๐ŸŒˆ when you do end-to-end LSP validation in those cases, the FEC info the Initiator put in the packet may be different from the one assigned by the transit node in a different segment of a stitched LSP or tunnel. let's look at a simple case ๐Ÿ‘€

A          B          C           D           E
o -------- o -------- o --------- o --------- o
  \_____/  | \______/   \______/  | \______/
    LDP    |   RSVP       RSVP    |    LDP
           |                      |
            \____________________/
                    LDP

say an LSP traceroute starts at Router A and goes to Router E. the FEC info in the packet will be LDP, but Router C along the path is a pure RSVP node and doesn't run LDP ๐Ÿ’€ so node C can't do FEC validation. the MPLS echo request should carry enough info to let any transit node inside a stitched or tunneled LSP run FEC validations and catch misrouted echo requests ๐ŸŽ€

here's one way people use these tools: periodically ping a FEC to make sure it's connected. if the ping fails, you can then start a traceroute to figure out where the fault is ๐Ÿ”ฅ you can also periodically traceroute FECs to check that forwarding matches the control plane. BUT that puts a heavier load on transit LSRs, so it should be used with caution โš ๏ธ

2.1. Use of Address Range 127/8 ๐ŸŒธ

as we covered above, LSP ping is a diagnostic tool ๐Ÿฉบ it's meant to help providers of an MPLS-based service isolate network faults. specifically, LSP ping needs to diagnose situations where the control and data planes are out of sync. it does this by routing an MPLS echo request packet based only on its label stack. the IP destination address is never used in a forwarding decision ๐Ÿ™…โ€โ™€๏ธ honestly, the sender of an MPLS echo request packet may not know ahead of time the address of the router at the end of the LSP.

providers also need to be able to trace all of the possible paths an LSP may take ๐Ÿ—บ๏ธ since most MPLS services are based on IP unicast forwarding, those paths are subject to Equal-Cost Multipath (ECMP) load sharing.

so this leads to the following requirements ๐Ÿ“

  1. Although the LSP in question may be broken in unknown ways, the likelihood of a diagnostic packet being delivered to a user of an MPLS service MUST be held to an absolute minimum.
  2. If an LSP is broken in such a way that it prematurely terminates, the diagnostic packet MUST NOT be IP forwarded.
  3. A means of varying the diagnostic packets such that they exercise all ECMP paths is thus REQUIRED.

clearly, using general unicast addresses fails the first two requirements ๐Ÿ˜ค a bunch of other address options got considered, including a chunk of the private address space (as decided by the network operator) and the IPv4 link-local addresses. private address space was deemed ineffective because the leading MPLS-based service is an IPv4 VPN, and VPNs often use private addresses ๐Ÿ™ƒ

IPv4 link-local addresses are more attractive because their forwarding scope is limited ๐ŸŒฟ BUT, if you used an address from that range, the first recipient of a diagnostic packet that "escaped" from a broken LSP could have that address assigned to the interface it arrived on, and it could mistakenly receive the packet ๐Ÿ’€ also, older deployed routers may not (correctly) implement IPv4 link-local addresses and would forward a packet with an address from that range toward the default route.

so the 127/8 range for IPv4, and that same range embedded in an IPv4-mapped IPv6 address for IPv6, got picked for a bunch of reasons ๐Ÿ’œ

RFC 1122 allocates 127/8 as the "Internal host loopback address" and states: "Addresses of this form MUST NOT appear outside a host." ๐Ÿ™Œ so by default, hosts discard these packets. if a diagnostic packet gets misdirected to a host, it'll be silently discarded ๐Ÿคซ

RFC 1812 [RFC1812] states:

A router SHOULD NOT forward, except over a loopback interface, any packet that has a destination address on network 127. A router MAY have a switch that allows the network manager to disable these checks. If such a switch is provided, it MUST default to performing the checks.

this helps make sure diagnostic packets are never IP forwarded โœจ

and the 127/8 address range gives you 16M addresses, so there's lots of room to vary addresses and exercise ECMP paths ๐Ÿคฉ finally, as an implementation optimization, the 127/8 range gives you an easy way to identify possible LSP packets ๐Ÿงš

2.2. Router Alert Option ๐Ÿšจ

this doc requires the use of the RAO set in an IP header so the transit node processes the MPLS OAM payload ๐Ÿซถ

[RFC2113] defines a generic Option Value 0x0 for IPv4 RAO that alerts the transit router to examine the IPv4 packet. [RFC7506] defines MPLS OAM Option Value 69 for IPv6 RAO, which tells transit routers to take a closer look at the IPv6 packet for MPLS OAM purposes ๐Ÿ‘‘

here's how the Router Alert IP Option gets used in this doc:

In case of an IPv4 header, the generic IPv4 RAO value 0x0 [RFC2113] SHOULD be used. In case of an IPv6 header, the IPv6 RAO value (69) for MPLS OAM [RFC7506] MUST be used.

3. Packet Format ๐ŸŽ€

okay bestie, time for the actual packet ๐Ÿ’… An MPLS echo request/reply is a (possibly labeled) IPv4 or IPv6 UDP packet, and the contents of that UDP packet look like this:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |         Version Number        |         Global Flags          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Message Type |   Reply Mode  |  Return Code  | Return Subcode|
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Sender's Handle                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                        Sequence Number                        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                    TimeStamp Sent (seconds)                   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                TimeStamp Sent (seconds fraction)              |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                  TimeStamp Received (seconds)                 |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |              TimeStamp Received (seconds fraction)            |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                            TLVs ...                           |
      .                                                               .
      .                                                               .
      .                                                               .
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The Version Number is currently 1. (Note: the version number gets bumped whenever a change affects an implementation's ability to correctly parse or process an MPLS echo request/reply. That covers any syntactic or semantic changes to any of the fixed fields, or to any Type-Length-Value (TLV) or sub-TLV assignment or format that was defined at a certain version number. The version number may not need to be changed if an optional TLV or sub-TLV is added.)

The Global Flags field is a bit vector with this format:

       0                   1
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |           MBZ           |R|T|V|
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

At the time of writing, three flags are defined: the R, T, and V bits. The rest MUST be set to zero when sending and ignored on receipt. โœจ

The V (Validate FEC Stack) flag is set to 1 if the sender wants the receiver to perform FEC Stack validation. If V is 0, the choice is left to the receiver. ๐Ÿฆ‹

The T (Respond Only If TTL Expired) flag MUST be set only in the echo request packet by the sender. If the T flag is set to 1 in an incoming echo request, and the TTL of the incoming MPLS label is more than 1, then the receiving node MUST drop the incoming echo request and MUST NOT send any echo reply to the sender. This flag MUST NOT be set in the echo reply packet. If this flag is set in an echo reply packet, then it MUST be ignored. The T flag is defined in Section 3.4 of [RFC6425]. ๐Ÿ™ˆ

The R (Validate Reverse Path) flag is defined in [RFC6426]. When this flag is set in the echo request, the Responder SHOULD return reverse-path FEC information, as described in Section 3.4.2 of [RFC6426]. ๐ŸŒธ

The Message Type is one of the following:

   Value    Meaning
   -----    -------
       1    MPLS Echo Request
       2    MPLS Echo Reply

The Reply Mode can take one of these values:

   Value    Meaning
   -----    -------
       1    Do not reply
       2    Reply via an IPv4/IPv6 UDP packet
       3    Reply via an IPv4/IPv6 UDP packet with Router Alert
       4    Reply via application-level control channel

An MPLS echo request with 1 (Do not reply) in the Reply Mode field may be used for one-way connectivity tests. The receiving router may log gaps in the Sequence Numbers and/or maintain delay/jitter statistics. An MPLS echo request would normally have 2 (Reply via an IPv4/IPv6 UDP packet) in the Reply Mode field. If the normal IP return path is deemed unreliable, one may use 3 (Reply via an IPv4/IPv6 UDP packet with Router Alert). Note that this requires that all intermediate routers understand and know how to forward MPLS echo replies. The echo reply uses the same IP version number as the received echo request, i.e., an IPv4 encapsulated echo reply is sent in response to an IPv4 encapsulated echo request. ๐Ÿ’–

Some applications support an IP control channel. One such example is the associated control channel defined in Virtual Circuit Connectivity Verification (VCCV) [RFC5085][RFC5885]. Any application that supports an IP control channel between its control entities may set the Reply Mode to 4 (Reply via application-level control channel) to ensure that replies use that same channel. Further definition of this code point is application specific and thus beyond the scope of this document. ๐Ÿงš

Return Code and Return Subcode values are described in Section 3.1. ๐Ÿ‘‘

The Sender's Handle is filled in by the sender and returned unchanged by the receiver in the echo reply (if any). There are no semantics associated with this handle, although a sender may find this useful for matching up requests with replies. ๐Ÿซถ

The Sequence Number is assigned by the sender of the MPLS echo request and can be (for example) used to detect missed replies. ๐Ÿ“

The TimeStamp Sent is the time of day (according to the sender's clock) in 64-bit NTP timestamp format [RFC5905] when the MPLS echo request is sent. The TimeStamp Received in an echo reply is the time of day (according to the receiver's clock) in 64-bit NTP timestamp format in which the corresponding echo request was received. โญ

TLVs (Type-Length-Value tuples) have this format:

       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             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                             Value                             |
      .                                                               .
      .                                                               .
      .                                                               .
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Types are defined below. Length is the length of the Value field in octets. The Value field depends on the Type, and it is zero padded to align to a 4-octet boundary. TLVs may be nested within other TLVs, in which case the nested TLVs are called sub-TLVs. Sub-TLVs have independent types and MUST also be 4-octet aligned. ๐ŸŒˆ

Here are two examples of how TLV and sub-TLV lengths are computed, and how sub-TLVs are padded to be 4-octet aligned:

       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 = 1 (LDP IPv4 FEC)    |          Length = 5           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                          IPv4 prefix                          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Prefix Length |         Must Be Zero                          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The Length for this TLV is 5. A Target FEC Stack TLV that contains an LDP IPv4 FEC sub-TLV and a VPN IPv4 prefix sub-TLV has this format:

       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 = 1 (FEC TLV)       |          Length = 32          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  Sub-Type = 1 (LDP IPv4 FEC)  |          Length = 5           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                          IPv4 prefix                          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Prefix Length |         Must Be Zero                          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Sub-Type = 6 (VPN IPv4 prefix)|          Length = 13          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Route Distinguisher                      |
      |                          (8 octets)                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         IPv4 prefix                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Prefix Length |                 Must Be Zero                  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Here's a description of the Types and Values of the top-level TLVs for LSP ping:

       Type #                  Value Field
       ------                  -----------
            1                  Target FEC Stack
            2                  Downstream Mapping (Deprecated)
            3                  Pad
            4                  Unassigned
            5                  Vendor Enterprise Number
            6                  Unassigned
            7                  Interface and Label Stack
            8                  Unassigned
            9                  Errored TLVs
           10                  Reply TOS Byte
           20                  Downstream Detailed Mapping

Types less than 32768 (i.e., with the high-order bit equal to 0) are mandatory TLVs that MUST either be supported by an implementation or result in the Return Code of 2 ("One or more of the TLVs was not understood") being sent in the echo response. ๐Ÿ”ฅ

Types greater than or equal to 32768 (i.e., with the high-order bit equal to 1) are optional TLVs that SHOULD be ignored if the implementation does not understand or support them. ๐Ÿฆ‹

In Sections 3.2 through 3.9 and their various subsections, only the Value field of the TLV is included. ๐Ÿ’œ

3.1. Return Codes ๐Ÿ’…

okay so the Return Code is set to zero by whoever sends the echo request ๐ŸŽ€ the router that receives that echo request can pick one of the values from the list below and put it in the echo reply it generates โœจ the <RSC> thing is the Return Subcode, and it gets filled in with the stack-depth for the codes that say so ๐Ÿงš for all the other codes, the Return Subcode MUST be set to zero ๐Ÿซถ

   Value    Meaning
   -----    -------
       0    No Return Code
       1    Malformed echo request received
       2    One or more of the TLVs was not understood
       3    Replying router is an egress for the FEC at
            stack-depth <RSC>
       4    Replying router has no mapping for the FEC at
            stack-depth <RSC>
       5    Downstream Mapping Mismatch (See Note 1)
       6    Upstream Interface Index Unknown (See Note 1)
       7    Reserved
       8    Label switched at stack-depth <RSC>
       9    Label switched but no MPLS forwarding at stack-depth <RSC>
      10    Mapping for this FEC is not the given label at
            stack-depth <RSC>
      11    No label entry at stack-depth <RSC>
      12    Protocol not associated with interface at FEC
            stack-depth <RSC>
      13    Premature termination of ping due to label stack
            shrinking to a single label
      14    See DDMAP TLV for meaning of Return Code and Return
            Subcode (See Note 2)
      15    Label switched with FEC change

Note 1

okay this one's about where things stopped ๐ŸŒˆ the Return Subcode (RSC) holds the point in the label stack where processing got terminated ๐Ÿ’œ if the RSC is 0, then no labels were processed, and otherwise the packet was label switched at depth RSC ๐Ÿฆ‹

Note 2

this note is for the code 14 one, and it's giving very specific vibes ๐Ÿ‘‘ the Return Code is per "Downstream Detailed Mapping TLV" (Section 3.4) ๐ŸŽ€ this Return Code MUST be used only in the message header and MUST be set only in the MPLS echo reply message ๐Ÿ™ˆ if the Return Code is set in the MPLS echo request message, then it MUST be ignored, no cap ๐Ÿ’€ when this Return Code is set, each Downstream Detailed Mapping TLV MUST have an appropriate Return Code and Return Subcode โœจ this Return Code MUST be used when there are multiple downstreams for a given node (such as Point-to-Multipoint (P2MP) or ECMP), and the node needs to return a Return Code/Return Subcode for each downstream ๐ŸŒธ this Return Code MAY be used even when there is only one downstream for a given node ๐Ÿซถ


3.2. Target FEC Stack ๐Ÿงš

okay so a Target FEC Stack is basically a list of sub-TLVs ๐Ÿ’– the number of elements is figured out by looking at the sub-TLV length fields ๐ŸŽ€

    Sub-Type     Length         Value Field
    --------     ------         -----------
           1          5         LDP IPv4 prefix
           2         17         LDP IPv6 prefix
           3         20         RSVP IPv4 LSP
           4         56         RSVP IPv6 LSP
           5                    Unassigned
           6         13         VPN IPv4 prefix
           7         25         VPN IPv6 prefix
           8         14         L2 VPN endpoint
           9         10         "FEC 128" Pseudowire - IPv4 (deprecated)
          10         14         "FEC 128" Pseudowire - IPv4
          11        16+         "FEC 129" Pseudowire - IPv4
          12          5         BGP labeled IPv4 prefix
          13         17         BGP labeled IPv6 prefix
          14          5         Generic IPv4 prefix
          15         17         Generic IPv6 prefix
          16          4         Nil FEC
          24         38         "FEC 128" Pseudowire - IPv6
          25         40+        "FEC 129" Pseudowire - IPv6

other FEC types have been defined and will be defined as needed ๐Ÿ’…

note that this TLV defines a stack of FECs, with the first FEC element corresponding to the top of the label stack, etc. ๐ŸŒˆ

an MPLS echo request MUST have a Target FEC Stack that describes the FEC Stack being tested ๐Ÿซถ for example, if an LSR X has an LDP mapping [RFC5036] for 192.0.2.1 (say, label 1001), then to verify that label 1001 does indeed reach an egress LSR that announced this prefix via LDP, X can send an MPLS echo request with a FEC Stack TLV with one FEC in it, namely, of type LDP IPv4 prefix, with prefix 192.0.2.1/32, and send the echo request with a label of 1001 โœจ

say LSR X wanted to verify that a label stack of <1001, 23456> is the right label stack to use to reach a VPN IPv4 prefix (see Section 3.2.5) of 203.0.113.0/24 in VPN foo ๐Ÿ‘‘ say further that LSR Y with loopback address 192.0.2.1 announced prefix 203.0.113.0/24 with Route Distinguisher (RD) RD-foo-Y (which may in general be different from the RD that LSR X uses in its own advertisements for VPN foo), label 23456, and BGP next hop 192.0.2.1 [RFC4271] ๐Ÿฆ‹ finally, suppose that LSR X receives a label binding of 1001 for 192.0.2.1 via LDP ๐ŸŽ€ X has two choices in sending an MPLS echo request: X can send an MPLS echo request with a FEC Stack TLV with a single FEC of type VPN IPv4 prefix with a prefix of 203.0.113.0/24 and an RD of RD-foo-Y. alternatively, X can send a FEC Stack TLV with two FECs, the first of type LDP IPv4 with a prefix of 192.0.2.1/32 and the second of type of IP VPN with a prefix 203.0.113.0/24 with an RD of RD-foo-Y ๐Ÿ’– in either case, the MPLS echo request would have a label stack of <1001, 23456> ๐ŸŒธ (Note: in this example, 1001 is the "outer" label and 23456 is the "inner" label.) ๐Ÿ™ˆ

if, for example, an LSR Y has an LDP mapping for the IPv6 address 2001:db8::1 (say, label 2001), then to verify that label 2001 does reach an egress LSR that announced this prefix via LDP, LSR Y can send an MPLS echo request with a FEC Stack TLV with one LDP IPv6 prefix FEC, with prefix 2001:db8::1/128, and with a label of 2001 ๐Ÿงš

if an end-to-end path comprises of one or more tunneled or stitched LSPs, each transit node that is the originating point of a new tunnel or segment SHOULD reply back notifying the FEC stack change along with the new FEC details ๐Ÿ’œ for example, if LSR X has an LDP mapping for IPv4 prefix 192.0.2.10 on LSR Z (say, label 3001) ๐ŸŒˆ say further that LSR A and LSR B are transit nodes along the path, which also have an RSVP tunnel over which LDP is enabled ๐Ÿ’… while replying back, A SHOULD notify that the FEC changes from LDP to <RSVP, LDP> โœจ if the new tunnel is a transparent pipe, i.e., the data-plane trace will not expire in the middle of the tunnel, then the transit node SHOULD NOT reply back notifying the FEC stack change or the new FEC details ๐Ÿซถ if the transit node wishes to hide the nature of the tunnel from the ingress of the echo request, then the transit node MAY notify the FEC stack change and include Nil FEC as the new FEC ๐Ÿฆ‹


3.2.1. LDP IPv4 Prefix ๐ŸŒธ

the IPv4 Prefix FEC is defined in [RFC5036] ๐Ÿ’– when an LDP IPv4 prefix is encoded in a label stack, the following format is used ๐ŸŽ€ the value consists of 4 octets of an IPv4 prefix followed by 1 octet of prefix length in bits, and the format is given below ๐Ÿงš the IPv4 prefix is in network byte order; if the prefix is shorter than 32 bits, trailing bits SHOULD be set to zero ๐Ÿ‘‘ see [RFC5036] for an example of a Mapping for an IPv4 FEC โœจ

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          IPv4 prefix                          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Prefix Length |         Must Be Zero                          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.2. LDP IPv6 Prefix ๐Ÿฆ‹

the IPv6 Prefix FEC is defined in [RFC5036] ๐Ÿซถ when an LDP IPv6 prefix is encoded in a label stack, the following format is used ๐Ÿ’œ the value consists of 16 octets of an IPv6 prefix followed by 1 octet of prefix length in bits, and the format is given below ๐ŸŒˆ the IPv6 prefix is in network byte order; if the prefix is shorter than 128 bits, the trailing bits SHOULD be set to zero ๐Ÿ’… see [RFC5036] for an example of a Mapping for an IPv6 FEC ๐Ÿ™ˆ

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                          IPv6 prefix                          |
    |                          (16 octets)                          |
    |                                                               |
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    | Prefix Length |         Must Be Zero                          |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.3. RSVP IPv4 LSP ๐Ÿงš

the value has the format below ๐Ÿ’– the Value fields are taken from RFC 3209 [RFC3209], Sections 4.6.1.1 and 4.6.2.1 ๐ŸŽ€

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                 IPv4 Tunnel Endpoint Address                  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Must Be Zero         |     Tunnel ID                 |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       Extended Tunnel ID                      |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                   IPv4 Tunnel Sender Address                  |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Must Be Zero         |            LSP ID             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.4. RSVP IPv6 LSP ๐Ÿ‘‘

the value has the format below โœจ the Value fields are taken from RFC 3209 [RFC3209], Sections 4.6.1.2 and 4.6.2.2 ๐Ÿฆ‹

     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
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                 IPv6 Tunnel Endpoint Address                  |
    |                                                               |
    |                                                               |
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Must Be Zero         |          Tunnel ID            |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                       Extended Tunnel ID                      |
    |                                                               |
    |                                                               |
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |                   IPv6 Tunnel Sender Address                  |
    |                                                               |
    |                                                               |
    |                                                               |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
    |          Must Be Zero         |            LSP ID             |
    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.5. VPN IPv4 Prefix โœจ

okay so VPN-IPv4 NLRI is defined in [RFC4365] ๐Ÿ’… this doc uses the term VPN IPv4 prefix for a VPN-IPv4 NLRI that got advertised with an MPLS label in BGP ๐ŸŽ€ see [RFC3107].

when a VPN IPv4 prefix gets encoded in a label stack, this is the format we use ๐Ÿฆ‹ the Value field has the RD that was advertised with the VPN IPv4 prefix, the IPv4 prefix (padded with trailing 0 bits so it's 32 bits in all), and a prefix length, like so:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Route Distinguisher                      |
      |                          (8 octets)                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         IPv4 prefix                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Prefix Length |                 Must Be Zero                  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

the RD is an 8-octet identifier, and it doesn't contain any inherent information ๐Ÿ™ˆ its whole purpose is just to let you create distinct routes to a common IPv4 address prefix. the encoding of the RD isn't important here, and when you match this field to the local FEC information, you treat it as an opaque value ๐Ÿงš

3.2.6. VPN IPv6 Prefix ๐ŸŒธ

VPN-IPv6 NLRI is defined in [RFC4365] ๐Ÿ’œ same deal as before, this doc says VPN IPv6 prefix for a VPN-IPv6 NLRI that got advertised with an MPLS label in BGP. see [RFC3107].

when a VPN IPv6 prefix is encoded in a label stack, the format goes like this โœจ the Value field has the RD advertised with the VPN IPv6 prefix, the IPv6 prefix (padded with trailing 0 bits so it's 128 bits in all), and a prefix length:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Route Distinguisher                      |
      |                          (8 octets)                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                         IPv6 prefix                           |
      |                                                               |
      |                                                               |
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Prefix Length |                 Must Be Zero                  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

the RD is identical to the VPN IPv4 Prefix RD, except here it's doing the job of making distinct routes to IPv6 prefixes ๐Ÿฆ‹ see Section 3.2.5. when matching this field to local FEC information, it's treated as an opaque value ๐Ÿ’–

3.2.7. L2 VPN Endpoint ๐Ÿ’…

VPLS stands for Virtual Private LAN Service ๐ŸŒˆ the terms VPLS BGP NLRI and VPLS Edge Identifier (VE ID) are defined in [RFC4761]. this doc just says L2 VPN endpoint when it means a VPLS BGP NLRI, which is way less of a mouthful ๐Ÿซถ the RD is an 8-octet identifier used to tell apart the info about different L2 VPNs that a node advertises. the VE ID is a 2-octet identifier that picks out a particular node serving as the service attachment point within a VPLS โญ the structure of these two identifiers doesn't matter here. when matching these fields to local FEC information, they're treated as opaque values. the encapsulation type is identical to the Pseudowire (PW) Type in Section 3.2.9 ๐Ÿ”ฅ

when an L2 VPN endpoint is encoded in a label stack, the format is ๐Ÿงš the Value field has an RD (8 octets), the sender's (of the ping) VE ID (2 octets), the receiver's VE ID (2 octets), and an encapsulation type (2 octets), laid out like this:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Route Distinguisher                      |
      |                          (8 octets)                           |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |         Sender's VE ID        |       Receiver's VE ID        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |      Encapsulation Type       |         Must Be Zero          |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.8. FEC 128 Pseudowire - IPv4 (Deprecated) ๐Ÿ™ˆ

this one's retired, so see Appendix A.1.1 for the details ๐Ÿชฆ

3.2.9. FEC 128 Pseudowire - IPv4 (Current) ๐Ÿ”ฅ

FEC 128 (0x80) is defined in [RFC8077], and so are the terms PW ID (Pseudowire ID) and PW Type (Pseudowire Type) ๐Ÿ’– a PW ID is a non-zero 32-bit connection ID. the PW Type is a 15-bit number that tells you the encapsulation type. it's carried right justified in the field below called "encapsulation type", with the high-order bit set to zero โœจ

both of these fields are treated as opaque values in this protocol. when matching them to the local FEC information, the match MUST be exact ๐Ÿ‘‘ no fuzzy matching, bestie.

when a FEC 128 is encoded in a label stack, the format is as follows ๐ŸŽ€ the Value field has the Sender's Provider Edge (PE) IPv4 Address (the source address of the targeted LDP session), the Remote PE IPv4 Address (the destination address of the targeted LDP session), the PW ID, and the encapsulation type:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                     Sender's PE IPv4 Address                  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Remote PE IPv4 Address                   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                             PW ID                             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |            PW Type            |          Must Be Zero         |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.10. FEC 129 Pseudowire - IPv4 ๐ŸŒท

FEC 129 (0x81) and the terms PW Type, Attachment Group Identifier (AGI), Attachment Group Identifier Type (AGI Type), Attachment Individual Identifier Type (AII Type), Source Attachment Individual Identifier (SAII), and Target Attachment Individual Identifier (TAII) are all defined in [RFC8077] ๐Ÿ“š the PW Type is a 15-bit number for the encapsulation type, carried right justified in the field below PW Type with the high-order bit set to zero. every other field is treated as an opaque value and copied straight from the FEC 129 format. all of these values together uniquely define the FEC within the scope of the LDP session identified by the source and remote PE IPv4 addresses ๐Ÿซถ

when a FEC 129 is encoded in a label stack, the format goes like this ๐ŸŒˆ the Length of this TLV is 16 + AGI length + SAII length + TAII length. padding is used to make the total length a multiple of 4, but the length of the padding isn't included in the Length field ๐Ÿ™ˆ

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                     Sender's PE IPv4 Address                  |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                      Remote PE IPv4 Address                   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |            PW Type            |   AGI Type    |  AGI Length   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                           AGI Value                           ~
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   AII Type    |  SAII Length  |      SAII Value               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                    SAII Value (continued)                     ~
      |                                                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |   AII Type    |  TAII Length  |      TAII Value               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                    TAII Value (continued)                     ~
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |  TAII (cont.) |  0-3 octets of zero padding                   |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.11. FEC 128 Pseudowire - IPv6 ๐Ÿฆ‹

the FEC 128 Pseudowire IPv6 sub-TLV is structured just like the FEC 128 Pseudowire IPv4 sub-TLV from Section 3.2.9 ๐Ÿ’… the Value field has the Sender's PE IPv6 Address (the source address of the targeted LDP session), the Remote PE IPv6 Address (the destination address of the targeted LDP session), the PW ID, and the encapsulation type:

       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
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                     Sender's PE IPv6 Address                  ~
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      ~                      Remote PE IPv6 Address                   ~
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                             PW ID                             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |            PW Type            |          Must Be Zero         |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • Sender's PE IPv6 Address: the source IP address of the target IPv6 LDP session. 16 octets ๐Ÿ’œ
  • Remote PE IPv6 Address: the destination IP address of the target IPv6 LDP session. 16 octets ๐Ÿ’œ
  • PW ID: same as FEC 128 Pseudowire IPv4 in Section 3.2.9 โœจ
  • PW Type: same as FEC 128 Pseudowire IPv4 in Section 3.2.9 ๐ŸŒธ

3.2.12. FEC 129 Pseudowire - IPv6 โœจ

okay so the FEC 129 Pseudowire IPv6 sub-TLV is basically the twin of the IPv4 one from Section 3.2.10 ๐Ÿฆ‹ same vibe, same structure, just with bigger addresses ๐Ÿ’… when one gets encoded in a label stack, it looks like this. its length is 40 + AGI (Attachment Group Identifier) length + SAII (Source Attachment Individual Identifier) length + TAII (Target Attachment Individual Identifier) length ๐Ÿงฎ and if you need padding to get the total to a multiple of 4, that padding does NOT count toward the Length field ๐Ÿ™ˆ the chaos is contained!!

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   ~                   Sender's PE IPv6 Address                    ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   ~                    Remote PE IPv6 Address                     ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |            PW Type            |   AGI Type    |  AGI Length   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   ~                           AGI Value                           ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   AII Type    |  SAII Length  |      SAII Value               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   ~                    SAII Value (continued)                     ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   AII Type    |  TAII Length  |      TAII Value               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   ~                    TAII Value (continued)                     ~
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  TAII (cont.) |  0-3 octets of zero padding                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Sender's PE IPv6 Address: this is the source IP address of the target IPv6 LDP session ๐ŸŒธ it's 16 octets.

Remote PE IPv6 Address: this is the destination IP address of that same target IPv6 LDP session ๐Ÿ’œ also 16 octets.

the other fields work exactly the same as FEC 129 Pseudowire IPv4, so go check Section 3.2.10 for those ๐Ÿซถ

3.2.13. BGP Labeled IPv4 Prefix โœจ

BGP labeled IPv4 prefixes come from [RFC3107] ๐ŸŽ€ when one is encoded in a label stack, the Value field holds the IPv4 prefix (padded with trailing 0 bits so it's 32 bits total) plus the prefix length, and it's laid out like this ๐Ÿ“

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          IPv4 prefix                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |                 Must Be Zero                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.14. BGP Labeled IPv6 Prefix ๐ŸŒˆ

same deal but make it IPv6 ๐Ÿ’… BGP labeled IPv6 prefixes are also from [RFC3107]. the value is 16 octets of IPv6 prefix followed by 1 octet of prefix length in bits. the prefix is in network byte order, and if it's shorter than 128 bits, the trailing bits SHOULD be set to zero ๐Ÿงผ the layout:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          IPv6 prefix                          |
   |                          (16 octets)                          |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |         Must Be Zero                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.15. Generic IPv4 Prefix ๐Ÿงš

this one's for when you don't know (or it might change mid-LSP) which protocol advertised the label ๐Ÿ‘€ the value is 4 octets of IPv4 prefix plus 1 octet of prefix length in bits. the prefix is in network byte order, and if it's shorter than 32 bits, the trailing bits SHOULD be set to zero โœจ

the classic example is an inter-AS LSP that gets signaled by LDP in one Autonomous System (AS), by RSVP-TE [RFC3209] in another AS, and by BGP between the ASes, which is super common for inter-AS VPNs ๐ŸŒ the protocol switching is literally the whole plot ๐Ÿ˜ญ

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          IPv4 prefix                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |         Must Be Zero                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.16. Generic IPv6 Prefix ๐Ÿ’–

the IPv6 glow-up of the last one ๐Ÿฆ‹ 16 octets of IPv6 prefix followed by 1 octet of prefix length in bits. the prefix is in network byte order, and if it's shorter than 128 bits, the trailing bits SHOULD be set to zero ๐Ÿซง

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          IPv6 prefix                          |
   |                          (16 octets)                          |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |         Must Be Zero                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.17. Nil FEC ๐Ÿ™ˆ

okay this one is a little sneaky ๐Ÿ•ต๏ธโ€โ™€๏ธ sometimes labels from the reserved range (think Router Alert and Explicit-null) get tossed onto the label stack for diagnostic stuff, like nudging load-balancing. those labels might not have any explicit FEC attached to them ๐Ÿ’€ so the Nil FEC Stack exists. it lets you add a Target FEC Stack sub-TLV to the Target FEC Stack to account for those labels, so validation can still happen properly โœ…

the Length is 4 ๐Ÿ“ and labels are 20-bit values that get treated as plain numbers ๐Ÿ”ข

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                 Label                 |          MBZ          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Label is the actual label value that goes into the label stack ๐Ÿท๏ธ and the MBZ fields MUST be zero when sent and ignored on receipt ๐Ÿซถ that's a hard rule, bestie!


3.3. Downstream Mapping (Deprecated) ๐Ÿ‚

the details for this one are in Appendix A.2 ๐Ÿง go take a peek there!

3.4. Downstream Detailed Mapping TLV โœจ

Okay so the Downstream Detailed Mapping object is a TLV that MAY be tucked into an MPLS echo request message ๐Ÿฆ‹ Only one of these can show up per echo request, bestie. Including it is basically asking the replying router to send Downstream Detailed Mapping objects back in the echo reply ๐Ÿ™ If the replying router is the destination (Label Edge Router) of the FEC, then a Downstream Detailed Mapping TLV SHOULD NOT be included in the MPLS echo reply ๐Ÿ’€ Otherwise, the replying router SHOULD include a Downstream Detailed Mapping object for each interface over which this FEC could be forwarded ๐ŸŒธ For the precise meaning of "downstream," check out Section 3.4.2, "Downstream Router and Interface" ๐Ÿงš

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |               MTU             | Address Type  |    DS Flags   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |               Downstream Address (4 or 16 octets)             |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         Downstream Interface Address (4 or 16 octets)         |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |  Return Code  | Return Subcode|        Sub-TLV Length         |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       .                                                               .
       .                      List of Sub-TLVs                         .
       .                                                               .
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

This format is a glow-up of the deprecated Downstream Mapping TLV format (see Appendix A.2.) The big change is that the variable length and optional fields got turned into sub-TLVs ๐Ÿ’–

Maximum Transmission Unit (MTU)

The MTU is the size in octets of the largest MPLS frame (including label stack) that fits on the interface to the downstream LSR ๐Ÿ“

Address Type

The Address Type tells you whether the interface is numbered or unnumbered ๐Ÿ”ข It also decides how long the Downstream IP Address and Downstream Interface fields are. It gets set to one of these values:

 Type #        Address Type
 ------        ------------
      1        IPv4 Numbered
      2        IPv4 Unnumbered
      3        IPv6 Numbered
      4        IPv6 Unnumbered

DS Flags

The DS Flags field is a bit vector of flags, laid out like this ๐Ÿงฉ

  0 1 2 3 4 5 6 7
 +-+-+-+-+-+-+-+-+
 | Rsvd(MBZ) |I|N|
 +-+-+-+-+-+-+-+-+

Two flags are defined right now, I and N. The remaining flags MUST be set to zero when sending and ignored on receipt ๐Ÿ™…โ€โ™€๏ธ

 Flag  Name and Meaning
 ----  ----------------
    I  Interface and Label Stack Object Request

       When this flag is set, it indicates that the replying
       router SHOULD include an Interface and Label Stack
       Object in the echo reply message.

    N  Treat as a Non-IP Packet

       Echo request messages will be used to diagnose non-IP
       flows.  However, these messages are carried in IP
       packets.  For a router that alters its ECMP algorithm
       based on the FEC or deep packet examination, this flag
       requests that the router treat this as it would if the
       determination of an IP payload had failed.

Downstream Address and Downstream Interface Address

IPv4 addresses and interface indices are encoded in 4 octets, and IPv6 addresses are encoded in 16 octets ๐ŸŒˆ

If the interface to the downstream LSR is numbered, then the Address Type MUST be set to IPv4 or IPv6, the Downstream Address MUST be set to either the downstream LSR's Router ID or the interface address of the downstream LSR, and the Downstream Interface Address MUST be set to the downstream LSR's interface address ๐Ÿ 

If the interface to the downstream LSR is unnumbered, the Address Type MUST be IPv4 Unnumbered or IPv6 Unnumbered, the Downstream Address MUST be the downstream LSR's Router ID, and the Downstream Interface Address MUST be set to the index assigned by the upstream LSR to the interface ๐Ÿ”—

If an LSR doesn't know the IP address of its neighbor, then it MUST set the Address Type to either IPv4 Unnumbered or IPv6 Unnumbered. For IPv4, it must set the Downstream Address to 127.0.0.1. For IPv6, the address is set to 0::1. In both cases, the interface index MUST be set to 0. If an LSR receives an Echo Request packet with either of these addresses in the Downstream Address field, this indicates that it MUST bypass interface verification but continue with label validation ๐Ÿ™ˆ

If the originator of an echo request packet wants Downstream Detailed Mapping information but doesn't know the expected label stack, then it SHOULD set the Address Type to either IPv4 Unnumbered or IPv6 Unnumbered. For IPv4, it MUST set the Downstream Address to 224.0.0.2. For IPv6, the address MUST be set to FF02::2. In both cases, the interface index MUST be set to 0. If an LSR receives an echo request packet with the all-routers multicast address, then this indicates that it MUST bypass both interface and label stack validation but return Downstream Mapping TLVs using the information provided ๐Ÿ“ก

Return Code

The Return Code is set to zero by the sender of an echo request. The receiver of that echo request can set it in the corresponding echo reply it generates to one of the values specified in Section 3.1 other than 14 ๐Ÿ’…

If the receiver sets a non-zero value of the Return Code field in the Downstream Detailed Mapping TLV, then the receiver MUST also set the Return Code field in the echo reply header to "See DDMAP TLV for Return Code and Return Subcode" (Section 3.1). An exception to this is if the receiver is a bud node [RFC4461] and is replying as both an egress and a transit node, with a Return Code of 3 ("Replying router is an egress for the FEC at stack-depth <RSC>") in the echo reply header ๐Ÿ‘‘

If the Return Code of the echo reply message is not set to either "See DDMAP TLV for Return Code and Return Subcode" (Section 3.1) or "Replying router is an egress for the FEC at stack-depth <RSC>", then the Return Code specified in the Downstream Detailed Mapping TLV MUST be ignored ๐Ÿซถ

Return Subcode

The Return Subcode is set to zero by the sender. The receiver can set this field to an appropriate value as specified in Section 3.1: the Return Subcode is filled in with the stack-depth for those codes that specify the stack-depth. For all other codes, the Return Subcode MUST be set to zero ๐Ÿ“

If the Return Code of the echo reply message is not set to either "See DDMAP TLV for Return Code and Return Subcode" (Section 3.1) or "Replying router is an egress for the FEC at stack-depth <RSC>", then the Return Subcode specified in the Downstream Detailed Mapping TLV MUST be ignored ๐Ÿ™ƒ

Sub-TLV Length

This is the total length in octets of the sub-TLVs associated with this TLV ๐Ÿ“ฆ


3.4.1. Sub-TLVs

This section defines the sub-TLVs that MAY be included as part of the Downstream Detailed Mapping TLV ๐ŸŽ€

     Sub-Type    Value Field
    ---------   ------------
      1         Multipath data
      2         Label stack
      3         FEC stack change

3.4.1.1. Multipath Data Sub-TLV

  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
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |Multipath Type |       Multipath Length        |Reserved (MBZ) |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 |                                                               |
 |                  (Multipath Information)                      |
 |                                                               |
 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The multipath data sub-TLV carries Multipath Information ๐Ÿง

Multipath Type

This is the type of encoding used for the Multipath Information ๐Ÿ”‘

The following Multipath Types are defined in this document:

 Key   Type                  Multipath Information
 ---   ----------------      ---------------------
  0    no multipath          Empty (Multipath Length = 0)
  2    IP address            IP addresses
  4    IP address range      low/high address pairs
  8    Bit-masked IP         IP address prefix and bit mask
         address set
  9    Bit-masked label set  Label prefix and bit mask

Type 0 means all packets will be forwarded out this one interface. Types 2, 4, 8, and 9 say that the supplied Multipath Information will be used to exercise this path ๐Ÿ›ฃ๏ธ

Multipath Length

The length in octets of the Multipath Information ๐Ÿ“

MBZ

MUST be set to zero when sending and MUST be ignored on receipt ๐Ÿซง

Multipath Information

This is the encoded multipath data (for example, encoded address or label values), following the Multipath Type. See Section 3.4.1.1.1 for encoding details ๐Ÿ”

3.4.1.1.1. Multipath Information Encoding ๐Ÿ’–

okay so this is the part where the multipath info gets encoded, and it's giving precision, bestie ๐ŸŽ€ The Multipath Information encodes the labels or addresses that will exercise this path. What goes in there depends on the Multipath Type, and the contents are shown in the table above. IPv4 addresses come from the range 127/8, and IPv6 addresses come from the range 0:0:0:0:0:FFFF:7F00:0/104. Labels are treated as numbers, which means they're right-justified in the field ๐Ÿงš For Type 4, ranges given as address pairs MUST NOT overlap and MUST be in ascending sequence. No cap, that's a must-do ๐Ÿ’…

Type 8 is the dense-packing queen ๐Ÿ‘‘ The IP prefix is written as a base IP address with the non-prefix low-order bits set to zero. The maximum prefix length is 27. After the prefix comes a mask of 2^(32 - prefix length) bits for IPv4, or 2^(128 - prefix length) bits for IPv6. Each bit set to 1 means a valid address. The address is the base IPv4 address plus the position of the bit in the mask, where the bits are numbered left to right starting at zero ๐Ÿฆ‹ For example, the IPv4 addresses 127.2.1.0, 127.2.1.5-127.2.1.15, and 127.2.1.20-127.2.1.29 would be encoded like this:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Those same addresses embedded in IPv6 would look like this ๐ŸŒธ

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Type 9 is the label version of that dense trick ๐Ÿ“ The label prefix is written as a base label value with the non-prefix low-order bits set to zero. The maximum prefix length (including leading zeros due to encoding) is 27. After the prefix comes a mask of 2^(32 - prefix length) bits. Each bit set to one represents a valid label. The label is the base label plus the position of the bit in the mask, numbered left to right starting at zero โœจ For example, the label values of all the odd numbers between 1152 and 1279 would be encoded like this:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Here's the rule that matters most, bestie: if the received Multipath Information is non-null, the labels and IP addresses MUST be picked from the set provided. If none of these labels or addresses map to a particular downstream interface, then for that interface, the type MUST be set to 0. If the received Multipath Information is null (that's Multipath Length = 0, or for Types 8 and 9, a mask of all zeros), the type MUST be set to 0 ๐Ÿ’€

Okay, example time ๐Ÿ™ˆ Say LSR X at hop 10 has two downstream LSRs, Y and Z, for the FEC in question. The received X could return Multipath Type 4, with low/high IP addresses of 127.1.1.1->127.1.1.255 for downstream LSR Y and 127.2.1.1->127.2.1.255 for downstream LSR Z. The head end reflects this info to LSR Y. Y has three downstream LSRs, U, V, and W, and it works out that 127.1.1.1->127.1.1.127 goes to U and 127.1.1.128-> 127.1.1.255 goes to V. Y then responds with 3 Downstream Detailed Mapping TLVs: to U, with Multipath Type 4 (127.1.1.1->127.1.1.127); to V, with Multipath Type 4 (127.1.1.127->127.1.1.255); and to W, with Multipath Type 0 ๐Ÿฆ‹

Real talk, computing Multipath Information can be a big processing burden on the receiver ๐Ÿ˜ญ So a receiver MAY choose to process a subset of the received prefixes. The sender, on getting a reply to a Downstream Detailed Mapping with partial information, SHOULD assume the prefixes missing from the reply were skipped by the receiver, and it MAY re-request that info in a new echo request ๐Ÿ’œ

Two more things, and they're for later docs ๐ŸŒˆ The encoding of Multipath Information where a few LSRs use Entropy-label-based load-balancing while others are non-EL (IP-based) load balanced will be defined in a different document. The encoding for scenarios where LSRs have Layer 2 ECMP over Link Aggregation Group (LAG) interfaces will also be defined in a different document. ๐Ÿซถ


3.4.1.2. Label Stack Sub-TLV ๐ŸŽ€

The vibe here is "the whole stack, no skipping" ๐Ÿงš Here's the layout:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Downstream Label                |    Protocol   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                                                               .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Downstream Label                |    Protocol   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The Label Stack sub-TLV holds the set of labels in the label stack exactly as it would have looked if this router were forwarding the packet out this interface. Any Implicit Null labels are explicitly included ๐ŸŒธ The number of label/protocol pairs in the sub-TLV is figured out from the sub-TLV data length. When the Downstream Detailed Mapping TLV is sent in the echo reply, this sub-TLV MUST be included ๐Ÿ˜คโœจ

Downstream Label

A downstream label is 24 bits, in the same format as an MPLS label minus the TTL field. So the MSBit of the label is bit 0, the LSBit is bit 19, the TC field [RFC5462] is bits 20-22, and S is bit 23. The replying router SHOULD fill in the TC field and S bit, but the LSR receiving the echo reply MAY choose to ignore them ๐Ÿ“

Protocol

This specifies the label distribution protocol for the Downstream label. Protocol values come from this table ๐Ÿ’–

Protocol #        Signaling Protocol
----------        ------------------
         0        Unknown
         1        Static
         2        BGP
         3        LDP
         4        RSVP-TE

3.4.1.3. FEC Stack Change Sub-TLV โœจ

okay so a router MUST include the FEC stack change sub-TLV when the downstream node in the echo reply has a different FEC Stack than the one in the echo request ๐Ÿ’… One or more FEC stack change sub-TLVs MAY be present in the Downstream Detailed Mapping TLV. Here's the format:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Operation Type | Address Type  | FEC-tlv length|  Reserved     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Remote Peer Address (0, 4, or 16 octets)            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                         FEC TLV                               .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Operation Type ๐ŸŽ€

The operation type is the action tied to the FEC stack change. Two types are defined:

      Type #     Operation
      ------     ---------
      1          Push
      2          Pop

Address Type ๐Ÿฆ‹

The Address Type tells you the remote peer's address type. It's set to one of these values, and the peer address length depends on which one you pick. The address type MAY be different from the address type in the Downstream Detailed Mapping TLV, which can happen when the LSP goes over a tunnel of a different address family. The address type MAY be set to Unspecified if the peer address is unavailable, or if the transit router doesn't want to share it for security or administrative reasons.

     Type #   Address Type   Address length
     ------   ------------   --------------
     0        Unspecified    0
     1        IPv4           4
     2        IPv6           16

FEC TLV Length ๐Ÿงš

The length of the FEC TLV, in octets.

Reserved ๐Ÿซถ

This field is reserved for future use and MUST be set to zero.

Remote Peer Address ๐ŸŒธ

The remote peer address names the remote peer that's the next hop for the FEC being traced right now. If the operation type is PUSH, the remote peer address is the address of the peer the pushed FEC was learned from. If the operation type is pop, the remote peer address MAY be set to Unspecified.

For upstream-assigned labels [RFC5331], a pop operation will have a remote peer address (the upstream node that assigned the label), and this SHOULD be included in the FEC stack change sub-TLV. The remote peer address MAY be set to Unspecified if the address needs to be hidden. ๐Ÿ™ˆ

FEC TLV ๐Ÿ’œ

The FEC TLV only shows up when the FEC-tlv length field is non-zero. It specifies the FEC linked to the FEC stack change operation. This TLV MAY be included when the operation type is pop. It MUST be included when the operation type is PUSH. The FEC TLV holds exactly one FEC from the list of FECs in Section 3.2. A Nil FEC MAY be associated with a PUSH operation if the responding router wants to hide the details of the FEC being pushed. ๐Ÿ‘‘

FEC Stack Change Sub-TLV Operation Rules ๐Ÿ”ฅ

These are the rules for FEC stack change sub-TLV operations, and they're non-negotiable bestie:

a. A FEC stack change sub-TLV containing a PUSH operation MUST NOT be followed by a FEC stack change sub-TLV containing a pop operation.

b. One or more pop operations MAY be followed by one or more PUSH operations. ๐Ÿ’…

c. One FEC stack change sub-TLV MUST be included per FEC stack change. For example, if 2 labels are going to be pushed, then one FEC stack change sub-TLV MUST be included for each FEC. โœจ

d. A FEC splice operation (an operation where one FEC ends and another FEC starts) MUST be performed by including a pop type FEC stack change sub-TLV followed by a PUSH type FEC stack change sub-TLV. ๐Ÿฆ‹

e. A Downstream Detailed Mapping TLV containing only one FEC stack change sub-TLV with pop operation is equivalent to IS_EGRESS (Return Code 3, Section 3.1) for the outermost FEC in the FEC stack. The ingress router performing the LSP traceroute MUST treat such a case as an IS_EGRESS for the outermost FEC. ๐ŸŒˆ


3.4.2. Downstream Router and Interface ๐ŸŒธ

The notion of "downstream router" and "downstream interface" should be explained. Picture an LSR X. If a packet that was originated with TTL n>1 arrived with outermost label L and TTL=1 at LSR X, X must be able to compute which LSRs could receive the packet if it was originated with TTL=n+1, which interface the request would arrive over, and what label stack those LSRs would see. (It is outside the scope of this document to specify how this computation is done.) The set of these LSRs/interfaces is the downstream routers/interfaces (and their corresponding labels) for X with respect to L. Each pair of downstream router and interface requires a separate Downstream Detailed Mapping to be added to the reply. ๐Ÿงš

The case where X is the LSR originating the echo request is a special case. X needs to figure out which LSRs would receive the MPLS echo request for a given FEC Stack that X originates with TTL=1.

The set of downstream routers at X may be alternative paths (see the discussion below on ECMP) or simultaneous paths (e.g., for MPLS multicast). In the former case, the Multipath Information is used as a hint to the sender about how it may influence the choice of these alternatives. ๐Ÿ’–


3.5. Pad TLV ๐Ÿ“

The value part of the Pad TLV contains a variable number (>= 1) of octets. The first octet takes values from the following table; all the other octets (if any) are ignored. The receiver SHOULD verify that the TLV is received in its entirety, but otherwise ignores the contents of this TLV, apart from the first octet.

    Value        Meaning
    -----        -------
        0        Reserved
        1        Drop Pad TLV from reply
        2        Copy Pad TLV to reply
    3-250        Unassigned
  251-254        Reserved for Experimental Use
      255        Reserved

The Pad TLV can be added to an echo request to create a message of a specific length when you need messages of various sizes for troubleshooting. The first octet controls whether this extra padding gets included in the matching echo reply. ๐ŸŽ€


3.6. Vendor Enterprise Number ๐Ÿข

"Private Enterprise Numbers" [IANA-ENT] are maintained by IANA. The Length of this TLV is always 4. The value is the Structure of Management Information (SMI) Private Enterprise Code, in network octet order, of the vendor with a Vendor Private extension to any of the fields in the fixed part of the message, in which case this TLV MUST be present. If none of the fields in the fixed part of the message have Vendor Private extensions, inclusion of this TLV is OPTIONAL. Vendor Private ranges for Message Types, Reply Modes, and Return Codes have been defined. When any of these are used, the Vendor Enterprise Number TLV MUST be included in the message. ๐Ÿ’…


3.7. Interface and Label Stack ๐Ÿฆ‹

The Interface and Label Stack TLV MAY be included in a reply message to report the interface the request message was received on, and the label stack that was on the packet when it arrived. Only one such object may appear. The purpose is to let the upstream router get the exact interface and label stack information as it shows up at the replying LSR. โœจ

The Length is K + 4*N octets, where N is the number of labels in the label stack. Values for K are in the Address Type description below. The Value field of this TLV has this format:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Address Type  |             Must Be Zero                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                   IP Address (4 or 16 octets)                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                   Interface (4 or 16 octets)                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                                                               .
   .                          Label Stack                          .
   .                                                               .
   .                                                               .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Address Type ๐ŸŒˆ

The Address Type shows whether the interface is numbered or unnumbered. It also sets the length of the IP Address and Interface fields. The total for the initial part of the TLV is listed below as "K Octets". The Address Type is set to one of these values:

       Type #        Address Type           K Octets
       ------        ------------           --------
            0        Reserved                      4
            1        IPv4 Numbered                12
            2        IPv4 Unnumbered              12
            3        IPv6 Numbered                36
            4        IPv6 Unnumbered              24
          5-250        Unassigned
        251-254        Reserved for Experimental Use
            255        Reserved

IP Address and Interface ๐Ÿ“

IPv4 addresses and interface indices are encoded in 4 octets. IPv6 addresses are encoded in 16 octets.

If the interface the echo request message was received on is numbered, then the Address Type MUST be set to IPv4 or IPv6, the IP Address MUST be set to either the LSR's Router ID or the interface address, and the Interface MUST be set to the interface address.

If the interface is unnumbered, the Address Type MUST be either IPv4 Unnumbered or IPv6 Unnumbered, the IP Address MUST be the LSR's Router ID, and the Interface MUST be set to the index assigned to the interface. ๐Ÿ”ฅ

Label Stack ๐Ÿ’–

The label stack of the received echo request message. If any TTL values have been changed by this router, they SHOULD be restored. ๐Ÿซถ

3.8. Errored TLVs ๐Ÿฆ‹

Okay bestie, this TLV is allowed (MAY) to show up in an echo reply ๐Ÿ’– It's how the replier lets the sender know about mandatory TLVs it either doesn't support or parsed and found to be broken ๐Ÿ˜ญ The Value field is where those not-understood TLVs live, encoded as sub-TLVs ๐Ÿงš

    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 = 9          |            Length             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             Value                             |
   .                                                               .
   .                                                               .
   .                                                               .
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.9. Reply TOS Octet TLV ๐Ÿ“

This TLV MAY be used by the originator of the echo request to ask that an echo reply go out with the IP header Type of Service (TOS) octet set to whatever value is in the TLV ๐ŸŽ€ It has a length of 4, with the following Value field.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Reply-TOS Byte|                 Must Be Zero                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

4. Theory of Operation ๐Ÿ”ฎ

Okay so an MPLS echo request is used to test a particular LSP โœจ The LSP being tested is identified by the "FEC Stack". For example, if the LSP was set up via LDP and a label is mapped to an egress IP address of 198.51.100.1, the FEC Stack contains a single element: an LDP IPv4 prefix sub-TLV with value 198.51.100.1/32. If the LSP being tested is an RSVP LSP, the FEC Stack is a single element that captures the RSVP Session and Sender Template that uniquely identifies the LSP ๐Ÿ’…

FEC Stacks can get more complex ๐ŸŒˆ Say you want to test a VPN IPv4 prefix of 203.0.113.0/24 that's tunneled over an LDP LSP with egress 192.0.2.1. The FEC Stack would then have two sub-TLVs: the bottom one is a VPN IPv4 prefix, and the top one is an LDP IPv4 prefix. If the underlying (LDP) tunnel were unknown, or considered irrelevant, the FEC Stack could just be a single element with the VPN IPv4 sub-TLV by itself ๐Ÿซถ

When an MPLS echo request is received, the receiver is expected to verify that the control plane and data plane are both healthy (for the FEC Stack being pinged), and that the two planes are in sync ๐Ÿ‘‘ The procedures for this are in Section 4.4.

4.1. Dealing with Equal-Cost Multipath (ECMP) ๐ŸŒธ

LSPs don't have to be simple point-to-point tunnels, bestie ๐Ÿ™ˆ A single LSP can originate at several ingresses and terminate at several egresses, which is super common with LDP LSPs. LSPs for a given FEC can also have multiple "next hops" at transit LSRs. At an ingress there might be several different LSPs to pick from to reach the endpoint you want. And LSPs can have backup paths, detour paths, and other alternative paths to take if the primary LSP goes down ๐Ÿ’€

About those last two points: it's assumed that the LSR sending the MPLS echo requests can force the echo request into any desired LSP, so picking between multiple LSPs at the ingress isn't an issue ๐Ÿงš Probing the different flavors of backup paths (which typically won't carry data unless the primary LSP is down) isn't covered here.

Since the actual LSP and path a packet takes might not be known ahead of time, it's useful if MPLS echo requests can exercise all possible paths โœจ That's desirable, but it may not be practical, because the algorithms a given LSR uses to spread packets over alternative paths may be proprietary ๐Ÿ˜ญ

To get some coverage of alternate paths, there's a certain amount of latitude in choosing the destination IP address and source UDP port for an MPLS echo request. That's clearly not enough, though. For traceroute, more latitude comes from the Multipath Information of the Downstream Detailed Mapping TLV, and it works like this ๐Ÿฆ‹ An ingress LSR periodically sends an LSP traceroute message to find out whether there are multipaths for a given LSP. If there are, each hop provides some info on how each of its downstream paths can be exercised. The ingress can then send MPLS echo requests that exercise those paths. If several transit LSRs have ECMP, the ingress may try to combine these to exercise all possible paths. Full coverage might still not be possible, though ๐Ÿฅบ

4.2. Testing LSPs That Are Used to Carry MPLS Payloads ๐Ÿ’œ

To detect certain LSP breakages, it may be necessary to encapsulate an MPLS echo request packet with at least one additional label when testing LSPs that carry MPLS payloads (such as LSPs used to carry L2VPN and L3VPN traffic). For example, when testing LDP or RSVP-TE LSPs, just sending an MPLS echo request packet may not catch cases where the router immediately upstream of the LSP's destination forwards the MPLS echo request successfully over an interface that isn't configured to carry MPLS payloads, because of penultimate hop popping ๐Ÿ˜ณ The receiving router has no way to tell whether the IP packet was sent unlabeled or implicitly labeled. So adding labels shimmed above the MPLS echo request (using the Nil FEC) stops a router from forwarding that packet out to unlabeled interfaces ๐Ÿ”’

4.3. Sending an MPLS Echo Request ๐Ÿš€

An MPLS echo request is a UDP packet ๐ŸŽ€ The IP header is set up like this: the source IP address is a routable address of the sender. The destination IP address is a (randomly chosen) IPv4 address from the range 127/8, or an IPv6 address from the range 0:0:0:0:0:FFFF:7F00:0/104. The IP TTL is set to 1. The source UDP port is chosen by the sender, and the destination UDP port is set to 3503 (assigned by IANA for MPLS echo requests). The Router Alert IP Option of value 0x0 [RFC2113] for IPv4, or value 69 [RFC7506] for IPv6, MUST be set in the IP header ๐Ÿšจ

An MPLS echo request is sent with a label stack that corresponds to the FEC Stack being tested. Further labels could be applied if, for example, the normal route to the topmost FEC in the stack goes through a Traffic Engineered Tunnel [RFC3209] ๐ŸŒˆ If all of the FECs in the stack correspond to Implicit Null labels, the MPLS echo request is considered unlabeled, even if further labels get applied when the packet is sent ๐Ÿง

If the echo request is labeled, one MAY (depending on what is being pinged) set the TTL of the innermost label to 1, so the ping request doesn't go farther than it should ๐Ÿ’… Examples of where this SHOULD be done include pinging a VPN IPv4 or IPv6 prefix, an L2 VPN endpoint, or a pseudowire. Keeping the ping request from going too far can also be done by inserting a Router Alert label above this label. But that may have the undesired side effect that MPLS echo requests take a different data path than actual data does ๐Ÿ˜ฌ For more on how these mechanisms can be used for pseudowire connectivity verification, see [RFC5085][RFC5885] ๐Ÿฆ‹

In "ping" mode (end-to-end connectivity check), the TTL in the outermost label is set to 255. In "traceroute" mode (fault isolation mode), the TTL is set successively to 1, 2, and so on ๐Ÿ”

The sender picks a Sender's Handle and a Sequence Number โœจ When sending subsequent MPLS echo requests, the sender SHOULD increment the Sequence Number by 1. However, a sender MAY choose to send a group of echo requests with the same Sequence Number, which improves the chance that at least one packet with that Sequence Number arrives ๐Ÿซง

The TimeStamp Sent is set to the time of day, in NTP format, when the echo request is sent. The TimeStamp Received is set to zero ๐Ÿ•ฐ๏ธ

An MPLS echo request MUST have a FEC Stack TLV ๐Ÿ‘‘ Also, the Reply Mode must be set to the desired Reply Mode, and the Return Code and Subcode are set to zero. In "traceroute" mode, the echo request SHOULD include a Downstream Detailed Mapping TLV ๐ŸŒธ

4.4. Receiving an MPLS Echo Request โœจ

okay bestie, this is where the receiving router gets its moment ๐Ÿ’… Sending an MPLS echo request to the control plane gets triggered by one of these packet processing exceptions: the Router Alert option, IP TTL expiration, MPLS TTL expiration, the MPLS Router Alert label, or a destination address in the 127/8 range. The control plane then picks it out by UDP destination port 3503 ๐ŸŽ€

For reporting purposes, the bottom of the stack counts as a stack-depth of 1 ๐Ÿฆ‹ That gives us one absolute reference point, which matters when the actual stack has more labels than there are FECs in the Target FEC Stack.

Also, in all the Return Codes in this document, a stack-depth of 0 means "no value specified" ๐ŸŒธ That keeps things working with existing implementations that don't use the Return Subcode field, so nobody gets left out ๐Ÿซถ

Okay, so LSR X handles the incoming echo request like this:

Step 1. General packet sanity ๐Ÿ”

First, the packet gets checked. If it's not well-formed, LSR X SHOULD send an MPLS echo reply with the Return Code set to "Malformed echo request received" and the Subcode set to zero. If there are any TLVs that aren't marked as "Ignore" (so the TLV type is less than 32768, see Section 3) and LSR X doesn't understand them, LSR X SHOULD send an MPLS "TLV not understood" (as appropriate) and set the Subcode to zero. In that second case, only the misunderstood TLVs get included, as sub-TLVs inside an Errored TLVs TLV in the reply. The header field's Sender's Handle, Sequence Number, and Timestamp Sent aren't examined, but they still get copied into the MPLS echo reply message ๐Ÿ’–

The algorithm works with these variables and identifiers ๐Ÿงš

Interface-I:        the interface on which the MPLS echo request was
                    received.

Stack-R:            the label stack on the packet as it was received.

Stack-D:            the label stack carried in the "Label stack
                    sub-TLV" in the Downstream Detailed Mapping TLV
                    (not always present).

Label-L:            the label from the actual stack currently being
                    examined.  Requires no initialization.

Label-stack-depth:  the depth of the label being verified.
                    Initialized to the number of labels in the
                    received label stack S.

FEC-stack-depth:    depth of the FEC in the Target FEC Stack that
                    should be used to verify the current actual
                    label.  Requires no initialization.

Best-return-code:   contains the Return Code for the echo reply
                    packet as currently best known.  As the algorithm
                    progresses, this code may change depending on the
                    results of further checks that it performs.

Best-rtn-subcode:   similar to Best-return-code, but for the echo
                    reply Subcode.

FEC-status:         result value returned by the FEC Checking
                    algorithm described in Section 4.4.1.

Step 2. Save receive context ๐Ÿ’พ

If the echo request is good, LSR X saves the interface it came in on into Interface-I, and the label stack it arrived with into Stack-R. Now we've got our context locked in ๐Ÿ”’

The rest of the algorithm loops over the labels in Stack-R. It checks that the label values are valid, reports the label switching operations (that's what makes traceroute work ๐Ÿ—บ๏ธ), checks that Stack-R lines up with the Target FEC Stack in the body of the echo request, and reports any errors it finds โœจ

/* Save receive context information */

/* The rest of the algorithm iterates over the labels in Stack-R,
verifies validity of label values, reports associated label switching
operations (for traceroute), verifies correspondence between the
Stack-R and the Target FEC Stack description in the body of the echo
request, and reports any errors. */

/* The algorithm iterates as follows. */

Step 3. Label Validation ๐Ÿท๏ธ

This step checks each label. If Label-stack-depth is 0, the LSR has to announce that it's the tail end of the LSP ๐Ÿ‘‘ Otherwise, it looks up the label in the Incoming Label Map (ILM). If there's no entry for that label, that's a label synchronization problem (temporary or permanent), so it reports an error. If there is an entry, it grabs the label operation from the matching Next Hop Label Forwarding Entry (NHLFE) and moves on to step 4. The pseudocode assumes there's always an entry for the well-known label values, so that part is always covered ๐Ÿ™Œ

Label Validation:

If Label-stack-depth is 0 {

/* The LSR needs to report that it is a tail end for the LSP */

   Set FEC-stack-depth to 1, set Label-L to 3 (Implicit Null).
   Set Best-return-code to 3 ("Replying router is an egress for
   the FEC at stack-depth"), set Best-rtn-subcode to the value of
   FEC-stack-depth (1), and go to step 5 (Egress Processing).

}

/* This step assumes there is always an entry for well-known label
values */
Set Label-L to the value extracted from Stack-R at depth
Label-stack-depth.  Look up Label-L in the Incoming Label Map
(ILM) to determine if the label has been allocated and an
operation is associated with it.

If there is no entry for Label-L {

/* Indicates a temporary or permanent label synchronization
problem, and the LSR needs to report an error */

   Set Best-return-code to 11 ("No label entry at stack-depth")
   and Best-rtn-subcode to Label-stack-depth.  Go to step 7 (Send
   Reply Packet).

}

Else {

   Retrieve the associated label operation from the corresponding
   Next Hop Label Forwarding Entry (NHLFE), and proceed to step 4
   (Label Operation Check).

}

Step 4. Label Operation Check ๐Ÿ”Ž

Now we check what the label operation actually is. If it's "Pop and Continue Processing" (that covers the Explicit Null and Router Alert label cases ๐Ÿ’–), we just move to the next label and loop back to step 3.

If it's "Swap or Pop and Switch based on Popped Label", that's transit switching, so Best-return-code gets set to 8 and Best-rtn-subcode gets the Label-stack-depth. Then there are a few more checks. If there's a Downstream Detailed Mapping TLV in the request, and its IP address is 127.0.0.1 or 0::1, Best-return-code becomes 6 ("Upstream Interface Index Unknown"). Otherwise, the LSR checks that the IP address, interface address, and label stack in that TLV match Interface-I and Stack-R. If they don't match, Best-return-code is set to 5, "Downstream Mapping Mismatch", and the procedure heads straight to step 7 ๐Ÿ˜ฌ

Next up, the LSR goes through each available downstream ECMP path. For each one it grabs the output interface from the NHLFE entry. If that interface isn't MPLS enabled, Best-return-code becomes 9 and the procedure jumps to step 7. A Downstream Detailed Mapping TLV can also get filled in with info about the current ECMP path ๐ŸŒˆ

If there's no Downstream Detailed Mapping TLV, or the Downstream IP Address is the ALLROUTERS multicast address, we go straight to step 7. Same deal if the "Validate FEC Stack" flag isn't set and the LSR isn't configured to do FEC checking by default. Otherwise, the Target FEC Stack gets validated, starting with working out FEC-stack-depth from the Downstream Detailed Mapping TLV โญ

Label Operation Check

If the label operation is "Pop and Continue Processing" {

/* Includes Explicit Null and Router Alert label cases */

   Iterate to the next label by decrementing Label-stack-depth,
   and loop back to step 3 (Label Validation).

}

If the label operation is "Swap or Pop and Switch based on Popped
Label" {

   Set Best-return-code to 8 ("Label switched at stack-depth") and
   Best-rtn-subcode to Label-stack-depth to report transit
   switching.

   If a Downstream Detailed Mapping TLV is present in the received
   echo request {

      If the IP address in the TLV is 127.0.0.1 or 0::1 {

         Set Best-return-code to 6 ("Upstream Interface Index
         Unknown").  An Interface and Label Stack TLV SHOULD be
         included in the reply and filled with Interface-I and
         Stack-R.

      }

      Else {

         Verify that the IP address, interface address, and label
         stack in the Downstream Detailed Mapping TLV match
         Interface-I and Stack-R.  If there is a mismatch, set
         Best-return-code to 5, "Downstream Mapping Mismatch".  An
         Interface and Label Stack TLV SHOULD be included in the
         reply and filled in based on Interface-I and Stack-R.  Go
         to step 7 (Send Reply Packet).

      }

   }

   For each available downstream ECMP path {

      Retrieve output interface from the NHLFE entry.

      /* Note: this Return Code is set even if Label-stack-depth
      is one */

      If the output interface is not MPLS enabled {

         Set Best-return-code to Return Code 9, "Label switched
         but no MPLS forwarding at stack-depth" and set
         Best-rtn-subcode to Label-stack-depth and go to step 7
         (Send Reply Packet).

      }

      If a Downstream Detailed Mapping TLV is present {

         A Downstream Detailed Mapping TLV SHOULD be included in
         the echo reply (see Section 3.4) filled in with
         information about the current ECMP path.

      }

   }
   If no Downstream Detailed Mapping TLV is present, or the
   Downstream IP Address is set to the ALLROUTERS multicast
   address, go to step 7 (Send Reply Packet).

   If the "Validate FEC Stack" flag is not set and the LSR is not
   configured to perform FEC checking by default, go to step 7
   (Send Reply Packet).

   /* Validate the Target FEC Stack in the received echo request.

   First determine FEC-stack-depth from the Downstream Detailed
   Mapping TLV.  This is done by walking through Stack-D (the
   Downstream labels) from the bottom, decrementing the number of
   labels for each non-Implicit Null label, while incrementing
   FEC-stack-depth for each label.  If the Downstream Detailed
   Mapping TLV contains one or more Implicit Null labels,
   FEC-stack-depth may be greater than Label-stack-depth.  To be
   consistent with the above stack-depths, the bottom is
   considered to be entry 1.
   */

   Set FEC-stack-depth to 0.  Set i to Label-stack-depth.

   While (i > 0) do {

       ++FEC-stack-depth.
       if Stack-D [ FEC-stack-depth ] != 3 (Implicit Null)
       --i.
   }

   If the number of FECs in the FEC stack is greater than or equal
   to FEC-stack-depth {
   Perform the FEC Checking procedure (see Section 4.4.1).

      If FEC-status is 2, set Best-return-code to 10 ("Mapping for
      this FEC is not the given label at stack-depth").

      If the Return Code is 1, set Best-return-code to
      FEC-return-code and Best-rtn-subcode to FEC-stack-depth.
   }

   Go to step 7 (Send Reply Packet).
}

Step 5. Egress Processing ๐ŸŒŸ

This step is for the LSR that announced itself as the tail-end LSR for an LSP. If the echo request has no Downstream Detailed Mapping TLV, or its Downstream IP Address is 127.0.0.1 or 0::1, we skip ahead to step 6. Otherwise, the LSR checks that the IP address, interface address, and label stack in the Downstream Detailed Mapping TLV match Interface-I and Stack-R. If they don't, Best-return-code is set to 5, "Downstream Mapping Mismatch", and a Received Interface and Label Stack TLV gets created for the echo response packet before jumping to step 7 ๐Ÿซถ

Egress Processing:

/* These steps are performed by the LSR that identified itself as
the tail-end LSR for an LSP. */

If the received echo request contains no Downstream Detailed
Mapping TLV, or the Downstream IP Address is set to 127.0.0.1 or
0::1, go to step 6 (Egress FEC Validation).

Verify that the IP address, interface address, and label stack in
the Downstream Detailed Mapping TLV match Interface-I and Stack-R.
If not, set Best-return-code to 5, "Downstream Mapping Mismatch".
A Received Interface and Label Stack TLV SHOULD be created for the
echo response packet.  Go to step 7 (Send Reply Packet).

Step 6. Egress FEC Validation ๐Ÿ’œ

This is a loop over every entry in the Target FEC Stack, starting at FEC-stack-depth. For each one, the LSR runs the FEC checking algorithm from Section 4.4.1 for Label-L and the FEC at FEC-stack-depth, and then sets Best-return-code to FEC-code and Best-rtn-subcode to the FEC-stack-depth. If FEC-status comes back as 1, we're done and it's straight to step 7. Otherwise, FEC-stack-depth goes up by one. If that goes past the number of FECs, we're done too. If FEC-status is 0, Label-stack-depth goes up by one (and if that goes past the number of labels in Stack-R, we're done), Label-L gets pulled from Stack-R at that new depth, and we loop back to the top of step 6 ๐Ÿ”

Egress FEC Validation:

/* This is a loop for all entries in the Target FEC Stack starting
with FEC-stack-depth. */

Perform FEC checking by following the algorithm described in
Section 4.4.1 for Label-L and the FEC at FEC-stack-depth.

Set Best-return-code to FEC-code and Best-rtn-subcode to the value
in FEC-stack-depth.


If FEC-status (the result of the check) is 1,
go to step 7 (Send Reply Packet).

/* Iterate to the next FEC entry */


++FEC-stack-depth.
If FEC-stack-depth > the number of FECs in the FEC-stack,
go to step 7 (Send Reply Packet).

If FEC-status is 0 {

   ++Label-stack-depth.
   If Label-stack-depth > the number of labels in Stack-R,
   go to step 7 (Send Reply Packet).

   Label-L = extracted label from Stack-R at depth
   Label-stack-depth.
   Loop back to step 6 (Egress FEC Validation).
}

Step 7. Send Reply Packet ๐Ÿ“ฎ

Last step, and it's the big finish ๐ŸŽ‰ The LSR sends an MPLS echo reply with a Return Code of Best-return-code and a Return Subcode of Best-rtn-subcode. It also includes any TLVs that got created along the way. The procedures for actually sending the echo reply are in Section 4.5 ๐Ÿ’–

Send Reply Packet:

Send an MPLS echo reply with a Return Code of Best-return-code and
a Return Subcode of Best-rtn-subcode.  Include any TLVs created
during the above process.  The procedures for sending the echo
reply are found in Section 4.5.

Okay bestie, picking up right where we left off, and this part is juicy ๐Ÿซถ We're deep in the FEC validation weeds now, and I promise it's giving detective energy ๐Ÿ•ต๏ธโ€โ™€๏ธโœจ

Reminder: this is the bit where the replier checks whether the FEC makes sense ๐Ÿ’…


4.4.1. FEC Validation

okay so this section explains how a replier validates one entry in the Target FEC Stack. It takes in a FEC, a Label-L, and an Interface-I to work with ๐Ÿ’–

/* This section describes validation of a FEC entry within the Target
FEC Stack and accepts a FEC, Label-L, and Interface-I.

If the outermost FEC of the Target FEC stack is the Nil FEC, then the
node MUST skip the Target FEC validation completely.  This is to
support FEC hiding, in which the outer hidden FEC can be the Nil FEC.
Else, the algorithm performs the following steps. */

Bestie, the first thing to know is the Nil FEC glow-up ๐ŸŒธ If the outermost FEC of the Target FEC stack is the Nil FEC, the node MUST skip Target FEC validation completely. That's how FEC hiding works, since the hidden outer FEC can be the Nil FEC ๐Ÿ™ˆ Otherwise, you run through the steps below ๐Ÿฆ‹

  1. Two return values, FEC-status and FEC-return-code, get initialized to 0 โœจ
  2. If the FEC is the Nil FEC {

If Label-L is either Explicit_Null or Router_Alert, return.

Else {

Set FEC-return-code to 10 ("Mapping for this FEC is not the given label at stack-depth"). Set FEC-status to 1. Return. }

}

  1. Next up, check the FEC label mapping that describes how traffic received on the LSP is further switched or which application it is associated with ๐Ÿ‘€ If no mapping exists, set FEC-return-code to 4, "Replying router has no mapping for the FEC at stack-depth". Set FEC-status to 1. Return. Rip ๐Ÿ’€
  2. If the label mapping for FEC is Implicit Null, set FEC-status to 2 and proceed to step 5. Otherwise, if the label mapping for FEC is Label-L, proceed to step 5. Otherwise, set FEC-return-code to 10 ("Mapping for this FEC is not the given label at stack-depth"), set FEC-status to 1, and return. Main character energy is knowing exactly which branch you're on ๐Ÿ’œ
  3. This is a protocol check ๐Ÿง Check what protocol would be used to advertise the FEC. If it can be determined that no protocol associated with Interface-I would have advertised a FEC of that FEC-Type, set FEC-return-code to 12 ("Protocol not associated with interface at FEC stack-depth"). Set FEC-status to 1.
  4. Return. And that's the whole validation ๐ŸŽ€

4.5. Sending an MPLS Echo Reply

Okay, this is where the replier actually sends the response back ๐Ÿซถ An MPLS echo reply is a UDP packet. It MUST ONLY be sent in response to an MPLS echo request ๐Ÿ’… The source IP address is a routable address of the replier, and the source port is the well-known UDP port for LSP ping. The destination IP address and UDP port get copied from the source IP address and UDP port of the echo request. The IP TTL is set to 255 ๐ŸŒˆ If the Reply Mode in the echo request is "Reply via an IPv4 UDP packet with Router Alert", then the IP header MUST contain the Router Alert IP Option of value 0x0 [RFC2113] for IPv4 or 69 [RFC7506] for IPv6. If the reply is sent over an LSP, the topmost label MUST in this case be the Router Alert label (1) (see [RFC3032]).

The format of the echo reply is the same as the echo request โœจ The Sender's Handle, the Sequence Number, and TimeStamp Sent are copied from the echo request. The TimeStamp Received is set to the time of day that the echo request is received. (Note: this info is most useful if the time-of-day clocks on the requester and the replier are synchronized ๐Ÿ•ฐ๏ธ) The FEC Stack TLV from the echo request MAY be copied to the reply.

The replier MUST fill in the Return Code and Subcode, as determined in the previous section ๐Ÿ“

If the echo request contains a Pad TLV, the replier MUST interpret the first octet for instructions regarding how to reply ๐Ÿงš

If the replying router is the destination of the FEC, then Downstream Detailed Mapping TLVs SHOULD NOT be included in the echo reply ๐Ÿ™…โ€โ™€๏ธ

If the echo request contains a Downstream Detailed Mapping TLV, and the replying router is not the destination of the FEC, the replier SHOULD compute its downstream routers and corresponding labels for the incoming label and add Downstream Detailed Mapping TLVs for each one to the echo reply it sends back. A replying node should follow the procedures defined in Section 4.5.1 if there is a FEC stack change due to tunneled LSP. If the FEC stack change is due to stitched LSP, it should follow the procedures defined in Section 4.5.2 ๐Ÿ’–

If the Downstream Detailed Mapping TLV contains Multipath Information requiring more processing than the receiving router is willing to perform, the responding router MAY choose to respond with only a subset of multipaths contained in the echo request Downstream Detailed Mapping. (Note: The originator of the echo request MAY send another echo request with the Multipath Information that was not included in the reply.) Multipath juggling, but make it polite ๐Ÿค

Except in the case of Reply Mode 4, "Reply via application-level control channel", echo replies are always sent in the context of the IP/MPLS network ๐ŸŒ


4.5.1. Addition of a New Tunnel

Okay bestie, this is the tunnel glow-up section ๐Ÿš‡โœจ A transit node knows when the FEC being traced is going to enter a tunnel at that node. Thus, it knows about the new outer FEC. All transit nodes that are the origination point of a new tunnel SHOULD add the FEC stack change sub-TLV (Section 3.4.1.3) to the Downstream Detailed Mapping TLV in the echo reply. The transit node SHOULD add one FEC stack change sub-TLV of operation type PUSH, per new tunnel being originated at the transit node.

A transit node that sends a Downstream FEC stack change sub-TLV in the echo reply SHOULD fill the address of the remote peer, which is the peer of the current LSP being traced. If the transit node does not know the address of the remote peer, it MUST set the address type to Unspecified.

The Label Stack sub-TLV MUST contain one additional label per FEC being PUSHed. The label MUST be encoded as defined in Section 3.4.1.2. The label value MUST be the value used to switch the data traffic. If the tunnel is a transparent pipe to the node, i.e., the data-plane trace will not expire in the middle of the new tunnel, then a FEC stack change sub-TLV SHOULD NOT be added, and the Label Stack sub-TLV SHOULD NOT contain a label corresponding to the hidden tunnel ๐Ÿซฃ

If the transit node wishes to hide the nature of the tunnel from the ingress of the echo request, then it MAY not want to send details about the new tunnel FEC to the ingress. In such a case, the transit node SHOULD use the Nil FEC. The echo reply would then contain a FEC stack change sub-TLV with operation type PUSH and a Nil FEC. The value of the label in the Nil FEC MUST be set to zero. The remote peer address type MUST be set to Unspecified. The transit node SHOULD add one FEC stack change sub-TLV of operation type PUSH, per new tunnel being originated at the transit node. The Label Stack sub-TLV MUST contain one additional label per FEC being PUSHed. The label value MUST be the value used to switch the data traffic. Hidden tunnel, zero drama ๐ŸŒˆ๐Ÿ”’


4.5.2. Transition between Tunnels

Okay, stitching time ๐Ÿงต A transit node stitching two LSPs SHOULD include two FEC stack change sub-TLVs. One with a pop operation for the old FEC (ingress) and one with the PUSH operation for the new FEC (egress). The replying node SHOULD set the Return Code to "Label switched with FEC change" to indicate change in the FEC being traced ๐Ÿ’œ

If the replying node wishes to perform FEC hiding, it SHOULD respond back with two FEC stack change sub-TLVs, one pop followed by one PUSH. The pop operation MAY either exclude the FEC TLV (by setting the FEC TLV length to 0) or set the FEC TLV to contain the LDP FEC. The PUSH operation SHOULD have the FEC TLV containing the Nil FEC. The Return Code SHOULD be set to "Label switched with FEC change" โœจ

If the replying node wishes to perform FEC hiding, it MAY choose to not send any FEC stack change sub-TLVs in the echo reply if the number of labels does not change for the downstream node and the FEC type also does not change (Nil FEC). In such case, the replying node MUST NOT set the Return Code to "Label switched with FEC change" ๐Ÿ™ƒ


Next up is part 13, so keep your phone charged, bestie ๐Ÿ”‹๐Ÿ’–

4.6. Receiving an MPLS Echo Reply ๐Ÿ’Œ

okay bestie, an LSR X should only ever get an MPLS echo reply back for an MPLS echo request that X actually sent ๐Ÿซถ so when a reply shows up, X should first parse it to make sure it's well-formed ๐Ÿง. then X tries to match it with one of its earlier echo requests, using the destination UDP port and the Sender's Handle. no match? X jettisons the echo reply ๐Ÿ—‘๏ธ bye bye. if there is a match, X checks whether the Sequence Number lines up too ๐Ÿ’….

If the echo reply has Downstream Detailed Mappings and X wants to traceroute further, X SHOULD copy the Downstream Detailed Mapping(s) into its next echo request(s), with the TTL incremented by one ๐Ÿฆ‹.

If one or more FEC stack change sub-TLVs show up in the MPLS echo reply, the ingress node SHOULD process them and do some validation โœจ.

The FEC stack changes belong to a downstream neighbor and to one particular path of the LSP ๐Ÿ›ค๏ธ. that means the ingress has to keep a FEC stack for each path it's tracing (hello, multipath ๐ŸŒˆ). every change from a FEC stack change sub-TLV should only be applied to the path for that downstream neighbor. here's the algorithm the ingress should follow when it processes those sub-TLVs:

       push_seen = FALSE
       fec_stack_depth = current-depth-of-fec-stack-being-traced
       saved_fec_stack = current_fec_stack

       while (sub-tlv = get_next_sub_tlv(downstream_detailed_map_tlv))

           if (sub-tlv == NULL) break

           if (sub-tlv.type == FEC-Stack-Change) {

               if (sub-tlv.operation == POP) {
                   if (push_seen) {
                       Drop the echo reply
                       current_fec_stack = saved_fec_stack
                       return
                   }

                   if (fec_stack_depth == 0) {
                       Drop the echo reply
                       current_fec_stack = saved_fec_stack
                       return
                   }

                   Pop FEC from FEC stack being traced
                   fec_stack_depth--;
               }

               if (sub-tlv.operation == PUSH) {
                   push_seen = 1
                   Push FEC on FEC stack being traced
                   fec_stack_depth++;
               }
            }
        }


        if (fec_stack_depth == 0) {
            Drop the echo reply
            current_fec_stack = saved_fec_stack
            return
        }

The next MPLS echo request along the same path should use the modified FEC stack that comes out of processing those sub-TLVs ๐ŸŽฏ. a non-Nil FEC guarantees that the next echo request on that path gets its Downstream Detailed Mapping TLV validated for IP address, interface address, and label stack mismatches ๐Ÿ”โœจ.

โš ๏ธ bestie, here's the tea: if the top of the FEC stack is a Nil FEC and the echo reply has no FEC stack change sub-TLVs, that does not automatically mean the LSP is still on the same tunnel ๐Ÿ™ˆ. the LSP tied to that Nil FEC could have ended at a transit node while a brand new LSP started at that same node. the Nil FEC would now point at the new LSP, and the ingress has no way to know. so you can't build an accurate hierarchical LSP topology if a traceroute has Nil FECs ๐Ÿ’€.

A reply from a downstream node with Return Code 3 might not be for the FEC being traced ๐Ÿ˜ฌ. it could be for one of the new FECs that got added. when the LSP ingress gets an IS_EGRESS reply, it should check whether the depth of the Target FEC it sent to that node matches the depth of the FEC being traced. if it doesn't, the ingress should pop an entry off the Target FEC stack and resend the request with the same TTL it used before. keep popping until the ingress gets a non-IS_EGRESS reply, or until all the extra FECs have been popped ๐Ÿซง. using IS_EGRESS replies, an ingress can map out the hierarchical LSP structure a given FEC goes through ๐Ÿ—บ๏ธ.

When the MPLS echo reply Return Code is "Label switched with FEC change", the ingress node SHOULD manipulate the FEC stack according to the FEC stack change sub-TLVs in the Downstream Detailed Mapping TLV ๐Ÿ”ฅ. a transit node can use this Return Code for stitched LSPs and for hierarchical LSPs. with ECMP or P2MP there could be several paths, and Downstream Detailed Mapping TLVs with different Return Codes (see Section 3.1, Note 2) ๐ŸŒธ. the ingress should build the topology based on the Return Code for each ECMP path or P2MP branch ๐Ÿฆ‹.


4.7. Issue with VPN IPv4 and IPv6 Prefixes ๐ŸŽ€

okay so a ping for a VPN IPv4 prefix or VPN IPv6 prefix usually goes out with a label stack deeper than 1, and the innermost label has a TTL of 1 ๐Ÿงธ. the whole point is to end the ping at the egress PE before it gets to the customer device ๐Ÿ›‘.

but here's the plot twist ๐Ÿ˜ญ: under certain circumstances the label stack can shrink down to a single label before the ping reaches the egress PE. then the ping ends too early, and that's a real problem ๐Ÿ’”. one example of this is a multi-AS Carrier's Carrier VPN ๐ŸŒ.

so to get around it, one approach is for the LSR that receives the ping to realize it ended prematurely and send back Return Code 13 ๐Ÿ™Œ. then the initiating LSR can retry the ping after bumping the TTL on the VPN label. the ingress basically keeps going through TTL values until one of them gets the VPN ping all the way to the egress PE ๐Ÿ’–โœจ.


4.8. Non-compliant Routers ๐Ÿ™ˆ

if the egress for the FEC Stack being pinged doesn't support LSP ping, no reply comes back, and you get possible "false negatives" ๐Ÿ’€. in "traceroute" mode, if a transit LSR doesn't support LSP ping, it won't reply for some TTL, let's call it n ๐Ÿซ .

so the LSR that sent the echo request SHOULD try sending it with TTL=n+1, n+2, ..., n+k to probe the LSRs further down the path ๐Ÿงš. and for TTL > n, the echo request SHOULD be sent with the Downstream Detailed Mapping TLV's "Downstream IP Address" field set to the ALLROUTERs multicast address. it keeps doing that until a reply comes back with a Downstream Detailed Mapping TLV ๐ŸŒˆ. the Label Stack TLV MAY be left out of the Downstream Detailed Mapping TLV ๐Ÿ“. and the "Validate FEC Stack" flag SHOULD NOT be set until an echo reply packet with a Downstream Detailed Mapping TLV shows up ๐Ÿซถ.


5. Security Considerations ๐Ÿ”

okay security time, and honestly it's serious ๐Ÿ˜ค. overall, LSP ping's security needs are pretty similar to ICMP ping's ๐Ÿง.

there are at least three ways someone could attack LSRs with these mechanisms ๐Ÿšจ. the first is a Denial-of-Service (DoS) attack, where someone floods LSRs with MPLS echo requests and replies to pile on their workload ๐Ÿ“ˆ. the second is hiding the real state of MPLS data-plane liveness by spoofing, hijacking, replaying, or otherwise messing with MPLS echo requests and replies ๐ŸŽญ. the third is an unauthorized source using an LSP ping to dig up information about the network ๐Ÿ•ต๏ธโ€โ™€๏ธ.

to avoid DoS attacks, it is RECOMMENDED that implementations regulate the LSP ping traffic that goes to the control plane ๐Ÿšฆ. a rate limiter SHOULD be applied to the well-known UDP port defined in Section 6.1 ๐ŸŽ€.

unsophisticated replay and spoofing attacks that fake or replay MPLS echo reply messages are unlikely to work ๐Ÿ™…โ€โ™€๏ธ. those replies have to match the Sender's Handle and Sequence Number of an outstanding MPLS echo request message. a replay that doesn't match gets discarded because the sequence has already moved on, so a spoof only has a tiny window to work with ๐ŸชŸ. but for a stronger defense, an implementation MAY also validate the TimeStamp Sent by requiring an exact match on that field ๐Ÿ’ช.

to protect against unauthorized sources using MPLS echo request messages to get network information, it is RECOMMENDED that implementations provide a way to check the source addresses of MPLS echo request messages against an access list before accepting the message ๐Ÿ”’.

it's not clear how to prevent hijacking (non-delivery) of echo requests or replies ๐Ÿ˜ฉ. but if these messages do get hijacked, LSP ping will report that the data plane isn't working the way it should ๐Ÿšฉ.

it doesn't seem vital (at this point) to secure the data carried in MPLS echo requests and replies ๐Ÿคทโ€โ™€๏ธ. some people do consider knowledge of the MPLS data-plane state confidential, though. implementations SHOULD, however, provide a way to filter the addresses that echo reply messages may be sent to ๐Ÿ›ก๏ธ.

the value part of the Pad TLV holds a variable number of octets. apart from the first octet, the contents (if there are any) are ignored on receipt, so they can work as a clandestine channel ๐Ÿ‘€๐Ÿซฃ.

when MPLS LSP ping is used inside an administrative domain, a deployment can get extra security by using border filtering on both incoming and outgoing LSP ping packets ๐Ÿฐ.

this document makes special use of 127/8 addresses, but only together with UDP port 3503 ๐Ÿ’…. and only routers process these packets. all other hosts MUST treat all packets with a destination address in the range 127/8 in accordance to RFC 1122. any packet a router receives with a destination address in 127/8 and a destination UDP port other than 3503 MUST be treated in accordance to RFC 1812. by default, packets headed to a 127/8 address get treated as "martians" ๐Ÿ‘ฝ.

if a network operator wants to stop tracing inside a tunnel, they can use the Pipe Model [RFC3443] ๐ŸงŠ. that means hiding the outer MPLS tunnel by not copying the MPLS TTL into the outer tunnel (at the start of the outer tunnel). with that setup, LSP traceroute packets won't expire inside the outer tunnel, so the outer tunnel won't get traced ๐Ÿ™ˆ.

and if someone doesn't want to expose the details of a new outer LSP, the Nil FEC can hide them ๐Ÿซฅ. using the Nil FEC keeps the trace moving without false negatives, and all transit nodes of the new outer tunnel do some minimal validation on the MPLS echo requests they receive ๐Ÿงšโ€โ™€๏ธ๐Ÿ’œ.


6. IANA Considerations ๐Ÿ“‹

6.1. TCP and UDP Port Number ๐Ÿ”Œ

the TCP and UDP port number 3503 has been allocated by IANA for LSP echo requests and replies ๐ŸŽ‰๐Ÿ‘‘.

6.2. MPLS LSP Ping Parameters โœจ

okay so this is the part where IANA gets its registry glow-up ๐Ÿ’… IANA keeps the "Multiprotocol Label Switching (MPLS) Label Switched Paths (LSPs) Ping Parameters" registry over at [IANA-MPLS-LSP-PING] ๐ŸŽ€

The subsections below walk through all the name spaces IANA manages. Some of these name spaces get split into assignment ranges, and the procedures IANA uses to hand out values use these terms: "Standards Action" (as defined in [RFC5226]), "Specification Required", and "Vendor Private Use" ๐Ÿฆ‹

Values from "Specification Required" ranges MUST be registered with IANA ๐Ÿ’– The request MUST be made via an RFC that describes the format and procedures for using the code point, and the actual assignment happens during the IANA actions for that RFC ๐ŸŒธ

Values from "Vendor Private" ranges MUST NOT be registered with IANA ๐Ÿ™ˆ BUT the message MUST still contain an enterprise code registered with the IANA SMI Private Network Management Private Enterprise Numbers ๐Ÿซถ For every name space with a Vendor Private range, it must be specified exactly where the SMI Private Enterprise Number lives, and there are examples below ๐Ÿงš This is how several enterprises (vendors) can use the same code point without any collision drama โœจ

6.2.1. Message Types, Reply Modes, Return Codes ๐Ÿ“

IANA has created and will maintain registries for Message Types, Reply Modes, and Return Codes ๐Ÿ’… Each of these can take values in the range 0-255 ๐ŸŒˆ Assignments in the range 0-191 are made via Standards Action, assignments in the range 192-251 are made via "Specification Required", and values in the range 252-255 are for Vendor Private Use and MUST NOT be allocated ๐Ÿ’€

If any of these fields fall in the Vendor Private range, a top-level Vendor Enterprise Number TLV MUST be present in the message ๐Ÿ”ฅ

Message Types defined in this document:

   Value    Meaning
   -----    -------
       1    MPLS Echo Request
       2    MPLS Echo Reply

Reply Modes defined in this document:

   Value    Meaning
   -----    -------
       1    Do not reply
       2    Reply via an IPv4/IPv6 UDP packet
       3    Reply via an IPv4/IPv6 UDP packet with Router Alert
       4    Reply via application-level control channel

Return Codes defined in this document are listed in Section 3.1 ๐Ÿ‘‘

IANA has updated the reference for each of these values to this document โœจ

6.2.2. TLVs ๐Ÿฆ‹

IANA has created and maintains a registry for the Type field of top-level TLVs, as well as for any associated sub-TLVs ๐Ÿ’œ Note that the meaning of a sub-TLV is scoped by the TLV, so the number spaces for the sub-TLVs of various TLVs are independent ๐Ÿซถ

The valid range for TLVs and sub-TLVs is 0-65535 ๐ŸŒธ Assignments in the ranges 0-16383 and 32768-49161 are made via Standards Action as defined in [RFC5226], assignments in the ranges 16384-31743 and 49162-64511 are made via "Specification Required", and values in the ranges 31744-32767 and 64512-65535 are for Vendor Private Use and MUST NOT be allocated ๐Ÿ™ˆ

If a TLV or sub-TLV has a Type that falls in the range for Vendor Private Use, the Length MUST be at least 4, and the first four octets MUST be that vendor's SMI Private Enterprise Number, in network octet order ๐ŸŽ€ The rest of the Value field is private to the vendor ๐Ÿ”’

TLVs and sub-TLVs defined in this document:

   Type     Sub-Type        Value Field
   ----     --------        -----------
      1                     Target FEC Stack
                   1        LDP IPv4 prefix
                   2        LDP IPv6 prefix
                   3        RSVP IPv4 LSP
                   4        RSVP IPv6 LSP
                   5        Unassigned
                   6        VPN IPv4 prefix
                   7        VPN IPv6 prefix
                   8        L2 VPN endpoint
                   9        "FEC 128" Pseudowire - IPv4 (Deprecated)
                  10        "FEC 128" Pseudowire - IPv4
                  11        "FEC 129" Pseudowire -  IPv4
                  12        BGP labeled IPv4 prefix
                  13        BGP labeled IPv6 prefix
                  14        Generic IPv4 prefix
                  15        Generic IPv6 prefix
                  16        Nil FEC
                  24        "FEC 128" Pseudowire - IPv6
                  25        "FEC 129" Pseudowire - IPv6
      2                     Downstream Mapping (Deprecated)
      3                     Pad
      4                     Unassigned
      5                     Vendor Enterprise Number
      6                     Unassigned
      7                     Interface and Label Stack
      8                     Unassigned
      9                     Errored TLVs
           Any value        The TLV not understood
     10                     Reply TOS Byte
     20                     Downstream Detailed Mapping

IANA has updated the reference for each of these values to this document ๐Ÿ’–

6.2.3. Global Flags ๐ŸŒˆ

IANA has created a "Global Flags" subregistry of the "Multiprotocol Label Switching (MPLS) Label Switched Paths (LSPs) Ping Parameters" registry โœจ

This registry tracks the assignment of 16 flags in the Global Flags field of the MPLS LSP ping echo request message ๐Ÿงš The flags are numbered from 0 (most significant bit, transmitted first) to 15 ๐Ÿ’…

New entries are assigned by Standards Action ๐Ÿ”ฅ

Initial entries in the registry:

   Bit number  |  Name                      | Reference
   ------------+----------------------------+--------------
     15        |  V Flag                    | [RFC8029]
     14        |  T Flag                    | [RFC6425]
     13        |  R Flag                    | [RFC6426]
     12-0      |  Unassigned                | [RFC8029]

6.2.4. Downstream Detailed Mapping Address Type ๐Ÿ“

This document extends RFC 4379 by defining a new address type for use with the Downstream Mapping and Downstream Detailed Mapping TLVs ๐Ÿฆ‹ IANA has established a registry to assign address types for those TLVs, and it initially allocates the following assignments:

   Type #     Address Type      K Octets    Reference
   ------     ------------      --------    ---------
        1     IPv4 Numbered           16    [RFC8029]
        2     IPv4 Unnumbered         16    [RFC8029]
        3     IPv6 Numbered           40    [RFC8029]
        4     IPv6 Unnumbered         28    [RFC8029]
        5     Non IP                  12    [RFC6426]

          Downstream Detailed Mapping Address Type Registry

Because the field in this case is an 8-bit field, the allocation policy for this registry is "Standards Action" ๐Ÿ’œ

6.2.5. DS Flags ๐Ÿ’–

This document defines the Downstream Mapping (DSMAP) TLV and the Downstream Detailed Mapping (DDMAP) TLV, which have Type 2 and Type 20, respectively, assigned from the "TLVs" subregistry of the "Multiprotocol Label Switching (MPLS) Label Switched Paths (LSPs) Ping Parameters" registry ๐ŸŽ€

DSMAP has been deprecated by DDMAP, but both TLVs share a field: DS Flags ๐Ÿ™ˆ

IANA has created and now maintains a registry entitled "DS Flags" โœจ

The registration policy for this registry is Standards Action [RFC5226] ๐Ÿ”ฅ

IANA has made the following assignments:

    Bit Number Name                                         Reference
    ---------- -------------------------------------------  ---------
          7    N: Treat as a Non-IP Packet                  [RFC8029]
          6    I: Interface and Label Stack Object Request  [RFC8029]
          5    E: ELI/EL push indicator                     [RFC8012]
          4    L: Label-based load balance indicator        [RFC8012]
        3-0    Unassigned

6.2.6. Multipath Types ๐ŸŒธ

IANA has created and now maintains a registry entitled "Multipath Types" ๐Ÿงš

The registration policy [RFC5226] for this registry is Standards Action ๐Ÿ’…

IANA has made the following assignments:

    Value      Meaning                                  Reference
    ---------- ---------------------------------------- ---------
          0    no multipath                             [RFC8029]
          1    Unassigned
          2    IP address                               [RFC8029]
          3    Unassigned
          4    IP address range                         [RFC8029]
        5-7    Unassigned
          8    Bit-masked IP address set                [RFC8029]
          9    Bit-masked label set                     [RFC8029]
         10    IP and label set                         [RFC8012]
     11-250    Unassigned
    251-254    Reserved for Experimental Use            [RFC8029]
        255    Reserved                                 [RFC8029]

6.2.7. Pad Type ๐Ÿฆ‹

IANA has created and now maintains a registry entitled "Pad Types" ๐Ÿ‘‘

The registration policy [RFC5226] for this registry is Standards Action ๐Ÿ’œ

IANA has made the following initial assignments:

Registry Name: Pad Types

    Value      Meaning                                  Reference
    ---------- ---------------------------------------- ---------
          0    Reserved                                 [RFC8029]
          1    Drop Pad TLV from reply                  [RFC8029]
          2    Copy Pad TLV to reply                    [RFC8029]
      3-250    Unassigned
    251-254    Experimental Use                         [RFC8029]
        255    Reserved                                 [RFC8029]

6.2.8. Interface and Label Stack Address Type ๐Ÿซถ

IANA has created and now maintains a registry entitled "Interface and Label Stack Address Types" ๐ŸŒˆ

The registration policy [RFC5226] for this registry is Standards Action ๐Ÿ”ฅ

IANA has made the following initial assignments:

Registry Name: Interface and Label Stack Address Types

    Value      Meaning                                  Reference
    ---------- ---------------------------------------- ---------
          0    Reserved                                 [RFC8029]
          1    IPv4 Numbered                            [RFC8029]
          2    IPv4 Unnumbered                          [RFC8029]
          3    IPv6 Numbered                            [RFC8029]
          4    IPv6 Unnumbered                          [RFC8029]
      5-250    Unassigned
    251-254    Experimental Use                         [RFC8029]
        255    Reserved                                 [RFC8029]

6.3. IPv4 Special-Purpose Address Registry ๐Ÿงš

IANA has updated the reference in Note 1 of the "IANA IPv4 Special-Purpose Address Registry" [IANA-SPECIAL-IPv4] to point to this document โœจ


7. References ๐Ÿ“š

7.1. Normative References

7.2. Informative References

Appendix A. Deprecated TLVs and Sub-TLVs (Non-normative) ๐Ÿ•ฐ๏ธโœจ

Okay, bestie, this appendix is the vintage wardrobe ๐Ÿ‘— of the spec. Everything in here is deprecated, so it's non-normative for an implementation ๐Ÿ™…โ€โ™€๏ธ. It's only kept around for history and for info, so you can see where things came from. ๐Ÿ“œ๐Ÿ’œ

A.1. Target FEC Stack

A.1.1. FEC 128 Pseudowire - IPv4 (Deprecated)

Let's talk about FEC 128 (0x80) ๐ŸŒธ, which is defined in [RFC4447]. The terms PW ID (Pseudowire ID) and PW Type (Pseudowire Type) come from that same doc. A PW ID is a non-zero 32-bit connection ID ๐Ÿ”ข. The PW Type is a 15-bit number that tells you the encapsulation type. It sits right justified in the encapsulation type field, with the high-order bit set to zero ๐ŸŽ€. Both of these fields are treated as opaque values in this protocol, so nobody's poking inside them ๐Ÿ™ˆ.

When a FEC 128 gets encoded in a label stack, it looks like this. The Value field holds the Remote PE IPv4 Address (that's the destination address of the targeted LDP session), then the PW ID, then the encapsulation type ๐Ÿงš:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                      Remote PE IPv4 Address                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             PW ID                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |            PW Type            |          Must Be Zero         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
โš ๏ธ Heads up: this FEC is deprecated ๐Ÿชฆ. It's only kept around for backward compatibility, so it's giving "old phone you can't quite let go of" ๐Ÿ“ฑ๐Ÿ’€.

Here's the vibe for implementations ๐Ÿ’…. Implementations of LSP ping SHOULD accept and process this TLV, but they SHOULD send LSP ping echo requests with the new TLV (see Section 3.2.9) ๐Ÿซถ, unless they've been explicitly configured to use the old TLV. Main character move: be kind to old friends, but glow up your requests ๐Ÿฆ‹โœจ.

And on the receiving end ๐Ÿ‘€, an LSR that gets this TLV SHOULD use the source IP address of the LSP echo request to infer the sender's PE address. Detective energy, no cap ๐Ÿ•ต๏ธโ€โ™€๏ธ๐Ÿ”ฅ.

A.2. Downstream Mapping (Deprecated) ๐Ÿงš

Okay bestie, so the Downstream Mapping object is a TLV that MAY be included in an echo request message ๐Ÿ’–. Only one Downstream Mapping object may appear in an echo request, so just the one! Including it is basically asking for Downstream Mapping objects back in the echo reply โœจ. If the replying router is the destination of the FEC, then a Downstream Mapping TLV SHOULD NOT be included in the echo reply ๐Ÿ™ˆ.

Otherwise, the replying router SHOULD include a Downstream Mapping object for each interface over which this FEC could be forwarded ๐Ÿฆ‹. For a more precise definition of "downstream", see Section 3.4.2, "Downstream Router and Interface" ๐ŸŽ€.

The Length is K + M + 4*N octets, where M is the Multipath Length and N is the number of downstream labels. The values for K are in the Address Type section below. The Value field of a Downstream Mapping looks like this:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               MTU             | Address Type  |    DS Flags   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |             Downstream IP Address (4 or 16 octets)            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Downstream Interface Address (4 or 16 octets)         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Multipath Type| Depth Limit   |        Multipath Length       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                     (Multipath Information)                   .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Downstream Label                |    Protocol   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   .                                                               .
   .                                                               .
   .                                                               .
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               Downstream Label                |    Protocol   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Maximum Transmission Unit (MTU)

The MTU is the size in octets of the largest MPLS frame (including label stack) that fits on the interface to the downstream LSR ๐Ÿ“.

Address Type

The Address Type tells you if the interface is numbered or unnumbered ๐Ÿ”ข. It also decides how long the Downstream IP Address and Downstream Interface fields are. The total for the start of the TLV is the "K Octets" column in the table below โœจ. The Address Type is set to one of these values:

 Type #        Address Type           K Octets
 ------        ------------           --------
      1        IPv4 Numbered                16
      2        IPv4 Unnumbered              16
      3        IPv6 Numbered                40
      4        IPv6 Unnumbered              28
      5        Non IP                       12

DS Flags

The DS Flags field is a bit vector with this format ๐Ÿ’…:

  0 1 2 3 4 5 6 7
 +-+-+-+-+-+-+-+-+
 | Rsvd(MBZ) |I|N|
 +-+-+-+-+-+-+-+-+

Two flags are defined right now, I and N. The remaining flags MUST be set to zero when sending and ignored on receipt ๐Ÿ”’.

Flag I is the Interface and Label Stack Object Request flag. When it's set, it means the replying router SHOULD include an Interface and Label Stack Object in the echo reply message ๐Ÿซถ.

Flag N is Treat as a Non-IP Packet. Echo request messages get used to diagnose non-IP flows, but they still ride inside IP packets ๐ŸŒˆ. For a router that changes its ECMP algorithm based on the FEC or on deep packet examination, this flag asks the router to treat the packet as if finding an IP payload had failed ๐Ÿ‘‘.

Downstream IP Address and Downstream Interface Address

IPv4 addresses and interface indices are encoded in 4 octets, and IPv6 addresses are encoded in 16 octets ๐Ÿ“.

If the interface to the downstream LSR is numbered, then the Address Type MUST be set to IPv4 or IPv6. The Downstream IP Address MUST be set to either the downstream LSR's Router ID or the interface address of the downstream LSR. The Downstream Interface Address MUST be set to the downstream LSR's interface address ๐ŸŒธ.

If the interface to the downstream LSR is unnumbered, the Address Type MUST be IPv4 Unnumbered or IPv6 Unnumbered. The Downstream IP Address MUST be the downstream LSR's Router ID. The Downstream Interface Address MUST be set to the index that the upstream LSR assigned to the interface โœจ.

If an LSR doesn't know its neighbor's IP address, then it MUST set the Address Type to either IPv4 Unnumbered or IPv6 Unnumbered. For IPv4, it must set the Downstream IP Address to 127.0.0.1. For IPv6, the address is set to 0::1. In both cases, the interface index MUST be set to 0. If an LSR gets an Echo Request packet with either of those addresses in the Downstream IP Address field, that means it MUST bypass interface verification but continue with label validation ๐Ÿงšโ€โ™€๏ธ.

If the originator of an echo request packet wants Downstream Mapping information but doesn't know the expected label stack, then it SHOULD set the Address Type to either IPv4 Unnumbered or IPv6 Unnumbered. For IPv4, it MUST set the Downstream IP Address to 224.0.0.2. For IPv6, the address MUST be set to FF02::2. In both cases, the interface index MUST be set to 0. If an LSR gets an echo request packet with the all-routers multicast address, then it MUST bypass both interface and label stack validation, but still return Downstream Mapping TLVs using the information provided ๐Ÿ’œ.

Multipath Type

These are the Multipath Types that are defined ๐Ÿฆ‹:

 Key   Type                  Multipath Information
 ---   ----------------      ---------------------
  0    no multipath          Empty (Multipath Length = 0)
  2    IP address            IP addresses
  4    IP address range      low/high address pairs
  8    Bit-masked IP         IP address prefix and bit mask
         address set
  9    Bit-masked label set  Label prefix and bit mask

Type 0 means all packets get forwarded out this one interface ๐Ÿ›ฃ๏ธ. Types 2, 4, 8, and 9 mean the supplied Multipath Information is what gets used to exercise this path ๐Ÿ”ฅ.

Depth Limit

The Depth Limit only applies to a label stack. It's the maximum number of labels considered in the hash. This SHOULD be set to zero if it's unspecified or unlimited ๐Ÿ’.

Multipath Length

This is the length in octets of the Multipath Information ๐Ÿ“.

Multipath Information

These are the address or label values, encoded according to the Multipath Type. See Section 3.4.1.1.1 for the encoding details ๐Ÿ“–.

Downstream Label(s)

This is the set of labels in the label stack, exactly as it would look if this router were forwarding the packet out this interface ๐Ÿท๏ธ. Any Implicit Null labels get explicitly included. Labels are treated as numbers, so they're right justified in the field ๐Ÿ’ซ.

A downstream label is 24 bits, in the same format as an MPLS label minus the TTL field. The MSBit of the label is bit 0, the LSBit is bit 19, the TC bits are bits 20-22, and bit 23 is the S bit ๐ŸŽ€. The replying router SHOULD fill in the TC and S bits. The LSR that receives the echo reply MAY choose to ignore those bits ๐Ÿซง.

Protocol

The protocol comes from this table ๐Ÿ“‹:

 Protocol #        Signaling Protocol
 ----------        ------------------
          0        Unknown
          1        Static
          2        BGP
          3        LDP
          4        RSVP-TE

Acknowledgements โœจ

The original acknowledgements from RFC 4379 gave a huge shout-out to Manoj Leelanivas, Paul Traina, Yakov Rekhter, Der-Hwa Gan, Brook Bailey, Eric Rosen, Ina Minei, Shivani Aggarwal, and Vanson Lim ๐Ÿซถ. This doc came out of lots of discussions with them.

The description of the Multipath Information sub-field of the Downstream Mapping TLV was adapted from text suggested by Curtis Villamizar ๐Ÿ’–.

We also want to thank Loa Andersson for motivating the advancement of this specification ๐Ÿ‘‘.

And a big thank you to Alexander Vainshtein, Yimin Shen, Curtis Villamizar, David Allan, Vincent Roca, Mirja Kuhlewind, and Elwyn Davies for their reviews and useful comments ๐ŸŒˆ.

Contributors ๐Ÿ’œ

A mechanism for detecting data-plane failures in MPLS LSPs was originally published as RFC 4379 in February 2006 ๐Ÿฆ‹. It was produced by the MPLS Working Group of the IETF and was jointly authored by Kireeti Kompella and George Swallow ๐Ÿงš.

These people made vital contributions to all aspects of the original RFC 4379, and a lot of the material came out of debate and discussion among this group ๐Ÿ”ฅ:

  • Ronald P. Bonica, Juniper Networks, Inc.
  • Dave Cooper, Global Crossing
  • Ping Pan, Hammerhead Systems
  • Nischal Sheth, Juniper Networks, Inc.
  • Sanjay Wadhwa, Juniper Networks, Inc.

Authors' Addresses ๐ŸŽ€

  • Kireeti Kompella
    • Juniper Networks, Inc.
    • Email: kireeti.kompella@gmail.com
  • George Swallow
    • Cisco Systems, Inc.
    • Email: swallow.ietf@gmail.com
  • Carlos Pignataro (editor)
    • Cisco Systems, Inc.
    • Email: cpignata@cisco.com
  • Nagendra Kumar
    • Cisco Systems, Inc.
    • Email: naikumar@cisco.com
  • Sam Aldrin
    • Google
    • Email: aldrin.ietf@gmail.com
  • Mach(Guoyi) Chen
    • Huawei
    • Email: mach.chen@huawei.com
๐Ÿ“ฆ where this page comes from