RFC 4379

Detecting Multi-Protocol Label Switched (MPLS) Data Plane Failures

๐Ÿ“… published February 2006, from ietf

Detecting Multi-Protocol Label Switched (MPLS) Data Plane Failures ๐Ÿ’–

okay bestie, this is part 1 of 11 ๐ŸŽ€ and it's giving RFC 4379 realness. It's a Standards Track doc from February 2006, written by K. Kompella (Juniper Networks, Inc.) and G. Swallow (Cisco Systems, Inc.) ๐Ÿงš. It's part of the Network Working Group stuff, and it updates RFC 1122 (the Updates: 1122 line in the header), so that's the main thing to know from the title block ๐Ÿ’….


Status of This Memo ๐Ÿ“œ

this one is an Internet standards track protocol for the Internet community ๐ŸŒธ. It's asking for discussion and suggestions for improvements, so bring your thoughts! For the standardization state and status, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐Ÿ‘‘. Distribution of this memo is unlimited โœจ.

Copyright (C) The Internet Society (2006).

Abstract ๐Ÿฆ‹

this doc describes a simple and efficient mechanism for detecting data plane failures in Multi-Protocol Label Switching (MPLS) Label Switched Paths (LSPs) ๐Ÿ”ฅ. It has two parts: the info carried in an MPLS "echo request" and "echo reply" for fault detection and isolation, and the mechanisms for reliably sending that echo reply ๐Ÿ’œ.

Table of Contents ๐Ÿ—‚๏ธ

   1. Introduction ....................................................2
      1.1. Conventions ................................................3
      1.2. Structure of This Document .................................3
      1.3. Contributors ...............................................3
   2. Motivation ......................................................4
      2.1. Use of Address Range 127/8 .................................4
   3. Packet Format ...................................................6
      3.1. Return Codes ..............................................10
      3.2. Target FEC Stack ..........................................11
           3.2.1. LDP IPv4 Prefix ....................................12
           3.2.2. LDP IPv6 Prefix ....................................13
           3.2.3. RSVP IPv4 LSP ......................................13
           3.2.4. RSVP IPv6 LSP ......................................14
           3.2.5. VPN IPv4 Prefix ....................................14
           3.2.6. VPN IPv6 Prefix ....................................15
           3.2.7. L2 VPN Endpoint ....................................16
           3.2.8. FEC 128 Pseudowire (Deprecated) ....................16
           3.2.9. FEC 128 Pseudowire (Current) .......................17
           3.2.10. FEC 129 Pseudowire ................................18
           3.2.11. BGP Labeled IPv4 Prefix ...........................19
           3.2.12. BGP Labeled IPv6 Prefix ...........................20
           3.2.13. Generic IPv4 Prefix ...............................20
           3.2.14. Generic IPv6 Prefix ...............................21
           3.2.15. Nil FEC ...........................................21
      3.3. Downstream Mapping ........................................22
           3.3.1. Multipath Information Encoding .....................26
           3.3.2. Downstream Router and Interface ....................28
      3.4. Pad TLV ...................................................29
      3.5. Vendor Enterprise Number ..................................29
      3.6. Interface and Label Stack .................................29
      3.7. Errored TLVs ..............................................31
      3.8. Reply TOS Byte TLV ........................................31
   4. Theory of Operation ............................................32
      4.1. Dealing with Equal-Cost Multi-Path (ECMP) .................32
      4.2. Testing LSPs That Are Used to Carry MPLS Payloads .........33
      4.3. Sending an MPLS Echo Request ..............................33
      4.4. Receiving an MPLS Echo Request ............................34
           4.4.1. FEC Validation .....................................40
      4.5. Sending an MPLS Echo Reply ................................41
      4.6. Receiving an MPLS Echo Reply ..............................42
      4.7. Issue with VPN IPv4 and IPv6 Prefixes .....................42
      4.8. Non-compliant Routers .....................................43
   5. References .....................................................43
      5.1. Normative References ......................................43
      5.2. Informative References ....................................44
   6. Security Considerations ........................................44
   7. IANA Considerations ............................................46
      7.1. Message Types, Reply Modes, Return Codes ..................46
      7.2. TLVs ......................................................47
   8. Acknowledgements ...............................................48

1. Introduction โœจ

this doc describes a simple and efficient mechanism for detecting data plane failures in MPLS Label Switched Paths (LSPs) ๐ŸŒˆ. There are two parts: the info in an MPLS "echo request" and "echo reply", and the ways of transporting that echo reply ๐Ÿฆ‹. The first part gives you enough info to check that the data plane is working correctly, plus a way to check the data plane against the control plane so you can pin down where faults are ๐Ÿ”. The second part suggests two methods of reliable reply channels for the echo request message, for more robust fault isolation ๐Ÿ’ช.

An important thing about this design is that MPLS echo requests follow the same data path that normal MPLS packets would take ๐Ÿ›ค๏ธ. Echo requests are mainly for validating the data plane, and secondarily for verifying the data plane against the control plane ๐Ÿ’œ. Checking the control plane is valuable too, but it isn't covered in this doc ๐Ÿ™ˆ.

This doc makes special use of the address range 127/8 ๐Ÿ’–. That's an exception to the behavior defined in RFC 1122 [RFC1122], and it updates that RFC. The reasons for this change, and the details of this exceptional use, are discussed in section 2.1 below ๐ŸŽ€.

1.1. Conventions ๐Ÿ“

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [KEYWORDS] ๐Ÿ”‘.

The term "Must Be Zero" (MBZ) is used in object descriptions for reserved fields. These fields MUST be set to zero when sent and 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 often than the IP TTL, the authors chose to use the unqualified "TTL" to mean "MPLS TTL", and "IP TTL" for the TTL value in the IP header ๐Ÿ“. Super logical, honestly.

1.2. Structure of This Document ๐Ÿ—บ๏ธ

The body of this memo has four main parts: motivation, the MPLS echo request/reply packet format, LSP ping operation, and a reliable return path ๐Ÿงš. If you're reading this for the first time, skip the actual packet formats and read the Theory of Operation first ๐Ÿซถ. The doc is structured this way to avoid forward references, so you won't be jumping around all over the place ๐Ÿ˜ญ.

1.3. Contributors ๐Ÿซถ

The following people made vital contributions to all aspects of this document, 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.

2. Motivation ๐Ÿ”ฅ

when an LSP fails to deliver user traffic, the MPLS control plane can't always detect the failure ๐Ÿ˜ฌ. So there's a need for a tool that lets users detect those traffic "black holes" or misrouting within a reasonable period of time, plus a mechanism to isolate faults ๐Ÿ•ณ๏ธ.

This doc describes a mechanism that accomplishes those goals โœจ. It's modeled after the ping/traceroute paradigm: ping (ICMP echo request [ICMP]) is used for connectivity checks, and traceroute is used for 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 verify that packets belonging to a particular Forwarding Equivalence Class (FEC) actually end their MPLS path on a Label Switching Router (LSR) that is an egress for that FEC ๐ŸŽฏ. The doc proposes doing this test by sending a packet (called an "MPLS echo request") along the same data path as other packets in this FEC ๐Ÿ›ฃ๏ธ. The echo request also carries information about the FEC whose MPLS path is being verified. It's forwarded just like any other packet belonging to that FEC ๐Ÿ’Œ. In "ping" mode (basic connectivity check), the packet should reach the end of the path, at which point it's sent to the control plane of the egress LSR, which then 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. That control plane runs various checks to confirm it really is a transit LSR for this path ๐Ÿ•ต๏ธโ€โ™€๏ธ. This LSR also returns further info that helps check the control plane against the data plane, meaning it checks that forwarding matches what the routing protocols determined the path to be ๐ŸŒˆ.

One way to use these tools is to periodically ping an FEC to make sure connectivity is fine ๐Ÿ’œ. If the ping fails, you can then start a traceroute to figure out where the fault is ๐Ÿ”. You can also periodically traceroute FECs to verify that forwarding matches the control plane. But that puts a greater burden on transit LSRs, so it should be used with caution โš ๏ธ.

โš ๏ธ heads up: periodic traceroutes add extra load on transit LSRs, so don't go wild with them ๐Ÿ™ˆ

2.1. Use of Address Range 127/8 โœจ

okay bestie, so LSP ping is a diagnostic tool ๐Ÿ” and providers of MPLS-based services use it to isolate network faults ๐Ÿฆ‹. The big thing is that it has to diagnose situations where the control and data planes are out of sync ๐Ÿ™ˆ. To do that, it routes an MPLS echo request packet based solely on its label stack. The IP destination address is never used in a forwarding decision, so the sender might not even know the address of the router at the end of the LSP a priori ๐Ÿ’…

Providers also need to trace every possible path an LSP might take ๐Ÿ—บ๏ธ. Since most MPLS services are built on IP unicast forwarding, those paths get split up by equal-cost multi-path (ECMP) load sharing ๐ŸŒˆ

This leads to the following requirements:

  1. Even though the LSP might be broken in unknown ways, the likelihood of a diagnostic packet getting delivered to a user of an MPLS service MUST be held to an absolute minimum. ๐Ÿ˜ญ
  2. If an LSP is broken in a way that makes it prematurely terminate, the diagnostic packet MUST NOT be IP forwarded. ๐Ÿšซ
  3. A way to vary the diagnostic packets so they exercise all ECMP paths is REQUIRED. ๐ŸŽ€

Clearly, using general unicast addresses doesn't satisfy the first two requirements, not even a little bit ๐Ÿ’€. The team considered a bunch of other address options, including a chunk of the private address space (picked by the network operator) and the newly designated IPv4 link local addresses ๐Ÿงš. Private space got ruled out because the leading MPLS-based service is an IPv4 Virtual Private Network (VPN), and VPNs often use private addresses anyway ๐Ÿ™…โ€โ™€๏ธ

The IPv4 link local addresses were more attractive since they can only be forwarded across a limited scope โœจ. BUT, if you used one of those, the first recipient of a diagnostic packet that "escaped" from a broken LSP could have that exact address assigned to the interface it arrived on, and then it could mistakenly receive the packet ๐Ÿ˜ฌ. Plus, the IPv4 link local range had only just been allocated, and a lot of deployed routers would forward a packet with an address from that range toward the default route. Not it ๐Ÿ’…

So the 127/8 range got chosen, both for IPv4 and for that same range embedded in IPv4-mapped IPv6 addresses for IPv6, and there are a few reasons why ๐Ÿฆ‹

RFC 1122 allocates 127/8 as "Internal host loopback address" and says: "Addresses of this form MUST NOT appear outside a host." ๐ŸŒธ So by default, hosts throw away these packets. That's a huge win, because if a diagnostic packet ever gets misdirected to a host, it gets silently discarded and nobody's life gets ruined ๐Ÿซถ

RFC 1812 [RFC1812] also says:

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, which is exactly the vibe we want ๐Ÿ‘‘

And the 127/8 range gives you 16M addresses ๐Ÿคฏ That's tons of room for varying addresses so you can exercise those ECMP paths. Last but not least, as an implementation optimization, 127/8 gives you an easy way to spot possible LSP packets. Iconic, honestly ๐Ÿ’–

3. Packet Format โœจ

okay bestie, an MPLS echo request 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 (microseconds)                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                  TimeStamp Received (seconds)                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                TimeStamp Received (microseconds)              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            TLVs ...                           |
   .                                                               .
   .                                                               .
   .                                                               .
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

The Version Number is currently 1. ๐ŸŽ€ Here's the tea: it gets bumped whenever a change would affect whether an implementation can correctly parse or process an MPLS echo request/reply. That includes any syntactic or semantic changes to the fixed fields, or to any Type-Length-Value (TLV) or sub-TLV assignment or format that's defined at a certain version number. The version number may not need to change if an optional TLV or sub-TLV is added. ๐Ÿ’…

The Global Flags field is a bit vector with the following format:

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

Only one flag is defined for now, the V bit ๐ŸŒธ, and 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 Message Type is one of the following:

   Value    Meaning
   -----    -------
       1    MPLS echo request
       2    MPLS echo reply

The Reply Mode can take one of the following 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) [VCCV]. 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 codepoint is application specific and thus beyond the scope of this document. โœจ

Return Codes and Subcodes are described in the next section. ๐Ÿ‘‘

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 (in seconds and microseconds, according to the sender's clock) in NTP format [NTP] 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 NTP format that the corresponding echo request was received. โฐ

TLVs (Type-Length-Value tuples) have the following 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. ๐ŸŒˆ

Two examples follow. The Label Distribution Protocol (LDP) IPv4 FEC sub-TLV has the following 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 (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 the following 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 = 12          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  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                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

A description of the Types and Values of the top-level TLVs for LSP ping is given below. ๐Ÿฆ‹

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

Types less than 32768 (i.e., with the high-order bit equal to 0) are mandatory TLVs. They 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. They SHOULD be ignored if the implementation does not understand or support them. ๐Ÿ™ˆ

3.1. Return Codes

The Return Code is set to zero by the sender, and the receiver can set it to one of the values listed below. The notation <RSC> refers to the Return Subcode. This field is filled in with the stack-depth for those codes that specify that. For all 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

Note 1

The Return Subcode contains the point in the label stack where processing was terminated. If the RSC is 0, no labels were processed. Otherwise, the packet would have been label switched at depth RSC. ๐Ÿ“

3.2. Target FEC Stack โœจ

okay so the Target FEC Stack is basically a list of sub-TLVs ๐Ÿ’… and the number of elements is figured out by looking at each sub-TLV's length field. the whole thing is giving organized ๐ŸŽ€

   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                         Not Assigned
          6           13            VPN IPv4 prefix
          7           25            VPN IPv6 prefix
          8           14            L2 VPN endpoint
          9           10            "FEC 128" Pseudowire (deprecated)
         10           14            "FEC 128" Pseudowire
         11          16+            "FEC 129" Pseudowire
         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

more FEC types will get added later as needed ๐Ÿฆ‹

also, this TLV is a stack of FECs, and the first FEC element is the top of the label stack. the order matters bestie ๐Ÿ‘‘

An MPLS echo request MUST have a Target FEC Stack that describes the FEC Stack being tested. ๐Ÿซถ for example, say an LSR X has an LDP mapping [LDP] for 192.168.1.1 (let's say label 1001). to check that label 1001 really reaches an egress LSR that announced this prefix over LDP, X can send an MPLS echo request with an FEC Stack TLV holding one FEC: type LDP IPv4 prefix, prefix 192.168.1.1/32, and send the echo request with label 1001. ๐Ÿงš

now here's the spicy one ๐ŸŒถ๏ธ๐Ÿ”ฅ. say LSR X wants to verify that the label stack <1001, 23456> is the right one to reach a VPN IPv4 prefix [see section 3.2.5] of 10/8 in VPN foo. say LSR Y, with loopback address 192.168.1.1, announced prefix 10/8 with Route Distinguisher RD-foo-Y (which can be different from the one X uses in its own advertisements for VPN foo), label 23456, and BGP next hop 192.168.1.1 [BGP]. and say X gets a label binding of 1001 for 192.168.1.1 over LDP. X has two ways to send the echo request:

X can send an MPLS echo request with an FEC Stack TLV that has a single FEC of type VPN IPv4 prefix, with prefix 10/8 and Route Distinguisher RD-foo-Y. ๐Ÿ’œ

or X can send an FEC Stack TLV with two FECs: the first of type LDP IPv4 with prefix 192.168.1.1/32, and the second of type IP VPN with prefix 10/8 and Route Distinguisher RD-foo-Y. ๐ŸŒˆ

either way, the MPLS echo request ends up with the label stack <1001, 23456>. (note: in this example, 1001 is the "outer" label and 23456 is the "inner" label ๐Ÿ“)


3.2.1. LDP IPv4 Prefix

the IPv4 Prefix FEC is defined in [LDP] ๐ŸŒธ when an LDP IPv4 prefix gets encoded in a label stack, this is the format. the value is 4 octets of IPv4 prefix followed by 1 octet of prefix length in bits. the IPv4 prefix is in network byte order, and if the prefix is shorter than 32 bits, the trailing bits SHOULD be set to zero. see [LDP] 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 [LDP] ๐Ÿ’– same vibe for IPv6: when an LDP IPv6 prefix is encoded in a label stack, the value is 16 octets of IPv6 prefix followed by 1 octet of prefix length in bits. the IPv6 prefix is in network byte order, and if it's shorter than 128 bits, the trailing bits SHOULD be set to zero. see [LDP] 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 come from RFC 3209, sections 4.6.1.1 and 4.6.2.1. see [RSVP-TE] ๐Ÿ’…

    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 end point address                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Must Be Zero         |     Tunnel ID                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Extended Tunnel ID                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                   IPv4 tunnel sender address                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Must Be Zero         |            LSP ID             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.4. RSVP IPv6 LSP

same energy as the IPv4 one ๐ŸŒˆ the value has the format below. the value fields come from RFC 3209, sections 4.6.1.2 and 4.6.2.2. see [RSVP-TE] โœจ

    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 end point address                 |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Must Be Zero         |          Tunnel ID            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Extended Tunnel ID                      |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                   IPv6 tunnel sender address                  |
   |                                                               |
   |                                                               |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          Must Be Zero         |            LSP ID             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.5. VPN IPv4 Prefix

VPN-IPv4 Network Layer Routing Information (NLRI) is defined in [RFC4365] ๐Ÿ’œ this document says "VPN IPv4 prefix" for a VPN-IPv4 NLRI that got advertised with an MPLS label in BGP. see [BGP-LABEL] ๐Ÿซถ

when a VPN IPv4 prefix is encoded in a label stack, this is the format. the value field holds the Route Distinguisher advertised with the VPN IPv4 prefix, the IPv4 prefix (with trailing 0 bits to make 32 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)                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                         IPv4 prefix                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |                 Must Be Zero                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

the Route Distinguisher (RD) is an 8-octet identifier, and it doesn't contain any inherent information ๐ŸŒธ its only job is to let you create distinct routes to a common IPv4 address prefix. how the RD is encoded doesn't matter here. when matching this field against the local FEC information, it gets treated as an opaque value ๐Ÿ”ฎ


3.2.6. VPN IPv6 Prefix

VPN-IPv6 Network Layer Routing Information (NLRI) is defined in [RFC4365] ๐ŸŒˆ this document uses "VPN IPv6 prefix" for a VPN-IPv6 NLRI that got advertised with an MPLS label in BGP. see [BGP-LABEL] ๐Ÿฆ‹

when a VPN IPv6 prefix is encoded in a label stack, this is the format. the value field holds the Route Distinguisher advertised with the VPN IPv6 prefix, the IPv6 prefix (with trailing 0 bits to make 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 Route Distinguisher is the same as the VPN IPv4 Prefix RD, except here it's there to let you create 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 too โœจ

3.2.7. L2 VPN Endpoint โœจ

okay so VPLS stands for Virtual Private LAN Service ๐Ÿซถ. The terms VPLS BGP NLRI and VE ID (VPLS Edge Identifier) come from [VPLS-BGP]. This doc just calls a VPLS BGP NLRI an L2 VPN endpoint, which is way simpler ๐Ÿ’…. The Route Distinguisher is an 8-octet identifier that tells apart the different L2 VPNs a node advertises ๐ŸŽ€. The VE ID is a 2-octet identifier for the node that acts as the service attachment point inside a VPLS ๐Ÿฆ‹. The internal structure of both doesn't matter here. When you match these fields against local FEC info, they're just opaque values, so no peeking inside ๐Ÿ™ˆ. Also, the encapsulation type is the same thing as the PW Type in section 3.2.8 below.

When an L2 VPN endpoint gets encoded in a label stack, this is the format. The value field has a Route Distinguisher (8 octets), the sender's VE ID (2 octets, where "sender" means the one who sent the ping), the receiver's VE ID (2 octets), and an encapsulation type (2 octets) ๐ŸŒธ:

    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 (Deprecated) ๐Ÿ’€

FEC 128 (0x80) is defined in [PW-CONTROL], 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 for the encapsulation type. It's carried right justified in the field below called encapsulation type, with the high-order bit set to zero ๐ŸŽ€. In this protocol, both of these fields are treated as opaque values.

When an FEC 128 gets encoded in a label stack, this is the format. The value field has the remote PE 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                      Remote PE Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             PW ID                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |            PW Type            |          Must Be Zero         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
This FEC is deprecated ๐Ÿฅ€. It's only kept around for backward compatibility. Implementations of LSP ping SHOULD accept and process this TLV, but SHOULD send LSP ping echo requests with the new TLV (see the next section), unless they're explicitly configured to use the old TLV.

An LSR that receives this TLV SHOULD use the source IP address of the LSP echo request to infer the sender's PE address ๐Ÿ”.

3.2.9. FEC 128 Pseudowire (Current) ๐Ÿ‘‘

FEC 128 (0x80) is defined in [PW-CONTROL], same as 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 for the encapsulation type, and 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 you match these fields to the local FEC information, the match MUST be exact ๐Ÿ”’.

When an FEC 128 gets encoded in a label stack, this is the format. The value field has the sender's PE address (the source address of the targeted LDP session), the remote PE 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 Address                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                      Remote PE Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                             PW ID                             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |            PW Type            |          Must Be Zero         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.10. FEC 129 Pseudowire ๐ŸŒˆ

FEC 129 (0x81) is defined in [PW-CONTROL], and so are 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) ๐Ÿ“š. The PW Type is a 15-bit number for the encapsulation type. It's 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 directly from the FEC 129 format. Put all of these values together and they uniquely define the FEC within the scope of the LDP session identified by the source and remote PE addresses ๐Ÿซถ.

When an FEC 129 gets encoded in a label stack, this is the format. 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 padding length 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 Address                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                      Remote PE 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. BGP Labeled IPv4 Prefix ๐Ÿฆ‹

BGP labeled IPv4 prefixes are defined in [BGP-LABEL]. When a BGP labeled IPv4 prefix gets encoded in a label stack, this is the format. The value field has the IPv4 prefix (with trailing 0 bits to make 32 bits in all) and the 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          IPv4 Prefix                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Prefix Length |                 Must Be Zero                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

3.2.12. BGP Labeled IPv6 Prefix ๐ŸŒธ

BGP labeled IPv6 prefixes are defined in [BGP-LABEL]. When a BGP labeled IPv6 prefix gets encoded in a label stack, this is the format. The value is 16 octets of IPv6 prefix followed by 1 octet of prefix length in bits ๐ŸŽ€. The IPv6 prefix is in network byte order. If the prefix is 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.13. Generic IPv4 Prefix ๐Ÿงš

The value is 4 octets of IPv4 prefix followed by 1 octet of prefix length in bits ๐Ÿ’œ. The IPv4 prefix is in network byte order. If the prefix is shorter than 32 bits, the trailing bits SHOULD be set to zero. This FEC gets used if the protocol advertising the label is unknown or might change during the course of the LSP ๐ŸŒ€. An example is an inter-AS LSP that might be signaled by LDP in one Autonomous System (AS), by RSVP-TE [RSVP-TE] in another AS, and by BGP between the ASes, which is pretty common for inter-AS VPNs ๐Ÿ™Œ.

    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. Generic IPv6 Prefix ๐Ÿ”ฅ

The value is 16 octets of IPv6 prefix followed by 1 octet of prefix length in bits ๐Ÿ’…. The IPv6 prefix is in network byte order. If the prefix is 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.15. Nil FEC ๐Ÿงš

okay so sometimes labels from the reserved range, like Router Alert and Explicit-null, get tossed onto the label stack for diagnostic stuff, like nudging load-balancing ๐ŸŽ€. These labels might not have an explicit FEC attached to them. That's why 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 proper validation can still happen ๐Ÿ’–.

The Length is 4. Labels are 20-bit values treated as 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 inserted in the label stack. The MBZ fields MUST be zero when sent and ignored on receipt ๐Ÿซถ.

3.3. Downstream Mapping ๐Ÿฆ‹

okay this one is a whole vibe ๐Ÿ’…. 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. Including it is basically asking for Downstream Mapping objects to come 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.3.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. Values for K are found in the description of Address Type below. The Value field of a Downstream Mapping has the following 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |               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 (label stack included) 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 initial part of the TLV is listed in the table below as "K Octets". 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

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 Name and Meaning

  • I: Interface and Label Stack Object Request. When this flag is set, 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 are used to diagnose non-IP flows, but they ride in IP packets. For a router that changes its ECMP algorithm based on the FEC or deep packet examination, this flag asks the router to treat it as if figuring out the 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, 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 IP 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 its neighbor's IP address, 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 receives an Echo Request packet with either of these 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 receives an Echo Request packet with the all-routers multicast address, then that means it MUST bypass both interface and label stack validation, but return Downstream Mapping TLVs using the information provided ๐Ÿ“ก.

Multipath Type ๐ŸŒท

these Multipath Types 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 will be forwarded out this one interface ๐Ÿ›ฃ๏ธ. Types 2, 4, 8, and 9 mean the supplied Multipath Information will be 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, and it SHOULD be set to zero if unspecified or unlimited ๐Ÿญ.

Multipath Length ๐Ÿ“

the length in octets of the Multipath Information ๐Ÿ’….

Multipath Information ๐ŸŽ€

address or label values, encoded according to the Multipath Type. See the next section below for encoding details ๐Ÿ‘€.

Downstream Label(s) ๐Ÿท๏ธ

this is the set of labels in the label stack as it would have looked if this router were forwarding the packet through this interface. Any Implicit Null labels are 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. That means the MSBit of the label is bit 0, the LSBit is bit 19, the EXP bits are bits 20-22, and bit 23 is the S bit ๐ŸŒˆ. The replying router SHOULD fill in the EXP and S bits. The LSR receiving the echo reply MAY choose to ignore these bits ๐Ÿซง.

Protocol ๐Ÿ”ฎ

the Protocol is taken from this table:

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

3.3.1. Multipath Information Encoding

Okay so the Multipath Information is where you pack in the labels or addresses that will exercise this path ๐Ÿ›ค๏ธโœจ What goes in depends on the Multipath Type, and the table up above has all the deets ๐Ÿ’… IPv4 addresses come from 127/8, and IPv6 addresses come from 0:0:0:0:0:FFFF:127/104 ๐ŸŒธ Labels are treated as plain numbers, so they get right justified in the field ๐Ÿ”ข And for Type 4, the ranges from the Address pairs MUST NOT overlap and MUST be in ascending sequence. No overlaps, lined up in order, periodt ๐Ÿ’…๐ŸŽ€

Type 8 is the dense way to encode IP addresses ๐Ÿฆ‹ The IP prefix is a base IP address with all the non-prefix low-order bits set to zero, and the maximum prefix length is 27. After the prefix comes a mask that's 2^(32-prefix length) bits long for IPv4 and 2^(128-prefix length) bits long for IPv6. Each bit set to 1 means that address is valid โœ… 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 from 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 get 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 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 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 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 dense encoding for labels ๐Ÿท๏ธโœจ The label prefix is a base label value with the non-prefix low-order bits set to zero. The maximum prefix length is 27, counting any leading zeros from the encoding. After the prefix comes a mask of 2^(32-prefix length) bits. Each bit set to one is a valid label, and the label is the base label plus the bit's position in the mask, numbered left to right from zero. So, labels for all the odd numbers between 1152 and 1279 get 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, and it's a big one ๐Ÿšจ If the received Multipath Information is non-null, the labels and IP addresses MUST be picked from the set provided. If none of those labels or addresses map to a particular downstream interface, then the type for that interface MUST be set to 0. If the received Multipath Information is null (meaning Multipath Length = 0, or for Types 8 and 9, a mask of all zeros), the type MUST be set to 0 ๐Ÿ’€

Let's run through an example, because this gets confusing fast ๐Ÿง  Say LSR X at hop 10 has two downstream LSRs, Y and Z, for the FEC in question. 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, so Y 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. Then Y responds with 3 Downstream Mappings: one to U with Multipath Type 4 (127.1.1.1->127.1.1.127), one to V with Multipath Type 4 (127.1.1.127->127.1.1.255), and one to W with Multipath Type 0 ๐ŸŽฏ

Okay, heads up, computing Multipath Information can be a significant processing burden on the receiver ๐Ÿ˜ฎโ€๐Ÿ’จ So a receiver MAY choose to process only a subset of the received prefixes. The sender, when it gets a reply to a Downstream Mapping with partial info, SHOULD assume that the prefixes missing from the reply were skipped by the receiver, and MAY re-request info about them in a new echo request ๐Ÿ”

3.3.2. Downstream Router and Interface

The idea of a "downstream router" and "downstream interface" should be explained, so let's do it ๐Ÿงƒ Take an LSR X. If a packet that was originated with TTL n>1 arrived at LSR X with outermost label L and TTL=1, X must be able to compute which LSRs could receive the packet if it had been originated with TTL=n+1, over which interface the request would arrive, and what label stack those LSRs would see. (How that computation actually gets done is outside the scope of this document, so no spoilers ๐Ÿ™ˆ) The set of these LSRs and interfaces is the downstream routers and interfaces (plus their corresponding labels) for X with respect to L. Each pair of downstream router and interface needs its own Downstream Mapping added to the reply ๐Ÿ“ฌ

The case where X is the LSR that originates the echo request is its own 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 (for example, for MPLS multicast) ๐Ÿฆ‹ In the former case, the Multipath Information acts as a hint to the sender about how it may influence the choice among those alternatives ๐Ÿ’œ


3.4. Pad TLV

The value part of the Pad TLV holds a variable number (>= 1) of octets ๐ŸŽ€ The first octet takes a value from the table below, and all the other octets (if there are any) are ignored. The receiver SHOULD verify that the TLV was received in its entirety, but otherwise it ignores the contents of this TLV, apart from that first octet ๐Ÿ‘€

      Value        Meaning
      -----        -------
          1        Drop Pad TLV from reply
          2        Copy Pad TLV to reply
      3-255        Reserved for future use

3.5. Vendor Enterprise Number

SMI Private Enterprise Numbers are maintained by IANA ๐Ÿข The Length is always 4, and the value is the 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. If that's the case, this TLV MUST be present. If none of the fields in the fixed part of the message have Vendor Private extensions, including this TLV is OPTIONAL ๐Ÿซถ Vendor Private ranges for Message Types, Reply Modes, and Return Codes have been defined. When any of those are used, the Vendor Enterprise Number TLV MUST be included in the message ๐Ÿ”ฅ

3.6. 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, plus the label stack that was on the packet when it arrived ๐Ÿงšโ€โ™€๏ธ Only one such object may appear. Its purpose is to let the upstream router get the exact interface and label stack info 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 description of Address Type below. The Value field of a Downstream Mapping 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 says whether the interface is numbered or unnumbered ๐Ÿ”ข It also determines the length of the IP Address and Interface fields. The resulting total for the initial part of the TLV is listed in the table below as "K Octets". The Address Type is set to one of these values:

   Type #        Address Type           K Octets
   ------        ------------           --------
        1        IPv4 Numbered                12
        2        IPv4 Unnumbered              12
        3        IPv6 Numbered                36
        4        IPv6 Unnumbered              24

IP Address and Interface

IPv4 addresses and interface indices are encoded in 4 octets, and 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

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

3.7. Errored TLVs ๐Ÿ’€

okay so this TLV is giving "I didn't understand you, here's exactly what I didn't get" ๐Ÿ™ˆ It MAY be included in an echo reply to tell the sender of an echo request about mandatory TLVs that either aren't supported by the implementation or were parsed and found to be in error. ๐Ÿ’…

The Value field holds the TLVs that weren't understood, 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.8. Reply TOS Byte TLV ๐ŸŽ€

okay this one is so cute ๐Ÿฆ‹ This TLV MAY be used by the originator of the echo request to ask for the echo reply to be sent with the IP header TOS byte set to whatever value is in the TLV. It has a length of 4 and the value field below ๐Ÿ’œ

    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 the main vibe here: 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 goes to an egress IP address of 10.1.1.1, the FEC Stack has one element, an LDP IPv4 prefix sub-TLV with the value 10.1.1.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 10.1/8 that's tunneled over an LDP LSP with egress 10.10.1.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 isn't known, or is considered irrelevant, the FEC Stack could just be a single element with only the VPN IPv4 sub-TLV ๐ŸŒธ

When an MPLS echo request is received, the receiver is expected to check that the control plane and the 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 below ๐Ÿ”ฅ

4.1. Dealing with Equal-Cost Multi-Path (ECMP) ๐ŸŒˆ

ngl LSPs don't have to be simple point-to-point tunnels ๐Ÿ’€ Often a single LSP can start at several ingresses and end at several egresses, and this is super common with LDP LSPs. LSPs for a given FEC can also have multiple "next hops" at transit LSRs. At an ingress there may 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 ๐Ÿฆ‹

To handle the last two first: it's assumed that the LSR sending the MPLS echo requests can force each echo request into any LSP it wants, so picking among multiple LSPs at the ingress isn't an issue. Probing the different flavors of backup paths, which typically won't be used for forwarding data unless the primary LSP is down, isn't covered here ๐Ÿ™ˆ

Since the actual LSP and path a given packet takes might not be known ahead of time, it would be useful if MPLS echo requests could exercise every possible path. 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. This alone clearly isn't enough. In the case of traceroute, you get more latitude from the Multipath Information of the Downstream Mapping TLV, and it works like this. An ingress LSR periodically sends an MPLS traceroute message to find out whether there are multipaths for a given LSP. If there are, each hop provides some information about 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. However, full coverage may not be possible ๐Ÿ“

4.2. Testing LSPs That Are Used to Carry MPLS Payloads ๐ŸŽ€

to catch 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 right upstream of the LSP ping's destination forwards the MPLS echo request successfully over an interface that isn't set up 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 such a packet out unlabeled interfaces ๐Ÿ”ฅ

4.3. Sending an MPLS Echo Request ๐Ÿฆ‹

okay this is the packet-building section and it's so detailed ๐Ÿค“ An MPLS echo request is a UDP packet. The IP header is set like this: the source IP address is a routable address of the sender, and 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:127/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 option MUST be set in the IP header โœจ

An MPLS echo request is sent with a label stack that matches the FEC Stack being tested. Note that more labels could get applied if, for example, the normal route to the topmost FEC in the stack goes through a Traffic Engineered Tunnel [RSVP-TE]. If all of the FECs in the stack correspond to Implicit Null labels, the MPLS echo request is considered unlabeled, even if more labels will be applied when the packet is sent ๐Ÿ’œ

If the echo request is labeled, one MAY (depending on what's 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. Preventing the ping request from going too far can also be done by inserting a Router Alert label above this label. But this may cause the undesired side effect that MPLS echo requests take a different data path than actual data does. For more info on how these mechanisms can be used for pseudowire connectivity verification, see [VCCV] ๐ŸŒˆ

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 seconds and microseconds) when the echo request is sent. The TimeStamp Received is set to zero โญ

An MPLS echo request MUST have an 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 Mapping TLV ๐Ÿ’–

4.4. Receiving an MPLS Echo Request โœจ

okay bestie, so the control plane doesn't just randomly get echo requests ๐Ÿ‘€ it only gets one when one of these packet processing exceptions fires:

  • Router Alert option
  • IP TTL expiration
  • MPLS TTL expiration
  • MPLS Router Alert label
  • the destination address in the 127/8 address range

then it confirms it's an echo request by checking for UDP destination port 3503 ๐ŸŽ€


okay next up, stack-depth ๐Ÿงš for reporting purposes the bottom of the stack counts as stack-depth of 1. this gives us an absolute reference for when the actual stack has more labels than there are FECs in the Target FEC Stack, so nobody gets mixed up about which label is which ๐Ÿ’…

also, in every error code in this doc, a stack-depth of 0 means "no value specified" ๐Ÿ™ˆ that keeps things compatible with existing implementations that don't use the Return Subcode field, so nobody gets left out ๐Ÿซถ

so when an LSR X receives an MPLS echo request, here's how it runs the show ๐Ÿ‘‘

  1. General packet sanity. first, LSR X checks that the packet is well-formed ๐Ÿง if it isn't, 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" and LSR X doesn't understand, LSR X SHOULD send an MPLS "TLV not understood" (as appropriate), with the Subcode set to zero. in that second case, only the misunderstood TLVs get included as sub-TLVs in an Errored TLVs TLV in the reply. and the header fields Sender's Handle, Sequence Number, and Timestamp Sent aren't examined, but they still get included in the MPLS echo reply message ๐Ÿฆ‹

the algorithm uses 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 Downstream 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 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.

steps 2 through 7 are the actual algorithm, so here it is exactly as written ๐Ÿ’œ

/* Save receive context information */
2. If the echo request is good, LSR X stores the interface over
   which the echo was received in Interface-I, and the label stack
   with which it came in Stack-R.

/* 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. */

3. Label Validation:

   If Label-stack-depth is 0 {

   /* The LSR needs to report its being 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 L {

   /* Indicates a temporary or permanent label synchronization
      problem 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 NLFE and proceed to step 4 (Label Operation
      check).

   }

4. 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 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 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 goto
            Send_Reply_Packet.
         }

         If a Downstream Mapping TLV is present {

           A Downstream Mapping TLV SHOULD be included in the echo
           reply (see section 3.3) filled in with information about
           the current ECMP path.
         }
      }

      If no Downstream 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 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 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 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 labels in the FEC stack is greater
         than or equal to FEC-stack-depth {
         Perform the FEC Checking procedure (see subsection 4.4.1
         below).

         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).
   }

5. Egress Processing:

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

   If received echo request contains no Downstream 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 Mapping TLV match Interface-I and Stack-R.  If
   not, set Best-return-code to 5, "Downstream Mapping
   Mis-match".  A Received Interface and Label Stack TLV SHOULD be
   created for the echo response packet.  Go to step 7 (Send Reply
   Packet).

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
   subsection 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).
   }

7. 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 subsection 4.4.1.

4.4.1. FEC Validation โœจ

/* This subsection describes validation of an FEC entry within the
   Target FEC Stack and accepts an FEC, Label-L, and Interface-I.
   The algorithm performs the following steps. */

okay so this is the FEC validation check, and it takes three things: an FEC, a Label-L, and an Interface-I ๐ŸŽ€ Here's how it goes:

  1. Two return values, FEC-status and FEC-return-code, start out at 0 ๐ŸŒธ
  2. Check for the Nil FEC. If the FEC is the Nil FEC, then if Label-L is either Explicit_Null or Router_Alert, you just return. 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. The logic looks like this:
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, check the FEC label mapping. This is the thing that tells you how traffic received on the LSP gets switched further, or which application it belongs to ๐Ÿ‘€ If there's no mapping at all, set FEC-return-code to Return 4, "Replying router has no mapping for the FEC at stack-depth". Set FEC-status to 1, then return.
  2. If the label mapping for the FEC is Implicit Null, set FEC-status to 2 and move on to step 5. If the label mapping for the FEC is Label-L, also move on 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 ๐Ÿ’…
  3. This is the protocol check โญ Look at what protocol would be used to advertise the FEC. If you can tell that no protocol associated with Interface-I would have advertised an FEC of that FEC-Type, set FEC-return-code to 12 ("Protocol not associated with interface at FEC stack-depth"), and set FEC-status to 1.
  4. Return. That's the whole thing, periodt ๐Ÿซถ

4.5. Sending an MPLS Echo Reply ๐Ÿฆ‹

okay so an MPLS echo reply is a UDP packet, and it MUST ONLY be sent in response to an MPLS echo request. No cap, it can't just show up uninvited ๐Ÿ™ˆ 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. And if the reply goes over an LSP, the topmost label MUST in this case be the Router Alert label (1) (see [LABEL-STACK]) โœจ

The format of the echo reply is the same as the echo request, so it's giving mirror ๐Ÿชž The Sender's Handle, the Sequence Number, and TimeStamp Sent all get copied over from the echo request. The TimeStamp Received is set to the time-of-day that the echo request was received. Quick tea: 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 subsection ๐Ÿ’–

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

If the replying router is the destination of the FEC, then Downstream Mapping TLVs SHOULD NOT be included in the echo reply. Bestie, don't add them there ๐Ÿ™…โ€โ™€๏ธ

If the echo request has a Downstream Mapping TLV, and the replying router is not the destination of the FEC, the replier SHOULD compute its downstream routers and the corresponding labels for the incoming label. Then it adds a Downstream Mapping TLV for each one to the echo reply it sends back ๐Ÿ”ฅ

If the Downstream Mapping TLV contains Multipath Information that needs more processing than the receiving router is willing to do, the responding router MAY choose to respond with only a subset of the multipaths contained in the echo request Downstream Mapping. (Note: The originator of the echo request MAY send another echo request with the Multipath Information that wasn't included in the reply.) ๐Ÿ“

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.6. Receiving an MPLS Echo Reply ๐Ÿ’œ

An LSR X should only receive an MPLS echo reply in response to an MPLS echo request that it sent. So when X gets an echo reply, it should parse the packet to make sure it's well-formed. Then it tries to match the echo reply up with an echo request it sent earlier, using the destination UDP port and the Sender's Handle ๐Ÿ•ต๏ธโ€โ™€๏ธ If no match is found, X jettisons the echo reply. Otherwise, it checks whether the Sequence Number matches ๐Ÿ’…

If the echo reply has Downstream Mappings and X wants to traceroute further, it SHOULD copy the Downstream Mapping(s) into its next echo request(s), with the TTL incremented by one ๐Ÿ›ค๏ธ


4.7. Issue with VPN IPv4 and IPv6 Prefixes ๐Ÿ˜ญ

Typically, an LSP ping for a VPN IPv4 prefix or VPN IPv6 prefix is sent with a label stack deeper than 1, and the innermost label has a TTL of 1. This is so the ping ends at the egress PE, before it gets sent on to the customer device ๐Ÿ  However, in certain circumstances the label stack can shrink down to a single label before the ping reaches the egress PE. When that happens, the ping ends too early. One scenario like this is a multi-AS Carrier's Carrier VPN ๐Ÿ’€

To get around this, one approach is for the LSR that receives such a ping to realize that it terminated prematurely, and then send back error code 13. In that case, the initiating LSR can retry the ping after incrementing the TTL on the VPN label. That way, the ingress LSR tries TTL values one by one until it finds one that lets the VPN ping reach the egress PE ๐ŸŽฏ


4.8. Non-compliant Routers ๐Ÿ™ˆ

If the egress for the FEC Stack being pinged doesn't support MPLS ping, then no reply gets sent, which can cause possible "false negatives" ๐Ÿ˜ฌ If you're in "traceroute" mode and a transit LSR doesn't support LSP ping, then no reply comes back from that LSR for some TTL, say, n. The LSR originating the echo request SHOULD try sending the echo request with TTL=n+1, n+2, ..., n+k to probe the LSRs further down the path ๐Ÿงญ In that case, the echo request for TTL > n SHOULD be sent with the Downstream Mapping TLV "Downstream IP Address" field set to the ALLROUTERs multicast address, until a reply with a Downstream Mapping TLV is received. The label stack MAY be omitted from the Downstream Mapping TLV. And the "Validate FEC Stack" flag SHOULD NOT be set until an echo reply packet with a Downstream Mapping TLV is received โœจ


5. References ๐Ÿ“š

5.1. Normative References

[BGP]          Rekhter, Y., Li, T., and S. Hares, "A Border Gateway
               Protocol 4 (BGP-4)", RFC 4271, January 2006.

[IANA]         Narten, T. and H. Alvestrand, "Guidelines for Writing
               an IANA Considerations Section in RFCs", BCP 26, RFC
               2434, October 1998.

[KEYWORDS]     Bradner, S., "Key words for use in RFCs to Indicate
               Requirement Levels", BCP 14, RFC 2119, March 1997.

[LABEL-STACK]  Rosen, E., Tappan, D., Fedorkow, G., Rekhter, Y.,
               Farinacci, D., Li, T., and A. Conta, "MPLS Label Stack
               Encoding", RFC 3032, January 2001.

[NTP]          Mills, D., "Simple Network Time Protocol (SNTP)
               Version 4 for IPv4, IPv6 and OSI", RFC 2030, October
               1996.

[RFC1122]      Braden, R., "Requirements for Internet Hosts -
               Communication Layers", STD 3, RFC 1122, October 1989.

[RFC1812]      Baker, F., "Requirements for IP Version 4 Routers",
               RFC 1812, June 1995.

[RFC4026]      Andersson, L. and T. Madsen, "Provider Provisioned
               Virtual Private Network (VPN) Terminology", RFC 4026,
               March 2005.

5.2. Informative References

[BGP-LABEL]    Rekhter, Y. and E. Rosen, "Carrying Label Information
               in BGP-4", RFC 3107, May 2001.

[ICMP]         Postel, J., "Internet Control Message Protocol", STD
               5, RFC 792, September 1981.

[LDP]          Andersson, L., Doolan, P., Feldman, N., Fredette, A.,
               and B. Thomas, "LDP Specification", RFC 3036, January
               2001.

[PW-CONTROL]   Martini, L., El-Aawar, N., Heron, G., Rosen, E.,
               Tappan, D., and  T. Smith, "Pseudowire Setup and
               Maintenance using the Label Distribution Protocol",
               Work in Progress.

[RFC4365]      Rosen, E., "Applicability Statement for BGP/MPLS IP
               Virtual Private Networks (VPNs)", RFC 4365, February
               2006.

[RSVP-TE]      Awduche, D., Berger, L., Gan, D., Li, T., Srinivasan,
               V., and G. Swallow, "RSVP-TE: Extensions to RSVP for
               LSP Tunnels", RFC 3209, December 2001.

[VCCV]         Nadeau, T. and R. Aggarwal, "Pseudo Wire Virtual
               Circuit Connectivity Verification (VCCV), Work in
               Progress, August 2005.

[VPLS-BGP]     Kompella, K. and Y. Rekhter, "Virtual Private LAN
               Service", Work in Progress.

6. Security Considerations ๐Ÿ”

Okay, so bestie, the security needs for LSP ping are basically the same as for ICMP ping. Familiar vibes ๐Ÿ’…

There are at least three ways someone could attack LSRs using these mechanisms ๐Ÿ˜ฌ

  • Denial-of-Service: sending MPLS echo requests/replies to LSRs to increase their workload.
  • Obfuscating the data plane: messing with the state of MPLS data plane liveness by spoofing, hijacking, replaying, or otherwise tampering with MPLS echo requests and replies.
  • Information gathering: an unauthorized source using an LSP ping to obtain information about the network.

To block Denial-of-Service attacks, it is RECOMMENDED that implementations regulate the LSP ping traffic going to the control plane ๐Ÿ›ก๏ธ A rate limiter SHOULD be applied to the well-known UDP port defined below.

Unsophisticated replay and spoofing attacks that fake or replay MPLS echo reply messages are unlikely to work ๐Ÿ™ˆ The replies would have to match the Sender's Handle and Sequence Number of an outstanding MPLS echo request message. A non-matching replay gets discarded because the sequence has already moved on, so a spoof only has a tiny window of opportunity. For an even stronger defense, an implementation MAY also validate the TimeStamp Sent by requiring an exact match on this field ๐Ÿ”ฅ

To keep unauthorized sources from using MPLS echo request messages to snoop on network information, it is RECOMMENDED that implementations provide a means of checking the source addresses of MPLS echo request messages against an access list before accepting the message ๐Ÿšซ

It is 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 is not working as it should.

It does not seem vital (at this point) to secure the data carried in MPLS echo requests and replies, although some people may consider knowledge of the MPLS data plane state confidential ๐Ÿคซ Implementations SHOULD, however, provide a means of filtering the addresses to which echo reply messages may be sent ๐ŸŽ€

Okay, the 127/8 situation is a whole thing. This document uses 127/8 addresses, but only together with UDP port 3503, and only routers process these packets. Every other host 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 the range 127/8 without a destination UDP port of 3503 MUST be treated in accordance to RFC 1812. By default, packets aimed at a 127/8 address are treated as "martians" ๐Ÿ‘ฝ

7. IANA Considerations ๐ŸŒธ

The TCP and UDP port number 3503 has been allocated by IANA for LSP echo requests and replies ๐Ÿฆ‹

The following sections cover the new name spaces that IANA will manage. Each name space is split into assignment ranges, and the procedures IANA uses to allocate values are described with these terms: "Standards Action" (as defined in [IANA]), "Specification Required", and "Vendor Private Use" โœจ

Values from "Specification Required" ranges MUST be registered with IANA. The request MUST be made via an Experimental RFC that describes the format and procedures for using the code point, and the actual assignment is made during the IANA actions for that RFC ๐Ÿ“

Values from "Vendor Private" ranges MUST NOT be registered with IANA. However, the message MUST contain an enterprise code registered with the IANA SMI Private Network Management Private Enterprise Numbers ๐Ÿข For each name space that has a Vendor Private range, it must be specified where exactly the SMI Private Enterprise Number lives, and there are examples below. This is how several enterprises (vendors) can use the same code point without fear of collision ๐Ÿ’…

7.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 โœจ

7.2. TLVs

IANA has created and will maintain 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 its TLV. The number spaces for the sub-TLVs of different TLVs are independent of each other ๐Ÿ“

The valid range for TLVs and sub-TLVs is 0-65535. Assignments in the range 0-16383 and 32768-49161 are made via Standards Action as defined in [IANA]. Assignments in the range 16384-31743 and 49162-64511 are made via "Specification Required" as defined above. Values in the range 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          Not Assigned
                      6          VPN IPv4 prefix
                      7          VPN IPv6 prefix
                      8          L2 VPN endpoint
                      9          "FEC 128" Pseudowire (Deprecated)
                     10          "FEC 128" Pseudowire
                     11          "FEC 129" Pseudowire
                     12          BGP labeled IPv4 prefix
                     13          BGP labeled IPv6 prefix
                     14          Generic IPv4 prefix
                     15          Generic IPv6 prefix
                     16          Nil FEC
         2                       Downstream Mapping
         3                       Pad
         4                       Not Assigned
         5                       Vendor Enterprise Number
         6                       Not Assigned
         7                       Interface and Label Stack
         8                       Not Assigned
         9                       Errored TLVs
                 Any value       The TLV not understood
        10                       Reply TOS Byte

8. Acknowledgements ๐Ÿ’œ

This document is the outcome of many discussions among many people, including Manoj Leelanivas, Paul Traina, Yakov Rekhter, Der-Hwa Gan, Brook Bailey, Eric Rosen, Ina Minei, Shivani Aggarwal, and Vanson Lim ๐Ÿซถ

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

Authors' Addresses ๐Ÿ“ฎ

   Kireeti Kompella
   Juniper Networks
   1194 N.Mathilda Ave
   Sunnyvale, CA 94089

   EMail:  kireeti@juniper.net


   George Swallow
   Cisco Systems
   1414 Massachusetts Ave,
   Boxborough, MA 01719

   Phone:  +1 978 936 1398
   EMail:  swallow@cisco.com

Copyright (C) The Internet Society (2006).

This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

This document and the information contained herein are provided on an "AS IS" basis, and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ๐Ÿ’€

Intellectual Property ๐ŸŽ€

The IETF takes no position on the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document, or on whether any license under such rights might or might not be available. It also doesn't represent that it has made any independent effort to identify any such rights. Information on the procedures for rights in RFC documents can be found in BCP 78 and BCP 79 ๐Ÿ“–

Copies of IPR disclosures made to the IETF Secretariat, any assurances of licenses to be made available, or the result of an attempt to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr ๐Ÿ”—

The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology required to implement this standard. Please send that information to the IETF at ietf-ipr@ietf.org ๐Ÿ’Œ

Acknowledgement ๐Ÿงก

Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA) ๐ŸŒŸ

๐Ÿ“ฆ where this page comes from