Network Working Group                                      Loa Andersson
Internet Draft                                         Bay                                      Nortel Networks Inc.
Expiration Date: February May 1999
                                                             Paul Doolan
                                                       Ennovate Networks

                                                           Nancy Feldman
                                                                IBM Corp

                                                          Andre Fredette
                                                       Bay
                                                    Nortel Networks Inc.

                                                              Bob Thomas
                                                     Cisco Systems, Inc.

                                                             August

                                                           November 1998

                           LDP Specification

                       draft-ietf-mpls-ldp-01.txt

                       draft-ietf-mpls-ldp-02.txt

Status of this Memo

   This document is an Internet-Draft.  Internet-Drafts are working
   documents of the Internet Engineering Task Force (IETF), its areas,
   and its working groups.  Note that other groups may also distribute
   working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   To learn the current status of any Internet-Draft, please check the
   "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow
   Directories on ftp.is.co.za (Africa), nic.nordu.net (Europe),
   munnari.oz.au (Pacific Rim), ftp.ietf.org ds.internic.net (US East Coast), or
   ftp.isi.edu (US West Coast).

Abstract

   An overview of Multi Protocol Label Switching (MPLS) is provided in
   [FRAMEWORK] and a proposed architecture in [ARCH].  A fundamental
   concept in MPLS is that two Label Switching Routers (LSRs) must agree
   on the meaning of the labels used to forward traffic between and
   through them.  This common understanding is achieved by using the
   Label Distribution Protocol (LDP) referenced in [FRAMEWORK] and [ARCH].  This
   document defines the LDP protocol.

Open Issues

   The following LDP issues are left unresolved with this version of the
   spec:

Changes from Previous Draft

     - The loop prevention/detection mechanism to be employed by LDP. This spec has retained draft removes the explicit path vector setup mechanism from previous
       drafts.  However, draft-ohba-mpls-loop-prevention-01.txt has been
       proposed as an alternative. the
       spec.

     - Support for explicitly routed LSPs.  The need for this feature
       has been debated at length. This spec refines the previous
       version of draft removes loop prevention from the spec in this area.  However, there remains some
       belief in spec.  The MPLS
       working group will continue to evaluate and compare the WG two
       leading contenders for loop prevention:  loop prevention via path
       vectors and draft-ohba-mpls-loop-prevention-01.txt.  We expect
       that explicitly routed LSPs should one of these methods will be supported
       by enhancements to RSVP selected and not LDP.

       The support for explicitly routed LSPs in the spec is independent added to a later
       version of other LDP features LDP.

     - This draft retains and could, should refines the WG decide to do so,
       be removed without impact path vector mechanism for
       optional loop detection.  In addition, it introduces an upper
       limit on other LDP features. the size of path vectors.

     - Traffic engineering considerations beyond support This draft specifies parameters for explicit
       routing.

     - The need the exponential backup used
       to throttle session setup retry attempts.  It also specifies a
       mechanism for all of resetting the FEC types (called FEC elements backoff parameters in this
       version of response to LSR
       configuration changes by adding an optional parameter to the spec, SMDs in previous versions) is being debated.
       Hello message.

     - This version of the spec defines fewer FEC types than previous
       versions. draft adds Appendix "LDP Label Distribution Procedures".

     - LDP support This draft adds rules for multicast is not defined resolving differences in this version.
       Multicast support will be addressed the Label
       Distribution Discipline and Merge session parameters exchanged in a future version.
       the Initialization message.

     - The This draft modifies message and TLV encodings are likely to change in some minor
       ways in the next draft slightly by adding
       explicit specification of LSR behavior when an LSR does not
       recognize the spec.

Table of Contents

    1          LDP Overview  .......................................   6
    1.1        LDP Peers  ..........................................   6
    1.2        LDP Message Exchange  ...............................   6
    1.3        LDP Error Handling  .................................   7
    1.4        LDP Extensibility message or TLV.

     - This draft modifies the encodings for the Initialization and Future Compatibility  .........   8
    2          LDP Operation  ......................................   8
    2.1        FEC Types  ..........................................   8
    2.2        Mapping packets
       Hello messages to FECs   ...........................   9
    2.3        Label Spaces, Identifiers, Sessions group parameters likely to be used together and Transport  ..  10
    2.4        LDP Sessions between non-Directly Connected LSRs  ...  11
    2.5        LDP Discovery   .....................................  12
    2.5.1      Basic Discovery Mechanism  ..........................  12
    2.5.2      Extended Discovery Mechanism  .......................  12
    2.6        Establishing
       to reduce message sizes.  It defines some new TLVs for use with
       these messages and Maintaining LDP Sessions  ..........  13
    2.6.1      LDP Session Establishment  ..........................  13
    2.6.2      Transport Connection Establishment  .................  13
    2.6.3      Session Initialization  .............................  14
    2.6.4      Initialization State Machine  .......................  16
    2.6.5      Maintaining Hello Adjacencies  ......................  19
    2.6.6      Maintaining LDP Sessions  ...........................  19
    2.7 eliminates some previously defined TLVs.

     - This draft specifies a procedure for negotiating the maximum PDU
       length to be used for a session.

     - This draft simplifies the encodings for the Label Distribution and Management  ..................  20
    2.7.1 Mapping, Label Distribution Control Mode  ....................  20
    2.7.2
       Request, Label Retention Mode  ...............................  21
    2.7.3 Withdraw and Label Advertisement Mode  ...........................  22
    2.8        LDP Identifiers Release messages by eliminating
       the FEC-Label Mapping, FEC-Request, and Next Hop Addresses  .............  22
    2.9        Loop Detection  .....................................  22
    2.10       Loop Prevention via Diffusion  ......................  23
    2.11       Explicitly Routing LSPs  ............................  24
    2.12       ERLSP State Machine  ................................  28
    2.12.1     Loose Segment Peg LSR Transitions:  .................  29
    2.12.2     Loose Segment Non-Peg LSR Transitions:  .............  33
    2.12.2.1   Strict Segment Transitions  .........................  35
    2.12.3     ERLSP Timeouts  .....................................  35
    2.12.4     ERLSP Error Codes  ..................................  35
    3          Protocol Specification  .............................  36
    3.1        LDP PDUs  ...........................................  36
    3.2        Type-Length-Value Encoding  .........................  37
    3.3        Commonly Used TLVs  .................................  38
    3.3.1      FEC TLV  ............................................  38
    3.3.1.1    FEC Procedures  .....................................  41
    3.3.2      Label TLVs  .........................................  41
    3.3.2.1    Generic Label TLV  ..................................  42
    3.3.2.2    ATM Label TLV  ......................................  42
    3.3.2.3    Frame Relay Label TLV  ..............................  43
    3.3.3      Address List TLV  ...................................  43
    3.3.4      COS TLV  ............................................  44
    3.3.5      Hop Count TLV  ......................................  45
    3.3.5.1    Hop Count Procedures  ...............................  45
    3.3.6      Path Vector TLV  ....................................  46
    3.3.6.1    Path Vector Procedures  .............................  46
    3.3.7      Status FEC-Withdraw-Release
       TLVs.

     - This draft modifies the CoS TLV  .........................................  47
    3.4        LDP Messages  .......................................  48
    3.4.1      Notification Message  ...............................  50
    3.4.1.1    Notification Message Procedures  ....................  51
    3.4.1.2    Events Signalled by Notification Messages  ..........  51
    3.4.1.2.1  Malformed PDU or Message  ...........................  52
    3.4.1.2.2  Unknown or Malformed TLV  ...........................  52
    3.4.1.2.3  Session Hold Timer Expiration  ......................  53
    3.4.1.2.4  Unilateral Session Shutdown  ........................  53
    3.4.1.2.5  Initialization Message Events  ......................  53
    3.4.1.2.6  Events Resulting From Other Messages  ...............  54
    3.4.1.2.7  Explicitly Routed LSP Setup Events  .................  54
    3.4.1.2.8  Miscellaneous Events  ...............................  54
    3.4.2      Hello Message  ......................................  54
    3.4.2.1    Hello Message Procedures  ...........................  55
    3.4.3      Initialization Message  .............................  57
    3.4.3.1    Initialization Message Procedures  ..................  61
    3.4.4      KeepAlive Message  ..................................  61
    3.4.4.1    KeepAlive Message Procedures  .......................  62
    3.4.5      Address Message  ....................................  62
    3.4.5.1    Address Message Procedures  .........................  63
    3.4.6      Address Withdraw Message  ...........................  64
    3.4.6.1    Address Withdraw specifying that its detailed
       definition is a subject for further study.

     - This draft adds a Return Message Procedures  ................  64
    3.4.7 Id optional parameter to the
       Label Mapping Message  ..............................  64
    3.4.7.1 Request message and a Label Mapping Request Message Procedures  ...................  66
    3.4.7.1.1  Independent Control Mapping  ........................  66
    3.4.7.1.2  Ordered Control Mapping  ............................  67
    3.4.7.1.3  Downstream-on-Demand Id parameter to
       the Label Advertisement  ...........  67
    3.4.7.1.4  Downstream Allocation Mapping message to enable an LSR to match received
       Label Advertisement  ..........  68
    3.4.8 Mapping messages with outstanding Label Request Message  ..............................  68
    3.4.8.1    Label Request Message Procedures  ...................  69
    3.4.9      Label Withdraw Message  .............................  70
    3.4.9.1    Label Withdraw Message Procedures  ..................  71
    3.4.10     Label Release Message  ..............................  72
    3.4.10.1   Label Release Message Procedures  ...................  73
    3.4.11     Label Query Message  ................................  73
    3.4.11.1   Label Query Message Procecures  .....................  74
    3.4.12     Explicit Route Request Message  .....................  74
    3.4.12.1   Explicit Route Request Procedures  ..................  78
    3.4.13     Explicit Route Response Message  ....................  78
    3.4.13.1   Explicit Route Response Procedures  .................  79
    3.5        Messages messages.

     - This draft refines support for vendor-private protocol extensions
       and TLVs specifies support for Extensibility  ................  80
    3.5.1      Procedures experimental protocol extensions.

     - This draft specifies optional use of the TCP MD5 Signature Option
       to protect against the introduction of spoofed TCP segments into
       LDP session connection streams.

Open Issues

   The following LDP issues are left unresolved with this version of the
   spec:

     - LDP support for Unknown Messages and TLVs  ...........  80
    3.5.1.1    Unknown Message Types  ..............................  80
    3.5.1.2    Unknown TLV CoS is not completely specified in Known Message Type  ..................  80
    3.5.2 this version.
       Cos support will be more fully addressed in a future version.

     - LDP Vendor-Private Extensions  ......................  81
    3.5.2.1 support for multicast is not specified in this version.
       Multicast support will be addressed in a future version.

     - LDP Vendor-Private TLV  .............................  81
    3.5.2.2 support for multipath label switching is not specified in
       this version.  Multipath support will be addressed in a future
       version.

Table of Contents

    1          LDP Vendor-Private Messages  ........................  82
    3.6        TLV Summary  ........................................  83
    3.7        Status Code Summary  ................................  84
    4          Security  ...........................................  84
    5          Acknowledgments  ....................................  84
    6          References  .........................................  84 Overview  .......................................   7          Author Information  .................................  85

1.
    1.1        LDP Overview Peers  ..........................................   7
    1.2        LDP is the set of procedures and messages by which Label Switched
   Routers (LSRs) establish Label Switched Paths (LSPs) through a
   network by mapping network-layer routing information directly to
   data-link layer switched paths.  These LSPs may have an endpoint at a
   directly attached neighbor (comparable to IP hop-by-hop forwarding),
   or may have an endpoint at a network egress node, enabling switching
   via all intermediary nodes. Message Exchange  ...............................   7
    1.3        LDP associates a forwarding equivalence class (FEC) [ARCH] with each
   LSP it creates. The FEC associated with an LSP specifies which
   packets are "mapped" to that LSP.  LSPs are extended through a
   network as each LSR "splices" incoming labels for a FEC to the
   outgoing label assigned to the next hop for the given FEC.

   Note that this document is written with respect to unicast routing
   only. Multicast will be addressed in a future revision.

   Note that this document is written with respect to control-driven
   traffic.  It describes mappings which are initiated for routes in the
   forwarding table, regardless of traffic over those routes.  However, Message Structure  ..............................   8
    1.4        LDP does not preclude data-driven support.

1.1. Error Handling  .................................   8
    1.5        LDP Peers

   Two LSRs which use Extensibility and Future Compatibility  .........   9
    2          LDP to exchange label/stream mapping information
   are known as "LDP Peers" with respect to that information Operation  ......................................   9
    2.1        FECs  ...............................................   9
    2.2        Label Spaces, Identifiers, Sessions and we
   speak of there being an "LDP Session" between them. A single Transport  ..  10
    2.2.1      Label Spaces  .......................................  10
    2.2.2      LDP
   adjacency allows each peer to learn the other's label mappings i.e.
   the protocol is bi-directional.

1.2. Identifiers  ....................................  11
    2.2.3      LDP Message Exchange

   There are four categories of Sessions  .......................................  11
    2.2.4      LDP messages:

      1. Discovery messages, used to announce and maintain the presence
         of an LSR in a network.

      2. Session messages, used to establish and maintain terminate
         sessions Transport  ......................................  11
    2.3        LDP Sessions between LSR peers.

      3. Advertisement messages, used to create, change, and delete
         label mappings for FECs.

      4. Notification messages, used to provide advisory information and
         to signal errors.

   Discovery messages provide a mechanism whereby non-Directly Connected LSRs continually
   indicate their presence in a network via the Hello message.  This is
   transmitted as a UDP packet to the  ...  12
    2.4        LDP port at the `all LSR routers'
   group multicast address.  When an LSR chooses to establish a session
   with an LSR learned via the hello message, it uses the Discovery   .....................................  12
    2.4.1      Basic Discovery Mechanism  ..........................  12
    2.4.2      Extended Discovery Mechanism  .......................  13
    2.5        Establishing and Maintaining LDP
   initialization procedure over TCP transport.  Upon successful
   completion of the initialization procedure, the two LSRs are Sessions  ..........  14
    2.5.1      LDP
   peers, and may exchange advertisement messages.

   When to request a label or advertise a label mapping to a peer is
   largely a local decision made by an LSR.  In general, the LSR
   requests a label mapping from a neighboring LSR when it needs one,
   and advertises a label mapping to a neighboring LSR when it wishes
   the neighbor to use a label.

   Correct operation of Session Establishment  ..........................  14
    2.5.2      Transport Connection Establishment  .................  14
    2.5.3      Session Initialization  .............................  15
    2.5.4      Initialization State Machine  .......................  17
    2.5.5      Maintaining Hello Adjacencies  ......................  20
    2.5.6      Maintaining LDP requires reliable Sessions  ...........................  20
    2.6        Label Distribution and in order delivery of
   mappings (although there are circumstances when this second
   requirement could be relaxed). To satisfy these requirements Management  ..................  21
    2.6.1      Label Distribution Control Mode  ....................  21
    2.6.1.1    Independent Label Distribution Control  .............  21
    2.6.1.2    Ordered Label Distribution Control  .................  21
    2.6.2      Label Retention Mode  ...............................  22
    2.6.2.1    Conservative Label Retention Mode  ..................  22
    2.6.2.2    Liberal Label Retention Mode  .......................  22
    2.6.3      Label Advertisement Mode  ...........................  23
    2.7        LDP uses
   the TCP transport for adjacency, advertisement Identifiers and notification
   messages.

1.3. LDP Error Handling Next Hop Addresses  .............  23
    2.8        Loop Detection  .....................................  24
    2.8.1      Label Request Message  ..............................  24
    2.8.2      Label Mapping Message  ..............................  26
    2.8.3      Discussion  .........................................  27
    3          Protocol Specification  .............................  28
    3.1        LDP errors and other events of interest are signaled to an LSR peer
   by notification messages.

   There are two kinds of PDUs  ...........................................  28
    3.2        LDP notification messages:

      1. Error notifications, used to signal fatal errors.  If an LSR
         receives an error notification Procedures  .....................................  29
    3.3        Type-Length-Value Encoding  .........................  30
    3.4        TLV Encodings for an Commonly Used Parameters  .........  31
    3.4.1      FEC TLV  ............................................  31
    3.4.1.1    FEC Procedures  .....................................  34
    3.4.2      Label TLVs  .........................................  34
    3.4.2.1    Generic Label TLV  ..................................  34
    3.4.2.2    ATM Label TLV  ......................................  34
    3.4.2.3    Frame Relay Label TLV  ..............................  35
    3.4.3      Address List TLV  ...................................  36
    3.4.4      COS TLV  ............................................  37
    3.4.5      Hop Count TLV  ......................................  37
    3.4.5.1    Hop Count Procedures  ...............................  38
    3.4.6      Path Vector TLV  ....................................  38
    3.4.6.1    Path Vector Procedures  .............................  39
    3.4.6.1.1  Label Request Path Vector  ..........................  39
    3.4.6.1.2  Label Mapping Path Vector  ..........................  40
    3.4.7      Status TLV  .........................................  40
    3.5        LDP session with a peer,
         it terminates the peer session Messages  .......................................  42
    3.5.1      Notification Message  ...............................  44
    3.5.1.1    Notification Message Procedures  ....................  45
    3.5.1.2    Events Signaled by closing the TCP transport
         connection for the session and discarding all label mappings
         learned via the session.

      2. Advisory notifications, used to pass an LSR information about
         the LDP session Notification Messages  ...........  45
    3.5.1.2.1  Malformed PDU or the status of some previous message received
         from the peer.

1.4. LDP Extensibility Message  ...........................  46
    3.5.1.2.2  Unknown or Malformed TLV  ...........................  46
    3.5.1.2.3  Session Hold Timer Expiration  ......................  47
    3.5.1.2.4  Unilateral Session Shutdown  ........................  47
    3.5.1.2.5  Initialization Message Events  ......................  47
    3.5.1.2.6  Events Resulting From Other Messages  ...............  47
    3.5.1.2.7  Miscellaneous Events  ...............................  48
    3.5.2      Hello Message  ......................................  48
    3.5.2.1    Hello Message Procedures  ...........................  50
    3.5.3      Initialization Message  .............................  51
    3.5.3.1    Initialization Message Procedures  ..................  58
    3.5.4      KeepAlive Message  ..................................  59
    3.5.4.1    KeepAlive Message Procedures  .......................  59
    3.5.5      Address Message  ....................................  59
    3.5.5.1    Address Message Procedures  .........................  60
    3.5.6      Address Withdraw Message  ...........................  61
    3.5.6.1    Address Withdraw Message Procedures  ................  61
    3.5.7      Label Mapping Message  ..............................  61
    3.5.7.1    Label Mapping Message Procedures  ...................  63
    3.5.7.1.1  Independent Control Mapping  ........................  63
    3.5.7.1.2  Ordered Control Mapping  ............................  64
    3.5.7.1.3  Downstream-on-Demand Label Advertisement  ...........  64
    3.5.7.1.4  Downstream Unsolicited Label Advertisement  .........  65
    3.5.8      Label Request Message  ..............................  65
    3.5.8.1    Label Request Message Procedures  ...................  66
    3.5.9      Label Withdraw Message  .............................  67
    3.5.9.1    Label Withdraw Message Procedures  ..................  68
    3.5.10     Label Release Message  ..............................  69
    3.5.10.1   Label Release Message Procedures  ...................  70
    3.6        Messages and Future Compatibility

   It is likely that functionality will be added to TLVs for Extensibility  ................  71
    3.6.1      LDP after its
   initial release.  It is also likely that this additional
   functionality will utilize new messages and object types (TLVs).  It
   may be desirable to employ such new messages and Vendor-private Extensions  ......................  71
    3.6.1.1    LDP Vendor-private TLVs within a
   network using older implementations that do not recognize them.
   While it is not possible to make every future enhancement backwards
   compatible, some prior planning can ease the introduction of new
   capabilities.  This specification defines rules for handling unknown
   message types and unknown TLVs for this purpose.

2.  ............................  71
    3.6.1.2    LDP Operation

2.1. FEC Types

   It is necessary to precisely define which IP packets may be mapped to
   each LSP. This is done by providing a FEC specification for each LSP. Vendor-private Messages  ........................  72
    3.6.2      LDP Experimental Extensions  ........................  74
    3.7        Message Summary  ....................................  74
    3.8        TLV Summary  ........................................  75
    3.9        Status Code Summary  ................................  76
    3.10       UDP and TCP Ports  ..................................  76
    4          Security  ...........................................  77
    4.1        The FEC defines which IP packets may be mapped to the same LSP, using
   a unique label. TCP MD5 Signature Option  .......................  77
    4.2        LDP supports LSP granularity ranging from end-to-end flows to the
   aggregation of all traffic through a common egress node; the choice Use of granularity is determined by the TCP MD5 Signature Option  ............  78
    5          Intellectual Property Considerations  ...............  79
    6          Acknowledgments  ....................................  79
    7          References  .........................................  79
    8          Author Information  .................................  80

    Appendix.A LDP Label Distribution Procedures  ..................  82
    A.1        Handling Label Distribution Events  .................  84
    A.1.1      Receive Label Request  ..............................  85
    A.1.2      Receive Label Mapping  ..............................  88
    A.1.3      Receive Label Release  ..............................  92
    A.1.4      Receive Label Withdraw  .............................  94
    A.1.5      Recognize New FEC choice.

   Each  ..................................  95
    A.1.6      Detect change in FEC is specified as next hop  ......................  98
    A.1.7      Receive Notification / No Label Resources  .......... 100
    A.1.8      Receive Notification / No Route  .................... 101
    A.1.9      Receive Notification / Loop Detected  ............... 102
    A.1.10     Receive Notification / Label Resources Available  ... 102
    A.1.11     Detect local label resources have become available  . 103
    A.1.12     LSR decides to no longer label switch a list of one or more FEC elements. Each FEC
   element specifies a  ........ 104
    A.1.13     Timeout of deferred label request  .................. 104
    A.2        Common Label Distribution Procedures  ............... 105
    A.2.1      Send_Label  ......................................... 105
    A.2.2      Send_Label_Request  ................................. 107
    A.2.3      Send_Label_Withdraw  ................................ 108
    A.2.4      Send_Notification  .................................. 108
    A.2.5      Send_Message  ....................................... 109
    A.2.6      Check_Received_Attributes  .......................... 109
    A.2.7      Prepare_Label_Request_Attributes  ................... 110
    A.2.8      Prepare_Label_Mapping_Attributes  ................... 112

1. LDP Overview

   LDP is the set of IP packets procedures and messages by which Label Switched
   Routers (LSRs) establish Label Switched Paths (LSPs) through a
   network by mapping network-layer routing information directly to
   data-link layer switched paths.  These LSPs may be mapped to the
   corresponding LSP.

   Following are the currently defined types of FEC elements. New
   element types may be added as needed:

      1. IP Address Prefix.

         This element provides have an endpoint at a list of one or more IP address
         prefixes.  Any
   directly attached neighbor (comparable to IP packet whose destination address matches one hop-by-hop forwarding),
   or more of the specified prefixes may be forwarded using the
         associated LSP.

      2. Router ID

         This element provides have an endpoint at a Router ID (ie, network egress node, enabling switching
   via all intermediary nodes.

   LDP associates a 32 bit IP address of Forwarding Equivalence Class (FEC) [ARCH] with each
   LSP it creates. The FEC associated with an LSP specifies which
   packets are "mapped" to that LSP.  LSPs are extended through a
         router). Any IP packet
   network as each LSR "splices" incoming labels for which the path a FEC to the destination is
         known
   outgoing label assigned to traverse the specified router may be forwarded using the associated LSP. This element allows next hop for the full set of
         destinations reachable via a specified router given FEC.

   Note that this document is written with respect to unicast routing
   only. Multicast will be indicated addressed in a single FEC element.

      3. Flow

         This element specifies a set of datagram information, such as
         port, dest-addr, src-addr, etc.  This element provides future revision.

1.1. LDP Peers

   Two LSRs which use LDP with
         the ability to support MPLS flows exchange label/stream mapping information
   are known as "LDP Peers" with no aggregation.

   Where a packet maps respect to more than one FEC it is transmitted on the LSP
   associated with the FEC that information and we
   speak of there being an "LDP Session" between them.  A single LDP
   session allows each peer to which learn the packet has other's label mappings; i.e.,
   the 'most specific'
   match.

2.2. Mapping packets to FECs

   FEC objects (TLVs) protocol is bi-directional.

1.2. LDP Message Exchange

   There are transmitted in four categories of LDP messages:

      1. Discovery messages, used to announce and maintain the presence
         of an LSR in a network.

      2. Session messages, used to establish, maintain, and terminate
         sessions between LDP peers.

      3. Advertisement messages, used to create, change, and delete
         label mappings for FECs.

      4. Notification messages, used to provide advisory information and
         to signal error information.

   Discovery messages that deal with
   (advertise, request, release ad withdraw) FEC-Label mappings.

   A stream of packets with provide a mechanism whereby LSRs indicate their
   presence in a given destination network can be
   characterized by a single Address Prefix FEC Element.  This results
   in each specified address prefix sustaining its own LSP tree. sending the Hello message periodically.
   This
   singular mapping is recommended in environments where little or no
   aggregation information is provided by the routing protocols (such transmitted as
   within a simple IGP), or in networks where UDP packet to the number of destination
   prefixes is limited.

   In environments where additional aggregation not provided by LDP port at the
   routing protocols is desired, `all
   routers' group multicast address.  When an aggregation list may be created.  In
   this, all prefixes that are LSR chooses to share establish a common egress point may be
   advertised within
   session with another LSR learned via the same FEC.  This type of aggregation is
   configured.

   The router ID FEC type may be used in any environment in which Hello message, it uses the
   routing protocols allow routers to determine
   LDP initialization procedure over TCP transport.  Upon successful
   completion of the egress point for
   specific IP packets. For example, the router ID FEC type may be used
   in combination with BGP, OSPF, and/or IS-IS.

   For example, initialization procedure, the mapping between IP packets two LSRs are LDP
   peers, and the router ID may be
   provided via the BGP NEXT_HOP attribute. exchange advertisement messages.

   When to request a BGP border LSR
   injects routes into the BGP mesh, it may use its own IP address label or
   the address of its external BGP advertise a label mapping to a peer as the value of the NEXT_HOP
   attribute.  If the BGP border ISR uses its own IP address as the
   NEXT_HOP attribute, then one LSP is created which terminates at the
   BGP border, and the border LSR will forward traffic at layer-3
   towards its external BGP neighbors.  If
   largely a local decision made by an LSR.  In general, the BGP border LSR uses the
   external BGP peer as the NEXT_HOP attribute, then
   requests a separate LSP may
   be created for each external BGP neighbor, thereby allowing the
   border label mapping from a neighboring LSR when it needs one,
   and advertises a label mapping to switch traffic directly a neighboring LSR when it wishes
   the neighbor to each use a label.

   Correct operation of its external BGP
   neighbors.

   Similarly, the mapping between IP packet LDP requires reliable and router ID may be
   provided by OSPF.  This is comprised in order delivery of
   messages.  To satisfy these requirements LDP uses the Router ID of TCP transport
   for session, advertisement and notification messages; i.e., for
   everything but the router UDP-based discovery mechanism.

1.3. LDP Message Structure

   All LDP messages have a common structure that initiated the link state advertisement. uses a Type-
   Length_Value (TLV) encoding scheme; see Section "Type-Length-Value"
   encoding.  The Router ID Value part of a TLV-encoded object, or TLV for short,
   may also
   be the OSPF Area Border Router.

   Note that BGP itself contain one or more TLVs.

1.4. LDP Error Handling

   LDP errors and OSPF may share the same LSP when a given Router ID
   is found in both protocol's Routing Information Base.

   The Router ID FEC allows aggregation other events of multiple IP address prefixes
   to the same LSP, without requiring that the prefixes be explicitly
   listed in the FEC.  Also, it allows addresses advertised using OSPF
   and addresses advertised using BGP interest are signaled to be aggregated using the same
   LSP.  Finally, when the set of addresses reachable via a router
   changes, and the changes an LDP peer
   by notification messages.

   There are announced into the routing protocol
   (BGP, OSPF, and/or IS-IS), use two kinds of the routerID FEC eliminates the
   need LDP notification messages:

      1. Error notifications, used to explicitly announce signal fatal errors.  If an LSR
         receives an error notification from a peer for an LDP session,
         it terminates the route changes into LDP.

2.3. Label Spaces, Identifiers, Sessions and Transport

   The notion of "label space" is useful LDP session by closing the TCP transport
         connection for discussing the assignment session and distribution of labels.  There are two types of label spaces:

        -    Per interface discarding all label space.  Interface-specific incoming
             labels are mappings
         learned via the session.

      2. Advisory notifications, used for interfaces that use interface resources
             for labels.  An example of such to pass an interface is a label-
             controlled ATM interface which uses VCIs as labels, LSR information about
         the LDP session or a
             frame Relay interface which uses DLCIs as labels.

             Note that the use status of a per interface label space only makes
             sense when some previous message received
         from the peer.

1.5. LDP peers are "directly connected" over an
             interface, Extensibility and Future Compatibility

   Functionality may be added to LDP in the label future.  It is only going to be used for
             traffic sent over likely that interface.

        -    Per platform label space. Platform-wide incoming labels are
             used for interfaces
   future functionality will utilize new messages and object types
   (TLVs).  It may be desirable to employ such new messages and TLVs
   within a network using older implementations that do not recognize
   them.  While it is not possible to make every future enhancement
   backwards compatible, some prior planning can share ease the same labels.

        An introduction
   of new capabilities.  This specification defines rules for handling
   unknown message types and unknown TLVs for this purpose.

2. LDP identifier Operation

2.1. FECs

   It is a six octet quantity used necessary to identify an
        LSR label space.  The first four octets encode an precisely specify which IP address
        assigned packets may be mapped
   to the LSR, and the last two octets identify a specific
        label space within the LSR.  The last two octets of LDP Identif-
        iers for platform-wide label spaces are always both zero. each LSP.  This
        document uses the following print representation for LDP Iden-
        tifiers:

                        <IP address> : <Label space Id>

        for example, 171.32.27.28:0, 192.0.3.5:2.

        Note that an LSR that manages and advertises more than one label
        space uses is done by providing a different LDP Identifier FEC specification for each such label space.

        A situation where an LSR would need to advertise more than one
        label space
   LSP.  The FEC identifies the set of IP packets which may be mapped to
   that LSP.

   Each FEC is specified as a peer and hence use more than set of one LDP Identifier
        occurs when the LSR has two links to the peer and both are ATM
        (and use per interface labels).  Another situation would or more FEC elements.  Each FEC
   element identifies a set of IP packets which may be
        where the LSR had two links mapped to the peer, one of which
   corresponding LSP.  When an LSP is ether-
        net (and uses per platform lables) and shared by multiple FEC elements,
   that LSP is terminated at (or before) the other node where the FEC elements
   can no longer share the same path.

   Following are the currently defined types of which FEC elements.  New
   element types may be added as needed:

      1. IP Address Prefix.  This element is
        ATM.

        LDP sessions exist between LSRs an IP address prefix of any
         length from 0 to support label exchange
        between them.

           When 32 bits, inclusive.

      2. Host Address.  This element is a LSR must use LDP to advertise more than one label
           space 32-bit IP address.

   We say that a particular IP address "matches" a particular IP address
   prefix if and only if that address begins with that prefix.  We also
   say that a particular packet matches a particular LSP if and only if
   that LSP has an IP Address Prefix FEC element which matches the
   packet's IP destination address.  With respect to another LSR it uses a separate LDP session for each
           label space rather than particular packet
   and a single LDP session for all particular LSP, we refer to any IP Address Prefix FEC element
   which matches the
           label spaces.

        LDP uses TCP packet as a reliable transport the "matching prefix".

   The procedure for sessions.

           When multiple LDP sessions are required between two platforms
           there mapping a particular packet to a particular LSP
   uses the following rules.  Each rule is one LDP session per TCP connection rather than many
           LDP sessions per TCP connection.

2.4. LDP Sessions between non-Directly Connected LSRs

   LDP sessions between LSRs that are not directly connected at applied in turn until the link
   level may
   packet can be desirable in some situations.

   For example, consider a "traffic engineering" application where LSR
   LSR1 sends traffic matching some criteria via mapped to an LSP.

     - If there is exactly one LSP which has a Host Address FEC element
       that is identical to non-directly
   connected LSR LSR2 rather than forwarding the traffic along its nor-
   mally routed path.

   An LDP session between LSR1 and LSR2 enables LSR2 to label switch
   traffic arriving on packet's IP destination address, then
       the LSP from LSR1.  In this situation LSR1
   applies two labels packet is mapped to traffic it forwards on the that LSP.  First, it adds
   the label learned via the LDP session with LSR2

     - If there multiple LSPs, each containing a Host Address FEC
       element that is identical to the packet label
   stack (either by replacing packet's IP destination address,
       then the label on top packet is mapped to one of those LSPs.  The procedure
       for selecting one of those LSPs is beyond the scope of this
       document.

     - If a packet label stack
   with it if matches exactly one LSP, the packet arrives labeled or by pushing it if the is mapped to that
       LSP.

     - If a packet
   arrives unlabeled).  Next, matches multiple LSPs, it pushes is mapped to the label for LSP whose
       matching prefix is the longest.  If there is no one LSP onto whose
       matching prefix is longest, the
   label stack.

2.5. LDP Discovery

   LDP discovery packet is a mechanism that enables an LSR to discover poten-
   tial LDP peers.  Discovery makes it unnecessary mapped to explicitly config-
   ure an LSR's label switching peers.

   There are two variants one of those
       LSPs.  The procedure for selecting one of those LSPs is beyond
       the discovery mechanism:

     -    A basic discovery mechanism used to discover LSR neighbors
          that are directly connected at the link level. scope of this document.

     -    An extended discovery mechanism used to locate LSRs If it is known that are
          not directly connected at the link level.

2.5.1. Basic Discovery Mechanism

   To engage in LDP Basic Discovery on a packet must traverse a particular egress
       router, and there is an interface LSP which has an LSR periodically
   sends LDP Link Hellos out IP Address Prefix FEC
       element (of length 32 bits) which is an address of that router,
       then the interface.  LDP Link Hellos are sent as
   UDP packets addressed packet is mapped to the well known LDP discovery port that LSP.  The procedure for
       obtaining this knowledge is beyond the
   "all routers" group multicast address.

   An LDP Link Hello sent by an LSR carries the LDP Identifier scope of this document.

2.2. Label Spaces, Identifiers, Sessions and Transport

2.2.1. Label Spaces

   The notion of "label space" is useful for discussing the assignment
   and distribution of labels.  There are two types of label space the LSR intends to use spaces:

     - Per interface label space.  Interface-specific incoming labels
       are used for the interfaces that use interface and possibly
   additional information.

   Receipt resources for labels.
       An example of an LDP Link Hello on such an interface identifies a "Hello
   adjacency" with is a potential LDP peer reachable at the link level on
   the label-controlled ATM
       interface that uses VCIs as well labels, or a Frame Relay interface
       that uses DLCIs as labels.

       Note that the use of a per interface label space the peer intends only makes sense
       when the LDP peers are "directly connected" over an interface,
       and the label is only going to use be used for
   the traffic sent over that
       interface.

2.5.2. Extended Discovery Mechanism

   LDP sessions between non-directly connected LSRs

     - Per platform label space. Platform-wide incoming labels are supported by used
       for interfaces that can share the same labels.

2.2.2. LDP
   Extended Discovery.

   To engage in Identifiers

   An LDP Extended Discovery identifier is a six octet quantity used to identify an LSR periodically sends LDP
   Targeted Hellos
   label space.  The first four octets encode an IP address assigned to
   the LSR, and the last two octets identify a specific IP address.  LDP Targeted Hellos are
   sent as UDP packets addressed to label space
   within the well known LSR.  The last two octets of LDP discovery port at Identifiers for
   platform-wide label spaces are always both zero.  This document uses
   the specific address.

   An following print representation for LDP Targeted Hello sent by Identifiers:

              <IP address> : <label space id>

   e.g., 171.32.27.28:0, 192.0.3.5:2.

   Note that an LSR carries the that manages and advertises multiple label spaces
   uses a different LDP Identifier for
   the each such label space the space.

   A situation where an LSR intends would need to use and possibly additional
   optional information.

   Extended Discovery differs from Basic Discovery in the following
   ways:

     -    A Targeted Hello is sent advertise more than one label
   space to a specific IP address rather peer and hence use more than one LDP Identifier occurs
   when the LSR has two links to the "all routers" group multicast address for peer and both are ATM (and use per
   interface labels).  Another situation would be where the outgoing
          interface.

     -    Unlike Basic Discovery, which is symmetric, Extended Discovery
          is asymmetric.

          One LSR initiates Extended Discovery with another targeted
          LSR, and the targeted LSR decides whether to respond to or
          ignore the Targeted Hello.  A targeted LSR that chooses to
          respond does so by periodically sending Targeted Hellos had two
   links to the
          initiating LSR.

     Receipt peer, one of an LDP Targeted Hello identifies a "Hello adjacency"
     with a potential LDP peer reachable at the network level which is ethernet (and uses per platform
   labels) and the
     label space the peer intends to use.

2.6. Establishing and Maintaining other of which is ATM.

2.2.3. LDP Sessions

2.6.1. LDP Session Establishment

   The exchange of

   LDP Discovery Hellos sessions exist between two LSRs triggers LDP
   session establishment.  Session establishment is a two step process:

           - Transport connection establishment.
           - Session initialization

   The following describes establishment of to support label exchange between
   them.

      When an LSR uses LDP session between LSRs
   LSR1 and LSR2 from LSR1's point of view.  It assumes the exchange of
   Hellos specifying label space LSR1:a for LSR1 and to advertise more than one label space LSR2:b
   for LSR2.

2.6.2. Transport Connection Establishment

   The exchange of Hellos results in to
      another LSR it uses a Hello adjacency at LSR1 which
   binds the link (L) and the label spaces LSR1:a and LSR2:b.

     1.   If LSR1 does not already have an separate LDP session for the exchange
          of each label spaces LSR1:a and LSR2:b it attempts to open an space.

2.2.4. LDP Transport

   LDP uses TCP connection for as a new session with LSR2.

          LSR1 determines the reliable transport addresses to be used at its end
          (A1) and LSR2's end (A2) of the for sessions.

      When multiple LDP TCP connection.  Address
          A1 sessions are required between two LSRs there is determined as follows:

          a)   If LSR1 uses
      one TCP session for each LDP session.

2.3. LDP Sessions between non-Directly Connected LSRs

   LDP sessions between LSRs that are not directly connected at the Transport Address optional object to
               specify link
   level may be desirable in some situations.

   For example, consider a "traffic engineering" application where LSRa
   sends traffic matching some criteria via an address, A1 is LSP to non-directly
   connected LSRb rather than forwarding the address LSR1 advertises via traffic along its normally
   routed path.

   The path between LSRa and LSRb would include one or more intermediate
   LSRs (LSR1,...LSRn).  An LDP session between LSRa and LSRb would
   enable LSRb to label switch traffic arriving on the optional object;

          b)   If LSR1 does not use LSP from LSRa by
   providing LSRb means to advertise labels for this purpose to LSRa.

   In this situation LSRa would apply two labels to traffic it forwards
   on the Transport Address optional
               object, A1 is LSP to LSRb: a label learned from LSR1 to forward traffic
   along the source IP address used for Hellos LSP path from LSRa to
               LSR2.

          Similarly, address A2 is determined as follows:

          a)   If LSR2 uses LSRb; and a label learned from LSRb
   to enable LSRb to label switch traffic arriving on the Transport Address optional object (TLV),
               A2 is LSP.

   LSRa first adds the address LSR2 advertises label learned via its LDP session with LSRb to
   the optional
               object;

          b)   If LSR2 does not use packet label stack (either by replacing the Transport Address optional
               object, A2 is label on top of the source IP address used for Hellos from
               LSR2.

     2.   LSR1 determines whether
   packet label stack with it will play if the active or passive
          role in session establishment packet arrives labeled or by comparing addresses A1 and A2
          as unsigned integers.  If A1 > A2, LSR1 plays
   pushing it if the active role;
          otherwise packet arrives unlabeled).  Next, it is passive.

     3.   If pushes the
   label for the LSP learned from LSR1 onto the label stack.

2.4. LDP Discovery

   LDP discovery is active, a mechanism that enables an LSR to discover
   potential LDP peers.  Discovery makes it attempts unnecessary to establish explicitly
   configure an LSR's label switching peers.

   There are two variants of the discovery mechanism:

     - A basic discovery mechanism used to discover LSR neighbors that
       are directly connected at the link level.

     - An extended discovery mechanism used to locate LSRs that are not
       directly connected at the link level.

2.4.1. Basic Discovery Mechanism

   To engage in LDP TCP con-
          nection by connecting Basic Discovery on an interface an LSR periodically
   sends LDP Link Hellos out the interface.  LDP Link Hellos are sent as
   UDP packets addressed to the well known well-known LDP discovery port at address
          A2.  If LSR1 is passive, it waits for LSR2 to establish the
   "all routers" group multicast address.

   An LDP TCP connection to its well known LDP port.

2.6.3. Session Initialization

   After LSR1 and LSR2 establish a transport connection they negotiate
   session parameters Link Hello sent by exchanging LDP Initialization messages.  The
   parameters negotiated include an LSR carries the LDP protocol version, label distribu-
   tion method, timer values, VPI/VCI ranges Identifier for the
   label controlled ATM,
   DLCI ranges space the LSR intends to use for label controlled Frame Relay, etc.

   Successful negotiation completes establishment the interface and possibly
   additional information.

   Receipt of an LDP session
   between LSR1 and LSR2 for Link Hello on an interface identifies a "Hello
   adjacency" with a potential LDP peer reachable at the advertisement of label spaces LSR1:a
   and LSR2:b.

   The following describes link level on
   the session initialization from LSR1's point
   of view.

     1.   After interface as well as the connection is established, if LSR1 is playing label space the
          active role, it initiates negotiation of session parameters by
          sending an Initialization message peer intends to LSR2.  If LSR1 is
          passive, it waits use for LSR2 to initiate
   the parameter negotia-
          tion.

          In general when there are multiple links interface.

2.4.2. Extended Discovery Mechanism

   LDP sessions between LSR1 and LSR2
          and multiple label spaces to be advertised non-directly connected LSRs are supported by each, the pas-
          sive LDP
   Extended Discovery.

   To engage in LDP Extended Discovery an LSR cannot know which label space periodically sends LDP
   Targeted Hellos to advertise over a
          newly established TCP connection until it receives the first specific IP address.  LDP PDU on the connection.

          By waiting for the Initialization message from its peer the
          passive LSR can match the label space Targeted Hellos are
   sent as UDP packets addressed to be advertised by the
          peer (as determined from the well-known LDP Identifier in the common
          header for discovery port at
   the Initialization message) with a specific address.

   An LDP Targeted Hello adjacency
          previously created when Hellos were exchanged.

     2.   When LSR1 plays the passive role:

          a)   If LSR1 receives sent by an Initialization message it attempts to
               match LSR carries the LDP Identifier carried by the message PDU with
               a Hello adjacency.

          b)   If there is a matching Hello adjacency, the adjacency
               specifies for
   the local label space for the session.

               Next LSR1 checks whether the session parameters proposed LSR intends to use and possibly additional
   optional information.

   Extended Discovery differs from Basic Discovery in the message are acceptable.  If they are, LSR1 replies
               with an Initialization message of its own following
   ways:

     - A Targeted Hello is sent to propose the
               parameters it wishes a specific IP address rather than to use
       the "all routers" group multicast address for the outgoing
       interface.

     - Unlike Basic Discovery, which is symmetric, Extended Discovery is
       asymmetric.

       One LSR initiates Extended Discovery with another targeted LSR,
       and a KeepAlive message the targeted LSR decides whether to
               signal acceptance of LSR2's parameters.  If respond to or ignore the parame-
               ters are not acceptable, LSR1 responds
       Targeted Hello.  A targeted LSR that chooses to respond does so
       by periodically sending a Nak
               message and closing Targeted Hellos to the TCP connection.

          c)   If LSR1 cannot find a matching initiating LSR.

   Receipt of an LDP Targeted Hello adjacency it sends identifies a
               Nak message "Hello adjacency" with
   a potential LDP peer reachable at the network level and closes the TCP connection.

          d)   If LSR1 receives a KeepAlive in response to its Initiali-
               zation message, label
   space the peer intends to use.

2.5. Establishing and Maintaining LDP Sessions

2.5.1. LDP Session Establishment

   The exchange of LDP Discovery Hellos between two LSRs triggers LDP
   session establishment.  Session establishment is operational a two step process:

           - Transport connection establishment.
           - Session initialization

   The following describes establishment of an LDP session between LSRs
   LSR1 and LSR2 from LSR1's point of view.

          e)   If LSR1 receives a Nak message, LSR2 has rejected its
               proposed session parameters and LSR1 closes  It assumes the TCP con-
               nection.

     3.   When exchange of
   Hellos specifying label space LSR1:a for LSR1 plays and label space LSR2:b
   for LSR2.

2.5.2. Transport Connection Establishment

   The exchange of Hellos results in the active role:

          a)   If LSR1 receives creation of a Nak message, LSR2 has rejected its
               proposed session parameters and Hello adjacency
   at LSR1 closes that serves to bind the TCP con-
               nection.

          b) link (L) and the label spaces LSR1:a
   and LSR2:b.

     1.  If LSR1 receives does not already have an Initialization message, it checks
               whether the LDP session parameters are acceptable.  If so, for the exchange
         of label spaces LSR1:a and LSR2:b it
               replies with attempts to open a KeepAlive message.  If the TCP
         connection for a new LDP session parame-
               ters are unacceptable, with LSR2.

         LSR1 sends a Nak message and
               closes determines the connection.

          c)   If LSR1 receives a KeepAlive message, LSR2 has accepted transport addresses to be used at its proposed session parameters.

          d)   When LSR1 has received both an acceptable Initialization
               message end
         (A1) and a KeepAlive message the session is opera-
               tional from LSR1's point LSR2's end (A2) of view.

     It the LDP TCP connection.  Address A1
         is possible for a pair of incompatibly configured LSRs that
     disagree on session parameters to engage in an endless sequence of
     messages determined as each Naks follows:

         a.  If LSR1 uses the other's Initialization messages.  An LSR
     must throttle its session setup retry attempts with an exponential
     backoff Transport Address optional object (TLV) in situations where Initialization messages are being
     Nak'd.  It is also recommended that an LSR detecting such a situa-
     tion take action
             Hello's it sends to notify LSR2 to advertise an operator.

2.6.4. Initialization State Machine

   It address, A1 is convenient to describe LDP session negotiation behavior in
   terms of a state machine.  We define the LDP state machine to have
   five possible states and present
             address LSR1 advertises via the behavior optional object;

         b.  If LSR1 does not use the Transport Address optional object,
             A1 is the source IP address used in Hellos it sends to
             LSR2.

         Similarly, address A2 is determined as a state transition
   table follows:

         a.  If LSR2 uses the Transport Address optional object, A2 is
             the address LSR2 advertises via the optional object;

         b.  If LSR2 does not use the Transport Address optional object,
             A2 is the source IP address in Hellos received from LSR2.

     2.  LSR1 determines whether it will play the active or passive role
         in session establishment by comparing addresses A1 and A2 as a state transition diagram.

               Session Initialization State Transition Table

         STATE         EVENT                              NEW STATE

         NON EXISTENT  Session
         unsigned integers.  If A1 > A2, LSR1 plays the active role;
         otherwise it is passive.

     3.  If LSR1 is active, it attempts to establish the LDP TCP
         connection established INITIALIZED
                       established

         INITIALIZED   Transmit Initialization msg        OPENSENT

                       Receive acceptable                 OPENREC
                             Initialization msg
                         Action: Transmit Initialization
                                 msg and KeepAlive msg

                       Receive Any other by connecting to the well-known LDP msg          NON EXISTENT
                         Action: Transmit Nak msg and
                                 close transport port at address
         A2.  If LSR1 is passive, it waits for LSR2 to establish the LDP
         TCP connection

         OPENREC       Receive KeepAlive msg              OPERATIONAL

                       Receive Any other to its well-known LDP msg          NON EXISTENT
                         Action: Transmit Nak msg port.

2.5.3. Session Initialization

   After LSR1 and
                                 close LSR2 establish a transport connection

         OPENSENT      Receive acceptable                 OPENREC they negotiate
   session parameters by exchanging LDP Initialization msg
                         Action: Transmit KeepAlive msg

                       Receive Any other messages.  The
   parameters negotiated include LDP msg          NON EXISTENT
                         Action: Transmit Nak msg and
                                 close transport connection

         OPERATIONAL   Receive Shutdown msg               NON EXISTENT
                         Action: Transmit Shutdown msg and
                                 close transport connection

                       Receive other protocol version, label
   distribution method, timer values, VPI/VCI ranges for label
   controlled ATM, DLCI ranges for label controlled Frame Relay, etc.

   Successful negotiation completes establishment of an LDP msgs             OPERATIONAL

                       Timeout                            NON EXISTENT
                         Action: Transmit Shutdown msg session
   between LSR1 and
                                 close transport LSR2 for the advertisement of label spaces LSR1:a
   and LSR2:b.

   The following describes the session initialization from LSR1's point
   of view.

   After the connection
              Session is established, if LSR1 is playing the active
   role, it initiates negotiation of session parameters by sending an
   Initialization State Transition Diagram

                                    +------------+
                                    |            |
                      +------------>|NON EXISTENT|<--------------------+
                      |             |            |                     |
                      |             +------------+                     |
                      | Session        |    ^                          |
                      |   connection   |    |                          |
                      | message to LSR2.  If LSR1 is passive, it waits for
   LSR2 to initiate the parameter negotiation.

   In general when there are multiple links between LSR1 and LSR2 and
   multiple label spaces to be advertised by each, the passive LSR
   cannot know which label space to advertise over a newly established  |    | Rx any
   TCP connection until it receives the first LDP msg except    |
                      |                V    |   Init msg or Timeout    |
                      |            +-----------+                       |
         Rx Any other |            |           |                       |
            msg or    |            |INITIALIZED|                       |
            Timeout / |        +---|           |-+                     |
         Tx Nak msg   |        |   +-----------+ |                     |
                      |        | (Passive Role)  | (Active Role)       |
                      |        | Rx Init msg /   | Tx Init msg         |
                      |        | Tx Init msg     |                     |
                      |        |    Tx KeepAlive |                     |
                      |        V    msg          V                     |
                      |   +-------+        +--------+                  |
                      |   |       |        |        |                  |
                      +---|OPENREC|        |OPENSENT|----------------->|
                      +---|       |        |        | Rx Any other msg |
                      |   +-------+        +--------+    or Timeout    |
         Rx KeepAlive |        ^                |     Tx Nak msg       |
            msg       |        |                |                      |
                      |        |                | Rx Init msg /        |
                      |        +----------------+ Tx KeepAlive msg     |
                      |                                                |
                      |      +-----------+                             |
                      +----->|           |                             |
                             |OPERATIONAL|                             |
                             |           |---------------------------->+
                             +-----------+     Rx Shutdown msg
                      All other  |   ^            or TIMEOUT / PDU on the connection.

   By waiting for the Initialization message from its peer the passive
   LSR can match the label space to be advertised by the peer (as
   determined from the LDP msgs |   |         Tx Shutdown msg
                                 |   |
                                 +---+

2.6.5. Maintaining Identifier in the PDU header for the
   Initialization message) with a Hello Adjacencies

   An adjacency previously created
   when Hellos were exchanged.

     1.  When LSR1 plays the passive role:

         a.  If LSR1 receives an Initialization message it attempts to
             match the LDP Identifier carried by the message PDU with a
             Hello adjacency.

         b.  If there is a matching Hello adjacency, the adjacency
             specifies the local label space for the session.

             Next LSR1 checks whether the session parameters proposed in
             the message are acceptable.  If they are, LSR1 replies with
             an Initialization message of its own to propose the
             parameters it wishes to use and a KeepAlive message to
             signal acceptance of LSR2's parameters.  If the parameters
             are not acceptable, LSR1 responds by sending a Session
             Rejected/Parameters Error Notification message and closing
             the TCP connection.

         c.  If LSR1 cannot find a matching Hello adjacency it sends a
             Session Rejected/No Hello Error Notification message and
             closes the TCP connection.

         d.  If LSR1 receives a KeepAlive in response to its
             Initialization message, the session is operational from
             LSR1's point of view.

         e.  If LSR1 receives an Error Notification message, LSR2 has
             rejected its proposed session and LSR1 closes the TCP
             connection.

     2.  When LSR1 plays the active role:

         a.  If LSR1 receives an Error Notification message, LSR2 has
             rejected its proposed session and LSR1 closes the TCP
             connection.

         b.  If LSR1 receives an Initialization message, it checks
             whether the session parameters are acceptable.  If so, it
             replies with a KeepAlive message.  If the session
             parameters are unacceptable, LSR1 sends a Session
             Rejected/Parameters Error Notification message and closes
             the connection.

         c.  If LSR1 receives a KeepAlive message, LSR2 has accepted its
             proposed session parameters.

         d.  When LSR1 has received both an acceptable Initialization
             message and a KeepAlive message the session is operational
             from LSR1's point of view.

       It is possible for a pair of incompatibly configured LSRs that
       disagree on session parameters to engage in an endless sequence
       of messages as each NAKs the other's Initialization messages with
       Error Notification messages.

       An LSR must throttle its session setup retry attempts with an
       exponential backoff in situations where Initialization messages
       are being NAK'd.  It is also recommended that an LSR detecting
       such a situation take action to notify an operator.

       The session establishment setup attempt following a NAK'd
       Initialization message must be delayed no less than 15 seconds,
       and subsequent delays must grow to a maximum delay of no less
       than 2 minutes.  The specific session establishment action that
       must be delayed is the attempt to open the session transport
       connection by the LSR playing the active role.

       The throttled sequence of Initialization NAKs is unlikely to
       cease until operator intervention reconfigures one of the LSRs.
       After such a configuration action there is no further need to
       throttle subsequent session establishment attempts (until their
       initialization messages are NAK'd).

       Due to the asymmetric nature of session establishment,
       reconfiguration of the passive LSR will go unnoticed by the
       active LSR without some further action.  Section "Hello Message"
       describes an optional mechanism an LSR can use to signal
       potential LDP peers that it has been reconfigured.

2.5.4. Initialization State Machine

   It is convenient to describe LDP session negotiation behavior in
   terms of a state machine.  We define the LDP state machine to have
   five possible states and present the behavior as a state transition
   table and as a state transition diagram.

               Session Initialization State Transition Table

         STATE         EVENT                               NEW STATE

         NON EXISTENT  Session TCP connection established  INITIALIZED
                       established

         INITIALIZED   Transmit Initialization msg         OPENSENT
                             (Active Role)

                       Receive acceptable                  OPENREC
                             Initialization msg
                             (Passive Role )
                         Action: Transmit Initialization
                                 msg and KeepAlive msg

                       Receive Any other LDP msg           NON EXISTENT
                         Action: Transmit Error Notification msg
                                 (NAK) and close transport connection

         OPENREC       Receive KeepAlive msg               OPERATIONAL

                       Receive Any other LDP msg           NON EXISTENT
                         Action: Transmit Error Notification msg
                                 (NAK) and close transport connection

         OPENSENT      Receive acceptable                  OPENREC
                             Initialization msg
                         Action: Transmit KeepAlive msg

                       Receive Any other LDP msg           NON EXISTENT
                         Action: Transmit Error Notification msg
                                 (NAK) and close transport connection

         OPERATIONAL   Receive Shutdown msg                NON EXISTENT
                         Action: Transmit Shutdown msg and
                                 close transport connection

                       Receive other LDP msgs              OPERATIONAL

                       Timeout                             NON EXISTENT
                         Action: Transmit Shutdown msg and
                                 close transport connection
              Session Initialization State Transition Diagram

                                    +------------+
                                    |            |
                      +------------>|NON EXISTENT|<--------------------+
                      |             |            |                     |
                      |             +------------+                     |
                      | Session        |    ^                          |
                      |   connection   |    |                          |
                      |   established  |    | Rx any LDP msg except    |
                      |                V    |   Init msg or Timeout    |
                      |            +-----------+                       |
         Rx Any other |            |           |                       |
            msg or    |            |INITIALIZED|                       |
            Timeout / |        +---|           |-+                     |
         Tx NAK msg   |        |   +-----------+ |                     |
                      |        | (Passive Role)  | (Active Role)       |
                      |        | Rx Acceptble    | Tx Init msg         |
                      |        |    Init msg /   |                     |
                      |        | Tx Init msg     |                     |
                      |        |    Tx KeepAlive |                     |
                      |        V    msg          V                     |
                      |   +-------+        +--------+                  |
                      |   |       |        |        |                  |
                      +---|OPENREC|        |OPENSENT|----------------->|
                      +---|       |        |        | Rx Any other msg |
                      |   +-------+        +--------+    or Timeout    |
         Rx KeepAlive |        ^                |     Tx NAK msg       |
            msg       |        |                |                      |
                      |        |                | Rx Acceptable        |
                      |        |                |    Init msg /        |
                      |        +----------------+ Tx KeepAlive msg     |
                      |                                                |
                      |      +-----------+                             |
                      +----->|           |                             |
                             |OPERATIONAL|                             |
                             |           |---------------------------->+
                             +-----------+     Rx Shutdown msg
                      All other  |   ^            or Timeout /
                        LDP msgs |   |         Tx Shutdown msg
                                 |   |
                                 +---+

2.5.5. Maintaining Hello Adjacencies

   An LDP session with a peer has one or more Hello adjacencies.

   An LDP session has multiple Hello adjacencies when a pair of LSRs is
   connected by multiple links that share the same label space; for
   example, multiple PPP links between a pair of routers.  In this
   situation the Hellos an LSR sends on each such link carry the same
   LDP Identifier.

   LDP includes mechanisms to monitor the necessity of an LDP session
   and its Hello adjacencies.

   LDP uses the regular receipt of LDP Discovery Hellos to indicate a
   peer's intent to use the label space identified by the Hello.  An LSR
   maintains a hold timer with each Hello adjacency which it restarts
   when it receives a Hello that matches the adjacency.  If the timer
   expires without receipt of a matching Hello from the peer, LDP
   concludes that the peer no longer wishes to label switch using that
   label space for that link (or target, in the case of Targeted Hellos)
   or that the peer has failed.  The LSR then deletes the Hello
   adjacency.  When the last Hello adjacency for a LDP session is
   deleted, the LSR terminates the LDP session by closing the transport
   connection.

2.5.6. Maintaining LDP Sessions

   LDP includes mechanisms to monitor the integrity of the LDP session.

   LDP uses the regular receipt of LDP PDUs on the session transport
   connection to monitor the integrity of the session.  An LSR maintains
   a KeepAlive timer for each peer session which it resets whenever it
   receives an LDP PDU from the session peer.  If the KeepAlive timer
   expires without receipt of an LDP PDU from the peer the LSR concludes
   that the transport connection is bad or that the peer has failed, and
   it terminates the LDP session by closing the transport connection.

   After an LDP session has been established, an LSR must arrange that
   its peer receive an LDP PDU from it at least every KeepAlive time
   period to ensure the peer restarts the session KeepAlive timer.  The
   LSR may send any protocol message to meet this requirement.  In
   circumstances where an LSR has no other information to communicate to
   its peer, it sends a KeepAlive message.

   An LSR may choose to terminate an LDP session with a peer at any
   time. Should it choose to do so, it informs the peer with a Shutdown
   message.

2.6. Label Distribution and Management

   The MPLS architecture [ARCH] allows an LSR to distribute a FEC label
   binding in response to an explicit request from another LSR.  This is
   known as Downstream On Demand label distribution.  It also allows an
   LSR to distribute label bindings to LSRs that have not explicitly
   requested them.  This is known as Downstream Unsolicited label
   distribution.

   Both of these label distribution techniques may be used in the same
   network at the same time.  However, for any given LDP session, each
   LSR must be aware of the label distribution method used by its peer
   in order to avoid situations where one peer using Downstream
   Unsolicted label distribution assumes its peer is also.  See Section
   "Downstream-on-Demand label Advertisement".

2.6.1. Label Distribution Control Mode

   The behavior of the initial setup of LSPs is determined by whether
   the LSR is operating with independent or ordered LSP control.  An LSR
   may support both types of control as a configurable option.

2.6.1.1. Independent Label Distribution Control

   When using independent LSP control, each LSR may advertise label
   mappings to its neighbors at any time it desires.  For example, when
   operating in independent Downstream-on-Demand mode, an LSR may answer
   requests for label mappings immediately, without waiting for a label
   mapping from the next hop.  When operating in independent Downstream
   Unsolicited mode, an LSR may advertise a label mapping for a FEC to
   its neighbors whenever it is prepared to label-switch that FEC.

   A consequence of using independent mode is that an upstream label can
   be advertised before a downstream label is received.  This can result
   in unlabeled packets being sent to the downstream LSR.

2.6.1.2. Ordered Label Distribution Control

   When using LSP ordered control, an LSR may initiate the transmission
   of a label mapping only for a FEC for which it has a label mapping
   for the FEC next hop, or for which the LSR is the egress. For each
   FEC for which the LSR is not the egress and no mapping exists, the
   LSR MUST wait until a label from a downstream LSR is received before
   mapping the FEC and passing corresponding labels to upstream LSRs.

   An LSR may be an egress for some FECs and a non-egress for others.
   An LSR may act as an egress LSR, with respect to a particular FEC,
   under any of the following conditions:

        1.   The FEC refers to the LSR itself (including one of its
             directly attached interfaces).

        2.   The next hop router for the FEC is outside of the Label
             Switching Network.

        3    FEC elements are reachable by crossing a routing domain
             boundary, such as another area for OSPF summary networks,
             or another autonomous system for OSPF AS externals and BGP
             routes [rfc1583] [rfc1771].

2.6.2. Label Retention Mode

2.6.2.1. Conservative Label Retention Mode

   In Downstream Unsolicited advertisement mode, label mapping adver-
   tisements for all routes may be received from all peer LSRs.  When
   using conservative label retention, advertised label mappings are
   retained only if they will be used to forward packets (i.e., if they
   are received from a valid next hop according to routing).  If operat-
   ing in Downstream-on-Demand mode, an LSR will request label mappings
   only from the next hop LSR according to routing. Since Downstream-
   on-Demand mode is primarily used when label conservation is desired
   (e.g., an ATM switch with limited cross connect space), it is typi-
   cally used with the conservative label retention mode.

   The main advantage of the conservative mode is that only the labels
   that are required for the forwarding of data are allocated and main-
   tained.  This is particularly important in LSRs where the label space
   is inherently limited, such as in an ATM switch.  A disadvantage of
   the conservative mode is that if routing changes the next hop for a
   given destination, a new label must be obtained from the new next hop
   before labeled packets can be forwarded.

2.6.2.2. Liberal Label Retention Mode

   In Downstream Unsolicited advertisement mode, label mapping adver-
   tisements for all routes may be received from all LDP peers.  When
   using liberal label retention, every label mappings received from a
   peer LSR is retained regardless of whether the LSR is the next hop
   for the advertised mapping.  When operating in Downstream-on-Demand
   mode with liberal label retention, an LSR might choose to request
   label mappings for all known prefixes from all peer LSRs. Note, how-
   ever, that Downstream-on-Demand mode is typically used by devices
   such as ATM switch-based LSRs for which the conservative approach is
   recommended.

   The main advantage of the liberal label retention mode is that reac-
   tion to routing changes can be quick because labels already exist.
   The main disadvantage of the liberal mode is that unneeded label map-
   pings are distributed and maintained.

2.6.3. Label Advertisement Mode

   Each interface on an LSR is configured to operate in either Down-
   stream Unsolicited or Downstream-on-Demand advertisement mode.  LSRs
   exchange advertisement modes during initialization.  The major
   difference between Downstream Unsolicited and Downstream-on-Demand
   modes is in which LSR takes responsibility for initiating mapping
   requests and mapping advertisements.

2.7. LDP Identifiers and Next Hop Addresses

   An LSR maintains learned labels in a Label Information Base (LIB).
   When operating in Downstream Unsolicited mode, the LIB entry for an
   address prefix associates a collection of (LDP Identifier, label)
   pairs with the prefix, one such pair for each peer advertising a
   label for the prefix.

   When the next hop for a prefix changes the LSR must retrieve the
   label advertised by the new next hop from the LIB for use in forward-
   ing.  To retrieve the label the LSR must be able to map the next hop
   address for the prefix to an LDP Identifier.

   Similarly, when the LSR learns a label for a prefix from an LDP peer,
   it must be able to determine whether that peer is currently a next
   hop for the prefix to determine whether it needs to start using the
   newly learned label when forwarding packets that match the prefix.
   To make that decision the LSR must be able to map an LDP Identifier
   to the peer's addresses to check whether any are a next hop for the
   prefix.

   To enable LSRs to map between a peer LDP identifier and the peer's
   addresses, LSRs advertise their addresses using LDP Address and With-
   draw Address messages.

   An LSR sends an Address message to advertise its addresses to a peer.
   An LSR sends a Withdraw Address message to withdraw previously
   advertised addresses from a peer

2.8. Loop Detection

   Loop detection is a configurable option which provides a mechanism
   for finding looping LSPs and for preventing Label Request messages
   from looping in the presence of non-merge capable LSRs.

   The mechanism makes use of Path Vector and Hop Count TLVs carried by
   Label Request and Label Mapping messages.  It builds on the following
   basic properties of these TLVs:

     - A Path Vector TLV contains a list of the LSRs that its containing
       message has traversed.  An LSR is identified in a Path Vector
       list by its unique LSR Identifier (Id), which is the IP address
       component of its LDP Identifier.  When an LSR propagates a mes-
       sage containing a Path Vector TLV it adds its LSR Id to the Path
       Vector list.  An LSR that receives a message with a Path Vector
       that contains its LSR Id detects that the message has traversed a
       loop.  LDP supports the notion of a maximum allowable Path Vector
       length; an LSR that detects a Path Vector has reached the maximum
       length behaves as if the containing message has traversed a loop.

     - A Hop Count TLV contains a count of the LSRS that the containing
       message has traversed.  When an LSR propagates a message contain-
       ing a Hop Count TLV it increments the count.  An LSR that detects
       a Hop Count has reached a configured maximum value behaves as if
       the containing message has traversed a loop.  By convention a
       count of 0 is interpreted to mean the hop count is unknown.
       Incrementing an unknown hop count value results in an unknown hop
       count value (0).

   The following paragraphs describes LDP loop detection procedures.  In
   these paragraphs, "MUST" means "MUST if configured for loop detec-
   tion".  The paragraphs specify messages that must carry Path Vector
   and Hop Count TLVs.  Note that the Hop Count TLV and its procedures
   are used without the Path Vector TLV in situations when loop detec-
   tion is not configured (see [ATM]).

2.8.1. Label Request Message

   The use of the Path Vector TLV and Hop Count TLV prevent Label
   Request messages from looping in environments that include non-merge
   capable LSRs.

   The rules that govern use of the Hop Count TLV in Label Request
   messages by LSR R when Loop Detection is enabled are the following:

   - The Label Request message MUST include a Hop Count TLV.

   - If R is sending the Label Request because it is a FEC ingress, it
     MUST include a Hop Count TLV with hop count value 1.

   - If R is sending the Label Request as a result of having received a
     Label Request from an upstream LSR, and if the received Label
     Request contains a Hop Count TLV, R MUST increment the received hop
     count value by 1 and MUST pass the resulting value in a Hop Count
     TLV to its next hop along with the Label Request message;

   The rules that govern use of the Path Vector TLV in Label Request
   messages by LSR R when Loop Detection is enabled are the following:

   - If R is sending the Label Request because it is a FEC ingress, then
     if R is non-merge capable, it MUST include a Path Vector TLV of
     length 1 containing its own LSR Id.

   - If R is sending the Label Request as a result of having received a
     Label Request from an upstream LSR, then if the received Label
     Request contains a Path Vector TLV or if R is non-merge capable:

         R MUST add its own LSR Id to the Path Vector, and MUST pass the
         resulting Path Vector to its next hop along with the Label
         Request message.  If the Label Request contains no Path Vector
         TLV, R MUST include a Path Vector TLV of length 1 containing
         its own LSR Id.

   Note that if R receives a Label Request message for a particular FEC,
   and R has previously sent a Label Request message for that FEC to its
   next hop and has not yet received a reply, and if R intends to merge
   the newly received Label Request with the existing outstanding Label
   Request, then R does not propagate the Label Request to the next hop.

   If R receives a Label Request message from its next hop with a Hop
   Count TLV which exceeds the configured maximum value, or with a Path
   Vector TLV containing its own LSR Id or which exceeds the maximum
   allowable length, then R detects that the Label Reqeust message has
   traveled in a loop.

   When R detects a loop, it MUST send a Loop Detected Notification mes-
   sage to the source of the Label Request message and drop the Label
   Request message.

2.8.2. Label Mapping Message

   The use of the Path Vector TLV and Hop Count TLV in the Label Mapping
   message provide a mechanism to find and terminate looping LSPs.  When
   an LSR receives a Label Mapping message from a next hop, the message
   is propagated upstream as specified below until an a ingress LSR is
   reached or a loop is found.

   The rules that govern the use of the Hop Count TLV in Label Mapping
   messages sent by an LSR R when Loop Detection is enabled are the fol-
   lowing:

   - R MUST include a Hop Count TLV.

   - If R is the egress, the hop count value MUST be 1.

   - If the Label Mapping message is being sent to propagate a Label
     Mapping message received from the next hop to an upstream peer, the
     hop count value MUST be the result of incrementing the hop count
     value received from the next hop.

   - If the Label Mapping message is not being sent to propagate a Label
     Mapping message, the hop count value MUST be the result of incre-
     menting R's current knowledge of the hop count to the egress.  Note
     that the hop count to the egress will be unknown if R has not
     received a Label Mapping message from the next hop.

   Any Label Mapping message MAY contain a Path Vector TLV.  The rules
   that govern the mandatory use of the Path Vector TLV in Label Mapping
   messages sent by LSR R when Loop Detection is enabled are the follow-
   ing:

   - If R is the egress, the Label Mapping message need not include a
     Path Vector TLV.

   - If R is sending the Label Mapping message to propagate a Label Map-
     ping message received from the next hop to an upstream peer, then:

       o If R is merge capable and if R has not previously sent a Label
         Mapping message to the upstream peer, then it MUST include a
         Path Vector TLV.

       o If the received message contains an unknown hop count, then R
         MUST include a Path Vector TLV.

       o If R has previously sent a Label Mapping message to the
         upstream peer, then it MUST include a Path Vector TLV if the
         received message reports an LSP hop count increase, a change in
         hop count from unknown to known, or a change from known to
         unknown.

     If the above rules require R include a Path Vector TLV in the Label
     Mapping message, R computes it as follows:

       o If the received Label Mapping message included a Path Vector,
         the Path Vector sent upstream MUST be the result of adding R's
         LSR Id to the received Path Vector.

       o If the received message had no Path Vector, the Path Vector
         sent upstream MUST be a path vector of length 1 containing R's
         LSR Id.

   - If the Label Mapping message is not being sent to propagate a
     received message upstream, the Label Mapping message MUST include a
     Path Vector of length 1 containing R's LSR Id.

   If R receives a Label Mapping message from its next hop with a Hop
   Count TLV which exceeds the configured maximum value, or with a Path
   Vector TLV containing its own LSR Id or which exceeds the maximum
   allowable length, then R detects that the corresponding LSP contains
   a loop.

   When R detects a loop, it MUST stop using the label for forwarding,
   drop the Label Mapping message. and send a Loop Detected Notification
   message to the source of the Label Mapping message.

2.8.3. Discussion

   LSRs which are configured for loop detection are NOT expected to
   store the path vectors as part of the LSP state.

   Note that in a network where only non-merge capable LSRs are present,
   Path Vectors are passed downstream from ingress to egress, and are
   not passed upstream.  Even when merge is supported, Path Vectors need
   not be passed upstream along an LSP which is known to reach the
   egress.  When an LSR experiences a change of next hop, it need pass
   Path Vectors upstream only when it cannot tell from the hop count
   that the change of next hop does not result in a loop.

   In the case of ordered label distribution, Label Mapping messages are
   propagated from egress toward ingress, naturally creating the Path
   Vector along the way.  In the case of independent label distribution,
   an LSR may originate a Label Mapping message for an FEC before
   receiving a Label Mapping message from its downstream peer for that
   FEC.  In this case, the subsequent Label Mapping message for the FEC
   received from the downstream peer is treated as an update to LSP
   attributes, and the Label Mapping message must be propagated
   upstream.  Thus, it is recommended that loop detection be configured
   in conjunction with ordered label distribution, to minimize the
   number of Label Mapping update messages.

   If loop detection is desired in some portion of the network, then it
   should be turned on in ALL LSRs within that portion of the network,
   else loop detection will not operate properly.

3. Protocol Specification

   Previous sections that describe LDP operation have discussed
   scenarios that involve the exchange of messages among LDP peers.
   This section specifies the message encodings and procedures for pro-
   cessing the messages.

   LDP message exchanges are accomplished by sending LDP protocol data
   units (PDUs) over LDP session TCP connections.

   Each LDP PDU can carry one or more LDP messages.  Note that the mes-
   sages in an LDP PDU need not be related to one another.  For example,
   a single PDU could carry a message advertising FEC-label bindings for
   several FECs, another message requesting label bindings for several
   other FECs, and a third notification message signaling some event.

3.1. LDP PDUs

   Each LDP PDU is an LDP header followed by one or more LDP messages.
   The LDP header is:

    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                      |         PDU Length            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                         LDP Identifier                        |
   +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Version
     Two octet unsigned integer containing the version number of the
     protocol.  This version of the specification specifies LDP protocol
     version 1.

   PDU Length
     Two octet integer specifying the total length of this PDU in
     octets, excluding the Version and PDU Length fields.

     The maximum allowable PDU Length is negotiable when an LDP session
     is initialized.  Prior to completion of the negotiation the maximum
     allowable length is 4096 bytes.

   LDP Identifier
     Six octet field that uniquely identifies the label space for which
     this PDU applies.  The first four octets encode an IP address
     assigned to the LSR.  This address should be the router-id, also
     used to identify the LSR in loop detection Path Vectors.  The last
     two octets identify a label space within the LSR.  For a platform-
     wide label space, these should both be zero.

   Note that there is no alignment requirement for the first octet of an
   LDP PDU.

3.2. LDP Procedures

   LDP defines messages, TLVs and procedures in the following areas:

     - Peer discovery;
     - Session management;
     - Label distribution;
     - Notification of errors and advisory information.

   The sections that follow describe the message and TLV encodings for
   these areas and the procedures that apply to them.

   The label distribution procedures are complex and are difficult to
   describe fully, coherently and unambiguously as a collection of
   separate message and TLV specifications.

   Appendix A, "LDP Label Distribution Procedures", describes the label
   distribution procedures in terms of label distribution events that
   may occur at an LSR and how the LSR must respond.  Appendix A is the
   specification of LDP label distribution procedures.  If a procedure
   described elsewhere in this document conflicts with Appendix A,
   Appendix A specifies LDP behavior.

3.3. Type-Length-Value Encoding

   LDP uses a Type-Length-Value (TLV) encoding scheme to encode much of
   the information carried in LDP messages.

   An LDP TLV is encoded as a 2 octet field that uses 14 bits to specify
   a Type and 2 bits to specify behavior when an LSR doesn't recognize
   the Type, followed by a 2 octet Length Field, followed by a variable
   length Value field.

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F|        Type               |            Length             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   |                             Value                             |
   ~                                                               ~
   |                                                               |
   |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   U bit
     Unknown TLV bit.  Upon receipt of an unknown TLV, if U is clear
     (=0), a notification must be returned to the message originator and
     the entire message must be ignored; if U is set (=1), the unknown
     TLV is silently ignored and the rest of the message is processed as
     if the unknown TLV did not exist.

   F bit
     Forward unknown TLV bit.  This bit applies only when the U bit is
     set and the LDP message containing the unknown TLV is to be for-
     warded.  If F is clear (=0), the unknown TLV is not forwarded with
     the containing message; if F is set (=1), the unknown TLV is for-
     warded with the containing message.

   Type
     Encodes how the Value field is to be interpreted.

   Length
     Specifies the length of the Value field in octets.

   Value
     Octet string of Length octets that encodes information to be inter-
     preted as specified by the Type field.

   Note that there is no alignment requirement for the first octect of a
   TLV.

   Note that the Value field itself may contain TLV encodings.  That is,
   TLVs may be nested.

   The TLV encoding scheme is very general.  In principle, everything
   appearing in an LDP PDU could be encoded as a TLV.  This specifica-
   tion does not use the TLV scheme to its full generality.  It is not
   used where its generality is unnecessary and its use would waste
   space unnecessarily.  These are usually places where the type of a
   value to be encoded is known, for example by its position in a mes-
   sage or an enclosing TLV, and the length of the value is fixed or
   readily derivable from the value encoding itself.

   Some of the TLVs defined for LDP are similar to one another.  For
   example, there is a Generic Label TLV, an ATM Label TLV, and a Frame
   Relay TLV; see Sections "Generic Label TLV", "ATM Label TLV", and
   "Frame Relay TLV".

   While it is possible to think about TLVs related in this way in terms
   of a TLV type that specifies a TLV class and a peer has one or more Hello adjacencies.

   An LDP session has multiple Hello adjacencies when TLV subtype that
   specifies a pair particular kind of LSRs are
   connected by multiple links TLV within that share class, this specifica-
   tion does not formalize the same label space; for
   example, multiple PPP links between notion of a pair TLV subtype.

   The specification assigns type values for related TLVs, such as the
   label TLVs, from of routers.  In a contiguous block in the 16-bit TLV type number
   space.

   Section "TLV Summary" lists the TLVs defined in this
   situation version of the Hellos an LSR sends on each such link carries
   protocol and the same
   LDP Identifier. section in this document that describes each.

3.4. TLV Encodings for Commonly Used Parameters

   There are several parameters used by more than one LDP includes mechanisms message.  The
   TLV encodings for these commonly used parameters are specified in
   this section.

3.4.1. FEC TLV

   Labels are bound to monitor the necessity Forwarding Equivalence Classes (FECs).  a FEC is
   a list of an LDP session
   and its Hello adjacencies.

   LDP uses one or more FEC elements.  The FEC TLV encodes FEC items.

   Its encoding is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| FEC (0x0100)              |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        FEC Element 1                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        FEC Element n                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   FEC Element 1 to FEC Element n
     There are several types of FEC elements; see Section "FECs".  The
     FEC element encoding depends on the regular receipt type of LDP Discovery Hellos to indicate FEC element.

     A FEC Element value is encoded as a
   peer's intent to use the label space identified by 1 octet field that specifies
     the Hello.  An LSR
   maintains a hold timer with each Hello adjacency which it restarts
   when it receives element type, and a Hello variable length field that matches is the adjacency.  If type-
     dependent element value.  Note that while the timer
   expires without receipt representation of a matching Hello from the peer,
     FEC element value is type-dependent, the FEC element encoding
     itself is one where standard LDP con-
   cludes that TLV encoding is not used.

     The FEC Element value encoding is:

         FEC Element       Type      Value
         type name

           Wildcard        0x01      No value; i.e., 0 value octets;
                                         see below.
           Prefix          0x02      See below.
           Host Address    0x03      4 octet full IP address; see below.

     Wildcard FEC Element
       To be used only in the peer no longer wishes Label Withdraw and Label Release Messages.
       Indicates the withdraw/release is to be applied to all FECs asso-
       ciated with the label switch using that within the following label space for TLV.  Must be
       the link (or target, only FEC Element in the case of Targeted Hellos) FEC TLV.

     Prefix FEC Element value encoding:

      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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |  Prefix (2)   |     Address Family            |     PreLen    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                     Prefix                                    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Address Family
         Two octet quantity containing a value from ADDRESS FAMILY
         NUMBERS in question or [rfc1700] that encodes the peer has failed, and it deletes the Hello
   adjacency.  When the last Hello adjacency address family for a LDP session is
   deleted, the LSR terminates the LDP session by closing the transport
   connection.

2.6.6. Maintaining LDP Sessions

   LDP includes mechanisms to monitor the integrity of
         address prefix in the session tran-
   sport connection.

   LDP uses Prefix field.

       PreLen
         One octet unsigned integer containing the regular receipt length in bits of LDP PDUs on the session transport
   connection
         address prefix that follows.

       Prefix
         An address prefix encoded according to monitor the integrity of Address Family
         field, whose length, in bits, was specified in the connection.  An LSR main-
   tains PreLen
         field, padded to a keepalive timer for each peer session which it resets when-
   ever it receives an LDP PDU from the session peer.  If the keepalive
   timer expires without receipt of an LDP PDU byte boundary.

     Host Address FEC Element encoding:

      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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | Host Addr (3) |     Address Family            | Host Addr Len |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                                                               |
     |                     Host Addr                                 |
     |                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Address Family
         Two octet quantity containing a value from the peer the LSR
   concludes that the transport connection is bad or ADDRESS FAMILY
         NUMBERS in [rfc1700] that encodes the peer has
   failed, and it terminates the peer session by closing address family for the transport
   connection.

   An LSR must arrange that its LDP peer sees an LDP PDU from it at
   least every keepalive time period to ensure
         address prefix in the peer restarts Prefix field.

       Host Addr Len
         Length of the
   session keepalive timer.  The LSR may send any protocol message to
   meet this requirement.  In circumstances where an LSR has no other
   information to communicate to its peer, it sends a KeepAlive message. Host address in octets.

       Host Addr
         An LSR may choose address encoded according to terminate the Address Family field.

3.4.1.1. FEC Procedures

   If in decoding a FEC TLV an LDP session with LSR encounters a peer at any
   time. Should FEC Element type it choose to do so, can-
   not decode, it informs should stop decoding the FEC TLV, abort processing the
   message containing the TLV, and send an Notification message to its
   LDP peer with a Shutdown
   message.

2.7. signaling an error.

3.4.2. Label Distribution and Management

2.7.1. TLVs

   Label Distribution Control Mode

   The behavior of the initial setup of LSPs is determined TLVs encode labels.  Label TLVs are carried by whether the LSR is operating with independent or ordered LSP control. messages
   used to advertise, request, release and withdraw label mappings.

   There are several different kinds of Label TLVs which can appear in
   situations that require a Label TLV.

3.4.2.1. Generic Label TLV

   An LSR
   may support both types uses Generic Label TLVs to encode labels for use on links for
   which label values are independent of control as a configurable option.

2.7.1.1.  Independent the underlying link technology.
   Examples of such links are PPP and Ethernet.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Generic Label (0x0200)    |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Label Distribution Control

   When using independent LSP control, each node may advertise label
   mappings to its neighbors at any time it desires.  For example, when
   operating in independent Downstream-on-Demand mode, an LSR may answer
   requests for label mappings immediately, without waiting for                                                     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Label
     This is a 20-bit label
   mapping from the next hop.  When operating value as specified in independent Downstream
   allocation mode, an LSR may advertise [ENCAP] represented as
     a label mapping for 20-bit number in a FEC 4 octet field.

3.4.2.2. ATM Label TLV

   An LSR uses ATM Label TLVs to
   its neighbors whenever it encode labels for use on ATM links.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| ATM Label (0x0201)        |         Length                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Res| V |          VPI          |         VCI                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   Res
     This field is prepared reserved. It must be set to label-switch that FEC.

   A consequence of using independent mode is that an upstream label can zero on transmission and
     must be advertised before a downstream label ignored on receipt.

   V-bits
     Two-bit switching indicator.  If V-bits is received.  This can result
   in unlabeled packets being sent to the downstream node.

2.7.1.2.  Ordered Label Distribution Control

   When using LSP ordered control, an LSR may initiate 00, both the transmission
   of a label mapping VPI and VCI
     are significant.  If V-bits is 01, only for an FEC for which it has a label mapping
   for the FEC next hop, or for which the LSR VPI field is the egress. For each
   FEC for which the LSR signifi-
     cant.  If V-bit is not 10, only the egress VCI is significant.

   VPI
     Virtual Path Identifier. If VPI is less than 12-bits it should be
     right justified in this field and no mapping exists, preceding bits should be set to
     0.

   VCI
     Virtual Channel Identifier. If the
   LSR MUST wait until a label from a downstream LSR for VCI is received
   before mapping less than 16- bits, it
     should be right justified in the FEC field and passing corresponding labels to upstream
   LSRs.

   An LSR may the preceding bits must
     be an egress for some FECs, and a non-egress for others.
   An LSR may act as an egress LSR, with respect set to a particular FEC,
   under any of 0. If Virtual Path switching is indicated in the following conditions:

     1.   The FEC refers V-bits
     field, then this field must be ignored by the receiver and set to 0
     by the sender.

3.4.2.3. Frame Relay Label TLV

   An LSR itself (including one of its
          directly attached interfaces).

     2.   The next hop router for the FEC is outside of the uses Frame Relay Label
          Switching Network.

     3    FEC elements are reachable by crossing a routing domain boun-
          dary, such as another area for OSPF summary net-works, or
          another autonomous system TLVs to encode labels for OSPF AS externals and BGP routes
          [rfc1583] [rfc1771].

2.7.2. Label Retention Mode

2.7.2.1.  Conservative use on Frame
   Relay links.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Frame Relay Label Retention Mode

   In Downstream Allocation mode, label mapping advertisements for all
   routes may be received from all peer LSRs.  When using conservative
   label retention, advertised label mappings are only retained if they
   will (0x0202)|       Length                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Reserved    |Len|                     DLCI                    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Res
     This field is reserved. It must be used to forward packets (i.e., if they are received from a
   valid next hop according set to routing).  If operating in Downstream-
   on-Demand mode, label mappings will only zero on transmission and
     must be requested ignored on receipt.

   Len
     This field specifies the number of bits of the
   appropriate next hop LSR according DLCI. The following
     values are supported:

        0 = 10 bits DLCI
        1 = 17 bits DLCI
        2 = 23 bits DLCI
   DLCI
     The Data Link Connection Identifier.  Refer to routing. Since Downstream-on-
   Demand mode is primarily used when label conservation is desired
   (e.g., an ATM switch with limited cross connect space), it is typi-
   cally used with [FR] for the conservative label retention mode.
     values and formats.

3.4.3. Address List TLV

   The main advantage of the conservative mode is that the only the
   labels Address List TLV appears in Address and Address Withdraw mes-
   sages.

   Its encoding is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Address List (0x0101)     |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Address Family            |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
   |                                                               |
   |                        Addresses                              |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Address Family
     Two octet quantity containing a value from ADDRESS FAMILY NUMBERS
     in [rfc1700] that are required for encodes the forwarding of data are allocated and
   maintained.  This is particularly important addresses contained in LSRs where the label
   space is inherently limited, such as in an ATM switch. Addresses
     field.

   Addresses
     A disadvan-
   tage list of addresses from the conservative mode is that if routing changes specified Address Family.  The encod-
     ing of the next hop
   for a given destination, a new label must be obtained from individual addresses depends on the new
   next hop before labeled packets can be forwarded.

2.7.2.2.  Liberal Label Retention Mode

   In Downstream Allocation mode, label mapping advertisements for all
   routes may be received from all peer LSRs.  When using liberal label
   retention, advertised label mappings Address Family.

     The following address encodings are retained from all next hops
   regardless defined by this version of whether they are valid next hops for the advertised
   mapping.  When operating in Downstream-on-Demand mode, label mappings
   are requested
     protocol:

         Address Family      Address Encoding

         IPv4                4 octet full IPv4 address

3.4.4. COS TLV

   The COS (Class of all peer LSRs. Note, however, Service) TLV may appear as an optional field in
   messages that Downstream-on-
   Demand mode is typically associated with ATM switch-based LSRs where
   the conservative approach request and carry label mappings.  It is recommended. used to
   request and advertise (Label, FEC, class of service) bindings.  Its
   encoding is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| COS (0x0102)              |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   |     COS Value                                                 |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   COS Value
     The main advantage of the liberal label retention mode value field for this TLV is a subject for further study.

     One possibility is that reac-
   tion to routing changes can be quick because labels already exist.
   The main disadvantage define a set of the liberal mode is CoS values that unneeded label map-
   pings are distributed and maintained.

2.7.3. Label Advertisement Mode

   Each interface on an LSR is configured map to operate Dif-
     ferentiated Services [DIFFSERV] code points.  Other CoS values
     could be supported in either Down-
   stream addition to or Downstream-on-Demand allocation mode.  LSRs exchange adver-
   tisement modes during initialization.  The major difference between
   Downstream and Downstream-on-Demand modes is in which LSR takes
   responsibility for initiating mapping requests and mapping advertise-
   ments

2.8. LDP Identifiers and Next place of the Differentiated
     Services code points.

3.4.5. Hop Addresses

   An LSR maintains learned labels in a Label Information Base (LIB).
   When operating Count TLV

   The Hop Count TLV appears as an optional field in Downstream (as opposed to Downstream-on-Demand)
   more, messages that set
   up LSPs.  It calculates the LIB entry for number of LSR hops along an address prefix associates a collection LSP as the
   LSP is being setup.

   Note that setup procedures for LSPs that traverse ATM links require
   use of the Hop Count TLV (see [ATM]).

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Hop Count (0x0103)        |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     HC Value  |
   +-+-+-+-+-+-+-+-+

   HC Value
     1 octet unsigned integer hop count value.

3.4.5.1. Hop Count Procedures

   During setup of
   (LDP Identifier, label) pairs with the prefix, one such pair for each
   peer advertising an LSP an LSR may receive a label for the prefix.

   When the next hop Label Mapping or Label
   Request message for a prefix changes the LSR must retrieve LSP that contains the
   label advertised by Hop Count TLV.  If it
   does, it should record the new next hop from the LIB for use in forward-
   ing.  To retrieve the label count value.  If the LSR must be able to map then pro-
   pagates the next hop
   address Label Mapping message for the prefix LSP to an LDP Identifier.

   Similarly, when the LSR learns a label for a prefix from an LDP peer,
   it must be able to determine whether that upstream peer is currently a next
   hop for or
   the prefix Label Request message to determine whether it needs a downstream peer to start using the
   newly learned label when forwarding packets that match the prefix.
   To make that decision continue the LSR LSP
   setup, it must be able to map an LDP Identifier
   to increment the peer's addresses to check whether any are a next recorded hop for the
   prefix.

   To enable LSRs to map between a peer LDP identifier count value and include it
   in a Hop Count TLV in the peer's
   addresses, LSRs advertise their addresses using LDP Address and With-
   draw Address messages.

   An message.  The first LSR sends an Address message to advertise its addresses in the LSP should
   set the hop count value to 1.

   By convention a peer.
   An value of 0 indicates an unknown hop count.  The
   result of incrementing an unknown hop count is itself an unknown hop
   count (0).

   If an LSR sends receives a Withdraw Address message to withdraw previously adver-
   tised addresses from containing a peer

2.9. Loop Detection

   Each LSR MUST support Hop Count TLV, it must
   check the configurable loop-detection option.  LSRs
   perform loop detection via hop count value to determine whether the LSR-path-vector object (TLV) contained
   within each Mapping and Query message.  Upon receiving such a mes-
   sage, hop count has
   exceeded its configured maximum allowable value.  If so, it must
   behave as if the LSR performs containing message has traversed a loop detection by verifying that its unique
   router-id is not already present sending a
   Notification message signaling Loop Detected in reply to the list. sender
   of the message.

   If a loop Loop Detection is detected, configured, the LSR must transmit a NAK  message to follow the sending node, procedures
   specified in Section "Loop Detection".

3.4.6. Path Vector TLV

   The Path Vector TLV is used with the Hop Count TLV in Label Request
   and does
   not install Label Mapping messages to implement the mapping optional LDP loop detec-
   tion mechanism.  See Section "Loop Detection".  Its use in the Label
   Request message records the path of LSRs the request has traversed.
   Its use in the Label Mapping message records the path of LSRs a label
   advertisement has traversed to setup an LSP.

   Its encoding is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Path Vector (0x0104)      |        Length                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            LSR Id 1                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            LSR Id n                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   One or propagate more LSR Ids
     A list of router-ids indicating the path of LSRs the message any further.  In
   addition, if there has
     traversed.  Each LSR Id is an upstream label spliced to the downstream
   label IP address (router-id) component of
     the LDP identifier for the FEC, corresponding LSR.  This ensures it is
     unique within the LSR must unsplice the labels. On those mes-
   sages network.

3.4.6.1. Path Vector Procedures

   The Path Vector TLV is carried in which no Label Mapping and Label Request
   messages when loop detection is detected, the configured.

3.4.6.1.1. Label Request Path Vector

   Section "Loop Detection" specifies situations when an LSR must concatenate itself
   to the LSR-path-vector before propagating.

   If loop detection is desired
   include a Path Vector TLV in some portion of a Label Request message.

   An LSR that receives a Path Vector in a Label Request message must
   perform the network, then it
   should be turned on procedures described in ALL LSRs within that portion of Section "Loop Detection".

   If the network,
   else loop detection will not operate properly.

2.10. Loop Prevention via Diffusion LSR diffusion support is detects a configurable option, which permits an loop, it must reject the Label Request message.
   The LSR must:

      1. Transmit a Notification message to verify the sending LSR signaling
         "Loop Detected".

      2. Not propagate the Label Reqeust message further.

   Note that a new routed path Label Request message with Path Vector TLV is forwarded
   until:

      1. A loop free before installing an is found,

      2. The LSP on that path. An LSR which supports diffusion does not splice an
   upstream label to egress is reached,

      3. The maximum Path Vector limit or maximum Hop Count limit is
         reached.  This is treated as if a new downstream label until it ensures that con-
   catenation of the upstream path with the new downstream path will be loop free.

   A LSR which detects a new next hop for had been detected.

3.4.6.1.2. Label Mapping Path Vector

   Section "Loop Detection" specifies the situations when an FEC transmits LSR must
   include a Query mes-
   sage containing its unique router id to each of its upstream peers. Path Vector TLV in a Label Mapping message.

   An LSR that receives such a Query Path Vector in a Label Mapping message processes must
   perform the Query as fol-
   lows.  (The following procedures are described in terms of Ack and
   Nak messages.  An Ack is Section "Loop Detection".

   If the LSR detects a Notification loop, it must reject the Label Mapping message signalling Success;
   in order to prevent a
   Nak is forwarding loop.  The LSR must:

      1. Transmit a Notification message signalling Loop Detected)

     o    If to the downstream sending LSR not the correct next hop for signaling
         "Loop Detected".

      2. Not propagate the given
          FEC, message further.

      3. Check whether the upstream LSR responds with Label Mapping message is for an Ack message, indicating
          that existing LSP.
         If so, the downstream LSR may change must unsplice any upstream labels which are
         spliced to the new path.

     o    If the downstream LSR is the correct next hop label for the given
          FEC, the upstream LSR performs FEC.

   Note that a Label Mapping message with a Path Vector TLV is forwarded
   until:

      1. A loop detection via is found,

      2. An LSP ingress is reached, or

      3. The maximum Path Vector or maximum Hop Count limit is reached.
         This is treated as if a loop had been detected.

3.4.7. Status TLV

   Notification messages carry Status TLVs to specify events being sig-
   naled.

   The encoding for the Status TLV is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F| Status (0x0300)           |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Status Code                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Message Type             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Status Code
     32-bit unsigned integer encoding the LSR-
          path-vector.

     o    If event being signaled.  The
     structure of a loop Status Code is:

      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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |E|F|                 Status Data                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     E bit
       Fatal error bit.  If set (=1), this is detected, the upstream LSR responds with a Nak
          message that indicates the LSR is to be "pruned, and the LSR
          unsplices all connections for that FEC to the downstream node,
          thereby pruning itself off of the tree.

     o fatal error notifica-
       tion.  If a loop clear (=0), this is not detected, the upstream node concatenates its
          unique router-id to the LSR-path-vector, and propagates the
          Query message to its upstream peers.

     o    Each LSR which receives an Ack message from its upstream peer
          in response to a query message, in turn forwards the ack-
          nowledgement to the downstream LSR which sent the Query mes-
          sage.

     o advisory notification.

     F bit
       Forward bit.  If an LSR doesn't receive a Ack Message for a given query
          within a "reasonable" period of time, it "unsplices" set (=1), the
          upstream peer that has not responded, and responds with a Nak
          message notification should be forwarded
       to its downstream peer, indicating the pruning of the
          upstream peer.

     o    An LSR which receives a new Query message for an FEC before it
          has received responses from all of its upstream peers the next-hop or previous-hop for a
          previous Query message must concatenate the old and LSP, if any,
       associated with the new
          LSR-path-vector within event being signaled.  If clear (=0), the new query advertisement before pro-
          pagating.

     o    The diffusion computation continues until each upstream path
          responds
       notification should not be forwarded.

     Status Data
       30-bit unsigned integer which specifies the status information.

     This specification defines Status Codes (32-bit unsigned integers
     with an acknowledgment. An LSR the above encoding).

     A Status Code of 0 signals success.

   Message ID
     If non-zero, 32-bit value that does not have any
          upstream LDP peers must acknowledge identifies the Query message.

     The LSR peer message to which began
     the diffusion may splice its upstream label to Status TLV refers.  If zero, no specific peer message is being
     identified.

   Message Type
     If non-zero, the new downstream label only after receiving an acknowledge mes-
     sage from type of the upstream peer.

     As LSR diffusion support is a configurable option, an LSR peer message to which the Status TLV
     refers.  If zero, the Status TLV does not support diffusion will never originate a Query refer to any specific
     peer message.
     However, these LSRs must still recognize and process the Query mes-
     sages, as described above.

2.11. Explicitly Routing LSPs

   The need for explicit routing (ER) in MPLS has been explored else-
   where [ARCH] [FRAME].  At the MPLS WG meeting held during the Wash-
   ington IETF there was consensus that

3.5. LDP should support explicit
   routing of LSPs with provision for indication of associated (forward-
   ing) priority.  This section specifies mechanisms to provide that
   support, and provides Messages

   All LDP messages 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Message Type              |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                     Mandatory Parameters                      |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                     Optional Parameters                       |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   U bit
     Unknown message bit.  Upon receipt of an unknown message, if U is
     clear (=0), a means notification is returned to allow the reservation message originator;
     if U is set (=1), the unknown message is silently ignored.

   Message Type
     Identifies the type of 'resources'
   for message

   Message Length
     Specifies the explicitly routed LSP.

   In this document we propose an end to end setup mechanism that could, cumulative length in principal, be invoked from either end octets of the explicitly routed LSP
   (ERLSP).  However we specify it here only for the case of initiation Message ID, Manda-
     tory Parameters, and Optional Parameters.

   Message Id
     32-bit value used to identify this message.  Used by the ingress in the belief sending
     LSR to facilitate identifying notification messages that such may apply
     to this message.  An LSR sending a mechanism maps naturally notification message in response
     to
   the setup this message should include this Message Id in the opposite direction.  We believe that the, inevit-
   able, latency associated with this (end to end) setup mechanism is
   tolerable since most notification
     message; see Section "Notification Message".

   Mandatory Parameters
     Variable length set of the motivations for ERLSPs, for example
   'traffic engineering' imply required message parameters.  Some messages
     have no required parameters.

     For messages that have required parameters, the LSPs setup required parameters
     MUST appear in this manner will
   have a long lifetime (at least when compared to those setup the order specified by the individual message
     specifications in
   response to dynamic routing).

   We introduce objects and procedures the sections that provide support for:

     -    Strict and Loose explicit routing

     -    Specification of class of service

     -    Reservation follow.

   Optional Parameters
     Variable length set of bandwidth

     -    Route pinning

     -    ERLSP preemption

     Only unidirectional point-to-point ERLSP is specified currently.
     The scheme can be easily extended to accommodate multipoint-to-
     point ERLSPs.  The FEC object (TLV) may be used to determined which
     ERLSPs are "merged" to form a multipoint-to- point ERLSP.  Alterna-
     tively, a multipoint-to-point ERLSP can be setup from the egress by
     completely specifying optional message parameters.  Many messages
     have no optional parameters.

     For messages that have optional parameters, the multipoint- to-point tree.  Also, tunnel-
     ing ERLSPs within other ERLSPs optional parameters
     may appear in any order.

   Note that there is no alignment requirement for future study.

     To setup a ERLSP an LSR (that will be the 'ingress' first octet of the LSP)
     generates an explicit request.
   LDP message.

   The explicit request contains an
     explicit route object which following message types are defined in turn contains a sequence this version of explicit
     request next hop objects and a pointer to the current entry in that
     sequence. LDP:

       Message Name            Section Title

       Notification            "Notification Message"
       Hello                   "Hello Message"
       Initialization          "Initialization Message"
       KeepAlive               "KeepAlive Message"
       Address                 "Address Message"
       Address Withdraw        "Address Withdraw Message"
       Label Mapping           "Label Mapping Message"
       Label Request           "Label Request Message"
       Label Withdraw          "Label Withdraw Message"
       Label Release           "Label Release Message"

   The explicit request next hop objects sections that follow specify the IP
     address encodings and procedures for
   these messages.

   Some of the LSRs through which the ERLSP should pass.  These LSR
     hops specified in the explicit route above messages are referred related to as 'peg LSRs'.

     An explicit request MUST specify the stream that will be associated
     with the ERLSP by inserting one another, for example
   the appropriate FEC value Label Mapping, Label Request, Label Withdraw, and Label Release
   messages.

   While is possible to think about messages related in this way in
   terms of a message type that specifies a message class and a message
   subtype that specifies a particular kind of message within that
   class, this specification does not formalize the
     request. notion of a message
   subtype.

   The FEC value 'opaque tunnel' exists to support ERLSPs
     where the intermediate LSRs on the LSP need know nothing about specification assigns type values for related messages, such as
   the
     traffic flowing on label messages, from of a contiguous block in the LSP.

     The setup mechanism for ERLSPs employs an end 16-bit message
   type number space.

3.5.1. Notification Message

   An LSR sends a Notification message to end protocol.
     Individual ERLSPs are uniquely identified by inform an ERLSPID associated
     with them by LDP peer of a signi-
   ficant event.  A Notification message signals a fatal error or pro-
   vides advisory information such as the LSR that initiates their setup.  The ERLSPID is
     generated by outcome of processing an LDP
   message or the ingress LSR state of the LSP. LDP session.

   The ERLSPID has another
     component called Peg ERLSPID which is generated by each peg LSR
     when encoding for the next peg LSR from itself is loosely routed.  This is Notification Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Notification (0x0001)     |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Status (TLV)                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit value used
     by the intermediate LSRs to identify a loosely routed segment. this message.

   Status TLV
     Indicates the event being signaled.  The
     Peg ERLSPID encoding for the Status
     TLV is not used specified in Section "Status TLV".

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a segment that is strictly routed.
     Requests travel from the 'ingress' of the LSP toward what will be
     the 'egress'.  Responses indicating the status of the ERLSP request
     travel back toward TLV.  The following Optional Parameters are generic
     and may appear in any Notification Message:

         Optional Parameter     Type     Length  Value

         Extended Status        0x0301    4      See below
         Returned PDU           0x0302    var    See below
         Returned Message       0x0303    var    See below

     Other Optional Parameters, specific to the ingress of particular event being
     signaled by the ERLSP.  ERLSPID is used in
     both Request and Response messages. Notification Messages may appear.  These are
     described elsewhere.

       Extended Status
         The addresses specified in 4 octet value is an Extended Status Code that encodes addi-
         tional information that supplements the next hop objects status information con-
         tained in the explicit
     route object should be those Notification Status Code.

       Returned PDU
         An LSR uses this parameter to return part of the LSR's IP address or the incom-
     ing interfaces on the LSRs through which the LSP should pass.  The
     ERLSPID, FEC, incoming interface (previous hop) and an LDP identifier
     of PDU to the
         LSR that generated the message are all stored in an ERLSP
     control block.  Here's a synopsis sent it.  The value of this TLV is the entire mechanism to
     instantiate an ERLSP:

        An ingress node originates a ERLSP request message.  The message
        contains an unique ERLSPID, FEC object, explicit route object, PDU header and an optional object for resource assignment for
         as much PDU data following the ERLSP.

        At an intermediate node header as appropriate for the 'active' ERNH object is identified
         condition being signalled by the pointer in the explicit route object.  On Notification message.

       Returned Message
         An LSR uses this parameter to return part of an LDP message receipt
        the pointer always points to
         the receiving LSR object in that sent it.  The value of this TLV is the
        explicit route message in case of strict routing.
         type and length fields and as much message data following the
         type and length fields as appropriate for the condition being
         signalled by the Notification message.

3.5.1.1. Notification Message Procedures

   If an LSR encounters a segment
        of ERLSP is loosely routed then pointer always points condition requiring it to notify its peer with
   advisory or error information it sends the
        upstream peg LSR at all peer a Notification mes-
   sage containing a Status TLV that encodes the intermediate LSRs in this segment.
        The penultimate hop to information and option-
   ally additional TLVs that provide more information about the downstream peg LSR advances event.

   If the
        pointer to condition is one that is a fatal error the next ERNH object Status Code carried
   in the list.

        If the ERNH objects subtype indicates 'Strict' then dependent on notification will indicate that.  In this case, after sending
   the next ERNH IP address Notification message the appropriate LDP Identifier for LSR should terminate the LDP session with by
   closing the next hop session TCP connection and discard all state associated
   with the appropriate output inter-
        face are discovered (by using the information learnt from session, including all label-FEC bindings learned via the
        address
   session.

   When an LSR receives a Notification message see Section "LDP Identifiers").  The outgoing
        interface (next hop) information is also stored in the ERLSP
        control block.  In the case of strict ERLSP, the neighbor MUST
        be directly adjacent to the current LSR.

        If the ERNH object subtype that carries a Status
   Code that indicates 'Loose' then dependent upon
        the next ERNH IP address a next hop is selected as per the FIB
        information for the downstream peg LSR.  This information is
        again maintained in fatal error, it should terminate the ERLSP control block.  Peg LSRs are
        allowed to change LDP ses-
   sion immediately by closing the Explicit Route Object if session TCP connection and discard
   all state associated with the path to session, including all label-FEC bind-
   ings learned via the
        next Peg LSR session.

3.5.1.2. Events Signaled by Notification Messages

   It is selected useful for descriptive purpose to be 'loose'.  This allows classify events signaled by
   Notification Messages into the Peg
        LSRs to select following categories.

3.5.1.2.1. Malformed PDU or Message

   Malformed LDP PDUs or Messages that are part of the LDP Discovery
   mechanism are handled by silently discarding them.

   An LDP PDU received on a specific path to the next Peg LSR. TCP connection for an LDP session is mal-
   formed if:

     - The default
        path to the next Peg LSR LDP Identifier in case the segment is chosen as
        'loose' PDU header is determined by the hop-by- hop forwarding path unknown to the
        next Peg LSR.  However, Peg LSR are allowed only to select a
        path downstream to receiver,
       or it is known but is not the next Peg LSR, they cannot change paths on
        any other segment of LDP Identifier associated by the ERLSP.

        Bandwidth reservations (if any) are processed.  How this hap-
        pens, i.e.
       receiver with the precise connection admission procedures LDP session.  This is out-
        side the scope of a fatal error signaled by
       the Bad LDP specification. Identifier Status Code.

     - The admission control
        must also use LDP protocol version is not supported by the preemption value specified for receiver, or it
       is supported but is not the LSP in
        determining if resources are available version negotiated for the LSP.  If a reser-
        vation cannot be accommodated a response indicating that fact session
       during session establishment.  This is
        returned to the previous hop.  Note that a fatal error signaled by
       the resources are only
        reserved at this time. Bad Protocol Version Status Code.

     - The LSRs will commit the bandwidth with
        the labels when PDU Length field is too short (< 20) or too long
       (> maximum PDU length).  This is a fatal error signaled by the response comes back from
       Bad PDU Length Status Code.  Section "Initialization Message"
       describes how the egress LSR. maximum PDU length for a session is determined.

   An LDP Message is malformed if:

     - The Message Type is unknown.

       If the ERLSP can be accommodated Message Type is < 0x8000 (high order bit = 0) it is a
       fatal error signaled by the pointer in Unknown Message Type Status Code.

       If the explicit
        request object Message Type is incremented to point at >= 0x8000 (high order bit = 1) it is
       silently discarded.

     - The Message Length is too large, that is, indicates that the next explicit
        request next hop object in case mes-
       sage extends beyond the end of strict routing and the
        request message containing LDP PDU.  This is sent to a
       fatal error signaled by the Bad Message Length Status Code.

3.5.1.2.2. Unknown or Malformed TLV

   Malformed TLVs contained in LDP peer discovered as described
        above.  In case messages that are part of loose routing, the pointer is incremented
        only if the direct next hop is LDP
   Discovery mechanism are handled by silently discarding the next downstream peg LSR.

        If containing
   message.

   A TLV contained in an LSR finds it impossible to satisfy LDP message received on a Explicit request then TCP connection of an 'Explicit response' message
   LDP is created indicating the reason. malformed if:

     - The ERLSPID from (failed) request is inserted in the message and
        it TLV Length is sent to the LDP peer identified in too large, that is, indicates that the associated entry in TLV
       extends beyond the ERLSP control block after which end of the ERLSP block containing message.  This is freed.

        LSRs receiving Explicit responses indicating failure process
        them in a similar manner.  They create a new Explicit request
        and copy
       fatal error signaled by the ERLSPID and Bad TLV Length Status from Code.

     - The TLV type is unknown.

       If the Explicit request they
        received into it.  They use TLV type is < 0x8000 (high order bit 0) it is a fatal
       error signaled by the ERLSPID to obtain Unknown TLV Status Code.

       If the appropri-
        ate ERLSP control block and thus identify TLV type is >= 08000 (high order bit 1) the LDP peer toward
        which TLV is
       silently dropped.  Section "Unknown TLV in Known Message Type"
       elaborates on this behavior.

     - The TLV Value is malformed.  This occurs when the 'new' Explicit response message should be sent.  Hav-
        ing done that they free receiver han-
       dles the ERLSP control block.

        When an Explicit request reaches TLV but cannot decode the LSR specified TLV Value.  This is inter-
       preted as indicative of a bug in either the last
        ERNH object in that request and that LSR accedes to sending or receiving
       LSR.  It is a fatal error signaled by the request
        it generates an Explicit response indicating successful setup of Malformed TLV Value
       Status Code.

3.5.1.2.3. Session Hold Timer Expiration

   This is a fatal error signaled by the Hold Timer Expired Status Code.

3.5.1.2.4. Unilateral Session Shutdown

   This is a fatal event signaled by the ERLSP. Shutdown Status Code.  The egress node also includes
   Notification Message may optionally include an Extended Status TLV to
   provide a label in reason for the
        response message. Shutdown.  The Explicit response is (reverse path) for-
        warded through sending LSR terminates the LSRs that
   session immediately after sending the original Explicit request
        traversed using Notification.

3.5.1.2.5. Initialization Message Events

   The session initialization negotiation (see Section "Session Initial-
   ization") may fail if the mechanism described above (inspection of
        ERLSP control block).  In this case, of course, session parameters received in the ERLSP con-
        trol block Initial-
   ization Message are unacceptable.  This is not deleted.  An intermediate LSR receiving such a
        response message allocates a new label fatal error.  The
   specific Status Code depends on its incoming interface
        and creates a connection between the new parameter deemed unacceptable,
   and the given label is defined in Sections "Initialization Message".

3.5.1.2.6. Events Resulting From Other Messages

   Messages other than the message.  The LSR also commits the previously reserved
        bandwidth Initialization message may result in events
   that must be signaled to this connection at LDP peers via Notification Messages.  These
   events and the appropriate scheduler(s).
        The LSR then forwards Status Codes used in the message Notification Messages to its previous hop with sig-
   nal them are described in the
        new label.  When sections that describe these messages.

3.5.1.2.7. Miscellaneous Events

   These are events that fall into none of the successful response reaches categories above.  There
   are no miscellaneous events defined in this version of the ingress LSR protocol.

3.5.2. Hello Message

   LDP Hello Messages are exchanged as part of the ERLSP is declared in-service.

        There is also support for route pinning LDP Discovery Mechan-
   ism; see Section "LDP Discovery".

   The encoding for loosely routed seg-
        ments.  When a ERLSP is pinned the loose path is not changed
        when `better' paths become available.  Once a ERLSP goes in-
        service there is protocol support Hello Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Hello (0x0100)            |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Common Hello Parameters TLV               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit value used to reassign resources identify this message.

   Common Hello Parameters TLV
     Specifies parameters common to the
        ERLSP if required.

2.12. ERLSP State Machine all Hello messages.  The ERLSP control block may contain the following information:
           - ERLSPID/Peg ERLSPID
           - State
           - FEC object
           - Flags
             o Self is Peg Node
             o Pinned path
             o Upstream segment (Strict/Loose) type
             o downstream segment (Strict/Loose) type
           - next peg node
           - preemption level
           - upstream neighbor (next hop/interface)
           - downstream neighbor (next hop/interface)
           - BW information (only at peg LSRs with loose downstream
               segment)
           - Explicit Route Object (only at peg LSRs with loose
               downstream segment)

   For the purpose of matching message to existing ERLSP control
   block, both encoding
     for the ERLSPID and Peg ERLSPID Common Hello Parameters TLV is:

      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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |U|F| Common Hello Parms(0x0400)|      Length                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |      Hold Time                |T|R| Reserved                  |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     Hold Time,
       Hello hold time in seconds.  An LSR maintains a record of Hellos
       received from potential peers (see Section "Hello Message Pro-
       cedures").  Hello Hold Time specifies the message are
   matched against time the ones in sending LSR
       will maintain its record of Hellos from the control block.  Its only when
   both receiving LSR without
       receipt of them match that another Hello.

       A pair of LSRs negotiates the message is considered to be hold times they use for the
   matched control block, otherwise it is treated as Hellos from
       each other.  Each proposes a new ERLSP
   request. hold time.  The ingress may use the ERLSPID as the peg ERLSPID.
   At the peg nodes, hold time used is
       the control block fields ERLSPID and Previous
   Peg ERLSDID are compared because Peg ERLSPID contains minimum of the self
   assigned Peg ERLSPID.  Also note that hold times proposed in their Hellos.

       A value of 0 means use the Request message at
   Peg node is only compared for ERLSPID to select a control
   block.

   The state tables for peg node and non peg nodes are given
   separately.  Separate state tables default.  There are used only interface type
       specific defaults for
   illustrative purposes.  The state engines can be collapsed into
   a single state engine.  Moreover, a completely strict ERLSP can
   be treated Link Hellos as well as a special case default for Tar-
       geted Hellos.  A value of loosely routed where every
   neighbor 0xfffff means infinite.

     T, Targeted Hello
       A value of 1 specifies that this Hello is a peg LSR with several Targeted Hello.  A
       value of the state transitions
   optimized.

2.12.1. Loose Segment Peg LSR Transitions:

   Peg LSRs in a loosely routed ERLSP segment are those 0 specifies that are expli-
   citly listed in the explicit route object as the starting or ending
   of this Hello is a loose segment.

      State NULL

          Event      Action                               New State Link Hello.

     R, Request    Create ERLSP control block; store    Response
                     relevant information from the        Awaited
                     message into the control block;
                     select a new peg ERLSPID; reserve
                     BW specified in the message; obtain
                     next hop (or interface) towards
                     next peg LSR; propagate message
                     towards the obtained next hop.

                     If last node in Send Targeted Hellos
       A value of 1 requests the explicit route   Established
                     object, allocate an upstream label;
                     commit BW; originate a Response
                     message upstream.

                     If unable receiver to process request for     No change
                     any reason, issue a NAK message send periodic Targeted Hel-
       los to the sender with appropriate error
                     code.

          Response   Send NAK message source of this Hello.  A value of 0 makes no request.

       An LSR initiating Extended Discovery sets R to 1.  If R is 1, the sender.      No change

          Others     Silently ignore event.               No change

      State RESPONSE_AWAITED

          Event      Action                               New State

          Response   Install downstream label in          Established
                     message; choose an upstream label;
                     connect upstream
       receiving LSR checks whether it has been configured to downstream
                     label; commit BW send Tar-
       geted Hellos to the connection;
                     propagate Response upstream with
                     upstream label.

                     If unable Hello source in response to process Response        Null
                     message for any reason then recover
                     resources; originate a Nak message
                     upstream; originate a Release
                     message downstream; delete control
                     block.

          Upstream   Release resources; propagate Nak     Null
          lost       downstream; delete control block.

          Downstream Reassign a new Peg ERLSPID.  Start   Retry
          lost       RETRY timer.

          Nak from   Reassign a new Peg ERLSPID.  RETRY   Retry
          downstream timer. Hellos with this
       request.  If error code in Nak is severe then  Null
                     propagate not, it ignores the Nak upstream; release
                     resources; delete control block.

          Nak from   Release resources; propagate Nak     Null
          upstream   downstream; delete control block.

          New NH request.  If ERLSP so, it initiates
       periodic transmission of Targeted Hellos to the Hello source.

     Reserved
       This field is pinned, ignore event.    Retry
                     Otherwise, send reserved.  It must be set to zero on transmission
       and ignored on receipt.

     Optional Parameters
       This variable length field contains 0 or more parameters, each
       encoded as a Nak downstream;
                     change NH in TLV.  The optional parameters defined by this ver-
       sion of the control block;
                     reassign a new Peg ERLSPID.  Start
                     RETRY timer.

          Others     Silently ignore event.               No change

      State RETRY

          Event      Action                               New State

          Retry      Originate Request message towards    Response
          Timer protocol are

           Optional Parameter    Type     Length  Value

           Transport Address     0x0401     4      See below
           Configuration         0x0402     4      See below
              Sequence Number

       Transport Address
         Specifies the next hop in IPv4 address to be used for the control block.   Awaited

          New NH sending LSR when
         opening the LDP session TCP connection.  If ERLSP this optional TLV
         is pinned, ignore not present the       No change
                     event.  Otherwise change next hop
                     information in IPv4 source address for the control block.

          Nak from   Release all resources (BW, label,    Null
          upstream   timer);  delete control block.

          Upstream   Release all resources (BW, label,    Null
          lost       timer);  delete control block.

          Release    Release all resources (BW, label,    Null
                     timer); delete control block.

          Downstream If there is UDP packet car-
         rying the Hello should be used.

       Configuration Sequence Number
         Specifies a new next hop, update   No change
          lost 4 octet unsigned configuration sequence number that in
         identifies the control block.

                     Otherwise, delete timer; recover     Null
                     resources; send Nak upstream;
                     delete control block.

          Others     Silently ignore event.               No change

      State RECONNECT_AWAITED

          Event      Action                               New State

          Request    Make appropriate changes in configuration state of the      Established
                     control block; make label
                     connection; send a Response message
                     upstream with upstream label.

                     If unable sending LSR.  Used by
         the receiving LSR to process Request         Null
                     message for any reason then send a
                     Release message downstream and a
                     Nak message upstream; release
                     resources; delete control block.

          Reconnect  Release resources; send Release      Null
          Awaited    message downstream; delete control
          Timer      block.

          Upstream   Ignore event.                        No change
          lost

          Downstream Release resources; delete control    Null
          lost       block.

          New NH     Release resources; delete control    Null
                     block.

          Nak from   Release resources; delete control    Null
          downstream block.

          Others     Silently ignore event.               No change

      State ESTABLISHED

          Event      Action                               New State
          Upstream   Start RECONNECT_AWAITED timer.       Reconnect
          lost                                            Awaited

          Downstream Reassign a new Peg ERLSPID.  Start   Retry
          lost       RETRY timer.

          Nak detect configuration changes on the
         sending LSR.

3.5.2.1. Hello Message Procedures

   An LSR receiving Hellos from   Reassign another LSR maintains a new Peg ERLSPID.  Start   Retry
          downstream RETRY timer.

                     If error code in Nak is severe then  Null
                     propagate Hello adjacency
   corresponding to the Nak upstream; release
                     resources; delete control block.

          Nak from   Reassign Hellos.  The LSR maintains a new Peg ERLSPID.  Start   Reconnect
          upstream   RECONNECT_AWAITED timer.             Awaited

                     If error code in Nak is severe,      Null
                     then propagate hold timer with the Nak downstream;
                     release resources; delete control
                     block.

          New NH
   Hello adjacency which it restarts whenever it receives a Hello that
   matches the Hello adjacency.  If ERLSP is pinned, ignore the       Retry
                     event.  Otherwise, send hold timer for a Nak
                     downstream; change next hop in
                     control block; reassign Hello adjacency
   expires the LSR discards the Hello adjacency: see sections "Maintain-
   ing Hello Adjacencies" and "Maintaining LDP Sessions".

   We recommend that the interval between Hello transmissions be at most
   one third of the Hello hold time.

   An LSR processes a new Peg
                     ERLSPID.  Start RETRY timer.

          Release    Release resources; propagate         Null
                     message downstream; delete control
                     block.

          Others     Silently ignore event.               No change

2.12.2. Loose Segment Non-Peg received LDP Hello as follows:

      1. The LSR Transitions:

   Non-peg LSRs in checks whether the Hello is acceptable.  The criteria
         for determining whether a loose segment of an ERLSP Hello is acceptable are implementa-
         tion dependent (see below for example criteria).

      2. If the LSRs intermediate
   to two peg LSRs and through which the loose segment Hello is routed using not acceptable, the hop-by-hop forwarding path.

      State NULL

          Event      Action                               New State

          Request    Create ERLSP control block; reserve  Response
                     BW specified in LSR ignores it.

      3. If the Hello is acceptable, the message; obtain  Awaited
                     next hop (or interface) towards
                     next peg LSR; if penultimate hop to
                     next peg LSR then increment pointer
                     in ERNH object; propagate message
                     towards checks whether it has a
         Hello adjacency for the obtained next hop Hello source. If unable to process request so, it restarts the
         hold timer for     No change
                     any reason, issue the Hello adjacency.  If not it creates a Nak message to Hello
         adjacency for the Hello source and starts its hold timer.

      4. If the Hello carries any optional TLVs the LSR processes them
         (see below).

      5. Finally, if the sender with appropriate error
                     code.

          Response   Send a Nak message to LSR has no LDP session for the sender.    No change

          Others     Silently ignore event.               No change

      State RESPONSE_AWAITED

          Event      Action                               New State

          Response   Install downstream label space
         specified by the LDP identifier in          Established
                     message; choose an upstream label;
                     connect upstream to downstream
                     label; commit BW to connection;
                     propagate Response upstream with
                     upstream label.

                     If unable to process Response        Null
                     message the PDU header for any reason then
                     recovery resources; propagate a Nak
                     message upstream; originate a
                     Release message downstream; delete
                     control block.

          Upstream   Originate a Nak message downstream;  Null
          lost       delete control block.

          Downstream Originate a Nak message upstream;    Null
          lost       delete control block.

          Nak from   Propagate Nak message upstream;      Null
          downstream release reserved BW; delete control
                     block.

          Nak from   Propagate Nak message downstream;    Null
          upstream   release reserved BW; delete control
                     block;

          New NH     If ERLSP is pinned, ignore the       Null
                     event.  Otherwise, send Nak message
                     upstream
         Hello, it follows the procedures of Section "LDP Session Estab-
         lishment".

   The following are examples of acceptability criteria for Link and downstream; release
                     reserved BW; delete control block.

          Release    Propagate message downstream;        Null
                     release resources; delete control
                     block.

          Others     Silently ignore event.               No change

      State ESTABLISHED

          Event      Action                               New State

          Upstream   Send Nak message downstream;         Null
          lost       release resources (BW, label);
                     delete control block.

          Downstream Send Nak message upstream; release   Null
          lost       resources; delete control block.

          Nak from   Release resources; propagate Nak     Null
          downstream message upstream; delete control
                     block.

          Nak from   Release resources; propagate         Null
          upstream   message Nak downstream; delete
                     control block.

          New NH     If ERLSP
   Targeted Hellos:

       A Link Hello is pinned, ignore acceptable if the       Null
                     event.  Otherwise, release
                     resources; originate Nak  message
                     upstream; originate Nak message
                     downstream; delete control block.

          Release    Release resources; propagate         Null
                     message downstream; delete control
                     block.

          Others     Silently ignore event.               No change

2.12.2.1. Strict Segment Transitions interface on which it was
       received has been configured for label switching.

       A LSR whose upstream and downstream segment of an ERLSP Targeted Hello from IP source address a.b.c.d is
      strict acceptable if
       either:

           - The LSR has a state transition exactly similar been configured to accept Targeted Hellos, or

           - The LSR has been configured to the non-peg
      LSR (only different being does not handle the case of pinned
      down option).

2.12.3. ERLSP Timeouts send Targeted Hellos to
             a.b.c.d.

       The following timeouts are used in the state transition:

     RETRY
          Default value TBD.  This timer is set by the peg describes how an LSR to ori-
          ginate a Request message downstream on processes Hello optional TLVs:

       Transport Address
         The LSR associates the elapse of specified transport address with the timer
          when a  downstream loose segment is lost.

     RECONNECT
          Default value TBD.  This timer
         Hello adjacency.

       Configuration Sequence Number
         The Configuration Sequence Number optional parameter is set used by
         the peg sending LSR to dein-
          stall an ERLSP on the elapse of signal configuration changes to the timer when receiv-
         ing LSR.  When a upstream
          loose segment is lost.

2.12.4. ERLSP Error Codes

   NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

     To be supplied.

     This subsection should be moved to Section 3.

   END NOTE * END NOTE * END NOTE:

3. Protocol Specification

   Previous sections that describe LDP operation have discussed
   scenarios that involve receiving LSR playing the exchange of messages among active role in LDP peers.
   This section specifies the message encodings and procedures for pro-
   cessing
         session establishment detects a change in the messages.

   LDP message exchanges are accomplished by sending LDP protocol data
   units (PDUs) over LDP LSR con-
         figuration, it may clear the session TCP connections.

   Each LDP PDU can carry one or more LDP messages.  Note that setup backoff delay, if
         any, associated with the mes-
   sages in an LDP PDU need not be related to one another.  For example,
   a single PDU could carry a message advertising FEC-label bindings for
   several FECs, another message requesting label bindings sending LSR (see Section "Session Ini-
         tialization").

         A sending LSR using this optional parameter is responsible for several
   other FECs, and
         maintaining the configuration sequence number it transmits in
         Hello messages.  Whenever there is a third notification message signalling some event.

3.1. LDP PDUs

   Each configuration change on
         the sending LSR, it increments the configuration sequence
         number.

3.5.3. Initialization Message

   The LDP PDU Initialization Message is a fixed LDP header followed by one or more exchanged as part of the LDP mes-
   sages. ses-
   sion establishment procedure; see Section "LDP Session Establish-
   ment".

   The fixed LDP header encoding for the Initialization Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Initialization (0x0200)   |  Version                      |         PDU      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                         LDP Identifier                     Message ID                                |
   +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Common Session Parameters TLV             |          Res
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Version
     Two octet unsigned integer containing the version number of the
     protocol.  This version of the specification specifies LDP protocol
     version 1.

   PDU Length
     Two octet integer specifying the total length of this PDU in bytes,
     excluding the Version and PDU Length fields.

   LDP Identifier
     Six octet field that uniquely identifies the label space for which
     this PDU applies.  The first four octets encode an IP address
     assigned to the LSR.  This address should be the router-id, also
     used in LSR Path Vector
   Message Id
     32-bit value used by loop detection and loop prevention
     procedures.  The last two octets to identify a label space within this message.

   Common Session Parameters TLV
     Specifies values proposed by the
     LSR.  For a platform-wide label space, these should both be zero.

   Res
     This field is reserved. It must be set sending LSR for parameters common
     to zero on transmission and
     must be ignored on receipt.

3.2. Type-Length-Value Encoding all LDP uses a Type-Length-Value (TLV) sessions.

     The encoding scheme to encode much of
   LDP message contents.  An LDP TLV is encoded as a 2 octet Type field,
   followed by a 2 octet Length Field followed by a variable length
   Value field. for the Common Session Parameters TLV is:

        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                      |
       |U|F| Common Sess Parms (0x0500)|      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       | Protocol Version              |      Hold Time                |                         Value
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |A|D| PVLim |
   ~                                                               ~     Reserved      |      Max PDU Length           |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                 Receiver LDP Identifer                        |
       +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Type
     Encodes how
       -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++

       Protocol Version
         Two octet unsigned integer containing the Value field is to be interpreted.

   Length
     Specifies version number of the length
         protocol.  This version of the Value field in octets.

   Value
     Octet string specification specifies LDP pro-
         tocol version 1.

       Hold Time
         Two octet unsigned non zero integer that indicates the number
         of Length octets seconds that encodes information the
     interpretation sending LSR proposes for the value of which is specfied the
         KeepAlive Interval.  The receiving LSR MUST calculate the value
         of the KeepAlive Timer by using the Type field.

   Note that smaller of its proposed
         Hold Time and the Value field itself may contain TLV encodings.  That is,
   TLVs Hold Time received in the PDU.  The value
         chosen for Hold Time indicates the maximum number of seconds
         that may be nested. elapse between the receipt of successive PDUs from the
         LDP peer.  The TLV encoding scheme KeepAlive Timer is very general.  In principle, everything
   appearing in an LDP PDU could be encoded as reset each time a TLV.  This specifica-
   tion does not use the TLV scheme to its full generality.  It is not
   used where its generality is unnecessary and its use would waste
   space unnecessarily.  These are usually places where PDU
         arrives.

       A, Label Advertisement Discipline
         Indicates the type of Label advertisement.  A value of 0 means
         Downstream Unsolicited advertisement; a value to be encoded of 1 means Down-
         stream On Demand.

         If one LSR proposes Downstream Unsolicted and the other pro-
         poses Downstream on Demand, the rules for resolving this
         difference is:

           - If the session is known, for example by its position in a mes-
   sage label-controlled ATM link or a
             label-controlled Frame Relay link, then Downstream on
             Demand must be used.

           - Otherwise, Downstream Unsolicted must be used.

         If the label advertisement discipline determined in this way is
         unacceptable to an enclosing TLV, and LSR, it must send a Session
         Rejected/Parameters Advertisement Mode Notification message in
         response to the length of Initialization message and not establish the
         session.

       D, Loop Detection
         Indicates whether loop detection based on path vectors is
         enabled.  A value of 0 means loop detection is fixed or
   readily derivable from the disabled; a
         value encoding itself.

   Some of 1 means that loop detection is enabled.

       PVLim, Path Vector Limit
         The configured maximum path vector length.  Must be 0 if loop
         detection is disabled (D = 0).  If the TLVs defined for LDP are similar loop detection pro-
         cedures would require the LSR to one another.  For
   example, there is send a Generic Label TLV, an ATM Label TLV, and path vector that
         exceeds this limit, the LSR will behave as if a Frame
   Relay TLV; see Sections "Generic Label TLV", "ATM Label TLV", and
   "Frame Relay TLV".

   While is possible to think about TLVs related loop had been
         detected for the FEC in this way question.

         When Loop Detection is enabled in terms a portion of a TLV type network, it is
         recommended that specifies a TLV class and a TLV subtype all LSRs in that speci-
   fies a particular kind portion of TLV within the network be
         configured with the same path vector limit.  Although
         knowledege of a peer's path vector limit will not change an
         LSR's behavior, it does enable the LSR to alert an operator to
         a possible misconfiguration.

       Reserved
         This field is reserved.  It must be set to zero on transmission
         and ignored on receipt.

       Max PDU Length
         Two octet unsigned integer that class, this specification
   does not formalize proposes the notion of a TLV subtype.

   The specification assigns type values maximum allowable
         length for LDP PDUs for related TLVs, such as the
   label TLVs, from session.  A value of a contiguous block in the 16-bit TLV type number
   space.

   Section "TLV Summary" lists 255 or less
         specifies the TLVs defined in this version default maximum length of 4096 octets.

         The receiving LSR MUST calculate the
   protocol and maximum PDU length for the document section that describes each.

3.3. Commonly Used TLVs

   There are several TLV encodings used
         session by more than one LDP message.
   The encodings using the smaller of its and its peer's proposals
         for these commonly used TLVs are specified in Max PDU Length. The default maximum PDU length applies
         before session initialization completes.

         If the maximum PDU length determined this sec-
   tion.

3.3.1. FEC TLV

   Labels are bound to Forwarding Equivalence Classes (FECs).  An FEC way is
   a list of one or more FEC elements.  The FEC TLV encodes FEC items.

   Its encoding is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     FEC (0x0100)              |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        FEC Element 1                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        FEC Element n                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   FEC Element 1 unacceptable
         to an LSR, it must send a Session Rejected/Parameters Max PDU
         Length Notification message in response to FEC Element n
     There are several types of FEC elements; see Section "FEC Types".
     The FEC element encoding depends on the type of FEC element.  Note
     that while Initialization
         message and not establish the representation of session.

       Receiver LDP Identifer
         Identifies the FEC element value is type-
     dependent that receiver's label space.  This LDP Identifier,
         together with the value encoding itself is one where standard sender's LDP
     TLV encoding is not used.

     A FEC Element value Identifier in the PDU header
         enables the receiver to match the Initialization message with
         one of its Hello adjacencies; see Section "Hello Message Pro-
         cedures".

         If there is encoded as no matching Hello adjacency, the LSR must send a 1 octet field that specifies
         Session Rejected/No Hello Notification message in response to
         the element type, Initialization message and a not establish the session.

   Optional Parameters
     This variable length field that is the type-
     dependent element value. contains 0 or more parameters, each
     encoded as a TLV.  The FEC Element value encoding is:

         FEC Element optional parameters are:

         Optional Parameter       Type     Length  Value
         type name

           Wildcard        0x01      No value; i.e., 0 value octets;
                                         see below.
           Prefix          0x02

         ATM Session Parameters   0x0501   var     See Prefix value encoding below.
           Router Id       0x03      4 octet full IP address.
           Flow            0x04 below
         Frame Relay Session      0x0502   var     See Flow value encoding below.

     Wildcard FEC Element
       To be used only in the Label Withdraw and Label Release Messages.
       Indicates the withdraw/release is to be applied to all FECs asso-
       ciated with the label within the following below
           Parameters

     ATM Session Parameters
       Used when an LDP session manages label TLV.  Must be
       the only FEC Element in the FEC TLV.

     Prefix FEC Element value encoding: exchange for an ATM link
       to specify ATM-specific session parameters.

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |U|F|   ATM Sess Parms (0x0501) |     Address Family      Length                   |    PreLen
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       | M |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+   N   |E|                        Reserved                 |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                 ATM Label Range Component 1                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                            Prefix                                                               |
       ~                                                               ~
       |                                                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Address Family
         Two octet quantity containing a value from ADDRESS FAMILY
         NUMBERS in Assigned Numbers [ref] that encodes the address fam-
         ily for
       |                 ATM Label Range Component N                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       M, ATM Merge Capabilities
         Specifies the address prefix merge capabilities of an ATM switch.  The follow-
         ing values are supported in this version of the Prefix field.

       PreLen
         One octet unsigned integer containing specification:

                   Value          Meaning

                     0            Merge not supported
                     1            VP Merge supported
                     2            VC Merge supported
                     3            VP & VC Merge supported

         If the length in bits merge capabilities of the
         address prefix LSRs differ, then:

           - Non-merge and VC-merge LSRs may freely interoperate.

           - The interoperability of VP-merge-capable switches with
             non-VPN-merge-capable switches is a subject for future
             study.

         Note that follows.

       Prefix
         An address prefix encoded according if VP merge is used, it is the responsibility of the
         ingress node to ensure that the Address Family
         field, whose length, in bits, was specified chosen VCI is unique within the
         LSR domain.

       N, Number of label range components
         Specifies the number of ATM Label Range Components included in
         the PreLen
         field, padded to a byte boundary.

     Flow FEC Element TLV.

       E, ATM Null Encapsulation
         A value encoding:

      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 of 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                     Network Source Address                    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                     Network Destination Address               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |         Source Port           |        Dest Port              |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |    Protocol   |   Direction   |        Reserved               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Network Source Address
         Four octet source IPv4 address.

       Network Destination Address
         Four octet destination IPv4 address.

       NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

         For generality specifies specifies that the LSR supports the null
         encapsulation of [rfc1483] for its data VCs on the address encodings here should include an
         Address Family field, etc.

       END NOTE * END NOTE * END NOTE:

       Source Port
         Two octet source port.

       Destination Port
         Two octet destination port.

       Protocol
         Protocol type.

       Direction
         One octet indicating ATM link
         managed by the direction LDP session.  In this case IP packets are car-
         ried directly inside AAL5 frames.  A value of 0 specifies that
         the LSP.  Field null encapsulation is set to
         1 on Downstream; not supported.

       Reserved
         This field is reserved.  It must be set to 2 zero on Upstream.

       NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

         Use of this FEC is not fully specified in this version transmission
         and ignored on receipt.

       One or more ATM Label Range Components
         A list of ATM Label Range Components which together specify the
         protocol

       END NOTE * END NOTE * END NOTE:

3.3.1.1. FEC Procedures

   If in decoding a FEC TLV an LSR encounters a FEC Element type it can-
   not decode, it should stop decoding
         Label range supported by the FEC TLV, abort processing transmitting LSR.

         A receiving LSR MUST calculate the
   message containing intersection between the TLV,
         received range and send an Ack/Nack message to its own supported label range.  The inter-
         section is the range in which the LSR
   peer signalling an error.

3.3.2. Label TLVs

   Label TLVs encode may allocate and accept
         labels.  Label TLVs are carried by  LSRs MUST NOT establish a session with neighbors for
         which the messages
   used to advertise, request, release and withdraw label mappings.

   There are several different kinds intersection of Label TLVs which can appear in
   situations that require a Label TLV.

3.3.2.1. Generic Label TLV

   An ranges is NULL.  In this case, the
         LSR uses Generic must send a Session Rejected/Parameters Label TLVs Range Notifi-
         cation message in response to encode labels for use on links for
   which label values are independent of the underlying link technology.
   Examples of such links are PPP Initialization message and Ethernet.
         not establish the session.

         The encoding for an ATM Label Range Component is:

          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
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |     Generic Label (0x0200)  Res  |      Length    Minimum VPI        |      Minimum VCI              |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |     Label  Res  |    Maximum VPI        |      Maximum VCI              |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Label

         Res
           This field is reserved. It must be set to zero on transmis-
           sion and must be ignored on receipt.

         Minimum VPI (12 bits)
           This 12 bit field specifies the lower bound of a block of
           Virtual Path Identifiers that is supported on the originating
           switch.  If the VPI is less than 12-bits it should be right
           justified in this field and preceding bits should be set to
           0.

         Minimum VCI (16 bits)
           This 16 bit field specifies the lower bound of a 20-bit block of
           Virtual Connection Identifiers that is supported on the ori-
           ginating switch.  If the VCI is less than 16-bits it should
           be right justified in this field and preceding bits should be
           set to 0.

         Maximum VPI (12 bits)
           This 12 bit field specifies the upper bound of a block of
           Virtual Path Identifiers that is supported on the originating
           switch.  If the VPI is less than 12-bits it should be right
           justified in this field and preceding bits should be set to
           0.

         Maximum VCI (16 bits)
           This 16 bit field specifies the upper bound of a block of
           Virtual Connection Identifiers that is supported on the ori-
           ginating switch.  If the VCI is less than 16-bits it should
           be right justified in this field and preceding bits should be
           set to 0.

     Frame Relay Session Parameters
       Used when an LDP session manages label value as specified in [ENCAP] represented as
     a 20-bit number in exchange for a 4 octet field.

3.3.2.2. ATM Label TLV

   An LSR uses ATM Label TLVs Frame Relay
       link to encode labels for use on ATM links. specify Frame Relay-specific session parameters.

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     ATM Label (0x0201)
       |U|F|   FR Sess Parms (0x0502)  |      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Res| V
       |          VPI M |              VCI   N   |                          Reserved                 |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Res
       |             Frame Relay Label Range Component 1               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                                                               |
       ~                                                               ~
       |                                                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |             Frame Relay Label Range Component N               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       M, Frame Relay Merge Capabilities
         Specifies the merge capabilities of a Frame Relay switch.  The
         following values are supported in this version of the specifi-
         cation:

                   Value          Meaning

                     0            Merge not supported
                     1            Merge supported

         Non-merge and merge Frame Relay LSRs may freely interoperate.

       N, Number of label range components
         Specifies the number of Frame Relay Label Range Components
         included in the TLV.

       Reserved
         This field is reserved.  It must be set to zero on transmission
         and
     must be ignored on receipt.

   V-bits
     Two-bit switching indicator.  If V-bits is 00, both the VPI and VCI
     are significant.  If V-bits is 01, only

       One or more Frame Relay Label Range Components
         A list of Frame Relay Label Range Components which together
         specify the VPI field is signifi-
     cant.  If V-bit is 10, only Label range supported by the VCI is significant.

   VPI
     Virtual Path Identifier. If VPI is less than 12-bits it should be
     right justified in this field and preceding bits should be set to
     0.

   VCI
     Virtual Connection Identifier. If transmitting LSR.

         A receiving LSR MUST calculate the VCI is less than 16- bits, it
     should be right justified in intersection between the field
         received range and the preceding bits must
     be set to 0. If Virtual Path switching its own supported label range.  The inter-
         section is indicated in the V-bits
     field, then this field must be ignored by range in which the receiver LSR may allocate and set to 0
     by accept
         labels.  LSRs MUST NOT establish a session with neighbors for
         which the intersection of ranges is NULL.  In this case, the sender.

3.3.2.3. Frame Relay Label TLV

   An
         LSR uses Frame Relay must send a Session Rejected/Parameters Label TLVs Range Notifi-
         cation message in response to encode labels the Initialization message and
         not establish the session.

         The encoding for use on a Frame Relay links. Label Range Component is:

          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
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |   Frame Relay Label (0x0202)  |      Length Reserved    |Len|                     Minimum DLCI            |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         | Reserved        |Len|        |                     Maximum DLCI            |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Res

         Reserved
           This field is reserved.  It must be set to zero on transmission transmis-
           sion and
     must be ignored on receipt.

         Len
           This field specifies the number of bits of the DLCI.  The
           following values are supported:

                Len    DLCI bits

                0 =       10 bits DLCI
                1 =       17 bits DLCI
                2 =       23 bits DLCI

         Minimum DLCI
     The
           This 23-bit vield specifies the lower bound of a block of
           Data Link Connection Identifier.  Refer to
     draft-ietf-mpls-fr-01.txt [FR] for the label values and formats.

3.3.3. Address List TLV

   The Address List TLV appears in Address and Address Withdraw mes-
   sages.

   Its encoding is:

    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 List (0x0101)     |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Address Family            |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
   |                                                               |
   |                        Addresses                              |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Address Family
     Two octet quantity containing a value from ADDRESS FAMILY NUMBERS
     in Assigned Numbers [ref] Identifiers (DLCIs) that encodes the addresses contained in
     the Addresses field.

   Addresses
     A list of addresses from the specified Address Family.  The encod-
     ing of the individual addresses depends is supported on
           the Address Family. originating switch.  The following address encodings are defined by DLCI should be right justified
           in this version field and unused bits should be set to 0.

         Maximum DLCI
           This 23-bit vield specifies the upper bound of a block of
           Data Link Connection Identifiers (DLCIs) that is supported on
           the
     protocol:

         Address Family      Address Encoding

         IPv4                4 octet full IPv4 address

3.3.4. COS TLV originating switch.  The COS (Class of Service) DLCI should be right justified
           in this field and unused bits should be set to 0.

   Note that there is no Generic Session Parameters TLV may appear for sessions
   which advertise Generic Labels.

3.5.3.1. Initialization Message Procedures

   See Section "LDP Session Establishment" and particularly Section
   "Session Initialization" for general procedures for handling the
   Initialization Message.

3.5.4. KeepAlive Message

   An LSR sends KeepAlive Messages as an optional field in
   messages part of a mechanism that carry label mappings.  Its monitors
   the integrity of the LDP session transport connection.

   The encoding for the KeepAlive Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   KeepAlive (0x0201)        |     COS (0x0102)              |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     COS Value                                                 |
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   COS Value
     The COS Value may be one of several types, encoded as a 1 octet
     type followed by a variable length, type-dependent value.  Note
     that the encoding of the COS

   Message Id
     32-bit value is not used to identify this message.

   Optional Parameters
     No optional parameters are defined for the standard KeepAlive message.

3.5.4.1. KeepAlive Message Procedures

   The Hold Timer mechanism described in Section "Maintaining LDP TLV
     encoding.  Note also that the length of the type-dependent value
     can be derived from the length of the COS TLV. Ses-
   sions" resets a session hold timer every time an LDP PDU is received.
   The following COS value encodings are defined by this version KeepAlive Message is provided to allow reset of the protocol:

         COS Name     Type code    Value

         IP Prec      0x01         1 octet IP Precedence

   If Hold Timer in decoding a COS TLV
   circumstances where an LSR encounters a COS type it cannot
   decode, it should stop decoding the COS TLV, abort processing the
   message containing the TLV, and send an Ack/Nack message has no other information to its communicate to
   an LDP peer.

   An LSR must arrange that its peer signalling an error.

3.3.5. Hop Count TLV

   The Hop Count TLV appears as receive an optional field LDP Message from it at
   least every Hold Time period.  Any LDP protocol message will do but,
   in circumstances where no other LDP protocol messages that set
   up LSPs.  It calculates have been sent
   within the number of period, a KeepAlive message must be sent.

3.5.5. Address Message

   An LSR hops along sends the Address Message to an LSP as LDP peer to advertise its
   interface addresses.

   The encoding for the
   LSP is being setup. Address Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Address (0x0300)          |     Hop Count (0x0103)        |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     HC Value                     Message ID                                |
   +-+-+-+-+-+-+-+-+

   HC Value
     1 octet unsigned integer hop count value.

3.3.5.1. Hop Count Procedures

   During setup
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   |                     Address List TLV                          |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit value used to identify this message.

   Address List TLV
     The list of an LSP an LSR may receive a Label Mapping or Label
   Request message interface addresses being advertised by the sending
     LSR.  The encoding for the Address List TLV is specified in Section
     "Address List TLV".

   Optional Parameters
     No optional parameters are defined for the LSP Address message.

3.5.5.1. Address Message Procedures

   An LSR that contains receives an Address Message message uses the Hop Count TLV.  If it
   does, addresses it should record the hop count value.  If the LSR then passes
   learns to maintain a
   Label Mapping message database for the LSP to an upstream mapping between peer or LDP Identif-
   iers and next hop addresses; see Section "LDP Identifiers and Next
   Hop Addresses".

   When a new LDP session is initialized and before sending Label Map-
   ping or Label Request to messages an LSR should advertise its interface
   addresses with one or more Address messages.

   Whenever an LSR "activates" a downstream peer to continue the LSP setup, it must
   increment the recorded hop count value and include new interface address, it in a Hop Count
   TLV in the message.  The first LSR in the LSP should set adver-
   tise the hop
   count value to 1.

   If new address with an Address message.

   Whenever an LSR receives a Label Mapping message containing "de-activates" a Hop Count
   TLV, previously advertised address, it must check the hop count value to determine whether
   should withdraw the hop
   count has wrapped (hop count value = 0).  If so, it must reject address with an Address Withdraw message; see
   Section "Address Withdraw Message".

3.5.6. Address Withdraw Message

   An LSR sends the
   Label Mapping message in order Address Message to prevent a forwarding loop.

3.3.6. Path Vector TLV

   The Path Vector TLV is used in messages that implement an LDP loop
   detection and prevention.  It records the path of LSRs a label adver-
   tisement has traversed peer to setup an LSP.  Its withdraw previ-
   ously advertised interface addresses.

   The encoding for the Address Withdraw Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U    Address Withdraw (0x0301) |     Path Vector (0x0104)        |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            LSR Id 1                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                     Address List TLV                          |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                            LSR Id n                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   One or more LSR Ids
     A list of router-identifiers indicating the path of LSRs the map-
     ping message has traversed.  Each router-id must be the router-id
     component of the LDP identifier for the corresponding LSR.  This
     ensures it is unique within the LSR network.

3.3.6.1. Path Vector Procedures

   During setup of an LSP an LSR may receive a Label Mapping message for
   the LSP that contains the Path Vector TLV.  If it does, the LSR must
   pass a Label Mapping message for the LSP to the upstream peer(s)

   Message Id
     32-bit value used to
   continue the LSP setup.  This message must include a Path Vector TLV
   in the identify this message.

   Address list TLV
     The value list of interface addresses being withdrawn by the path vector in the Path Vector TLV
   must be the received path vector with the LSRs own LSR Id appended to
   it.

   If an LSR receives a Label Mapping message containing a Path Vector
   TLV, it must check the path vector value to determine whether the
   vector contains its own LSR-id.  If so, it must reject the Label Map-
   ping message in order to prevent a forwarding loop. sending LSR.
     The Path Vector encoding for the Address list TLV is also used specified in the Label Query message.  See
   Sections "Loop Detection" and "Loop Prevention via Diffusion" Section
     "Address List TLV".

   Optional Parameters
     No optional parameters are defined for
   more details.

3.3.7. Status TLV

   Notification messages carry Status TLVs the Address Withdraw mes-
     sage.

3.5.6.1. Address Withdraw Message Procedures

   See Section "Address Message Procedures"

3.5.7. Label Mapping Message

   An LSR sends a Label Mapping message to specify events being sig-
   nalled. an LDP peer to advertise
   FEC-label bindings to the peer.

   The encoding for the Status TLV Label Mapping Message is:

   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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Label Mapping (0x0400)    |     Status (0x0300)           |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Status Code                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                     FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Message Type                     Label TLV                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Status Code
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit unsigned integer encoding value used to identify this message.

   FEC TLV
     Specifies the event FEC component of the FEC-Label mapping being signalled.  The
     structure adver-
     tised.  See Section "FEC TLV" for encoding.

   Label TLV
     Specifies the Label component of a Status Code is:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 the FEC-Label mapping.  See Sec-
     tion "Label TLV" for encoding.

   Optional Parameters
     This variable length field contains 0 1 2 3 or more parameters, each
     encoded as a TLV.  The optional parameters are:

         Optional Parameter    Length       Value

         Label Request         4 5 6 7 8 9 0            See below
             Message Id
         COS TLV               1 2 3 4 5 6 7 8 9 0            See below
         Hop Count TLV         1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |F|E|                 Status Data                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     F bit
       Fatal error bit.            See below
         Path Vector TLV       variable     See below

     The encodings for the COS, Hop Count, and Path Vector TLVs can be
     found in Section "TLV Encodings for Commonly Used Parameters".

       Label Request Message Id
         If set (=1), this Label Mapping message is a fatal error notifica-
       tion.  If clear (=0), response to a Label Request
         message that carried the Return Message Id optional parameter
         (see Section "Label Request Message") the Label Mapping message
         must include the Request Message Id optional parameter.  The
         value of this optional parameter is an advisory notification.

     E bit
       End-to-end bit.  If set (=1), the notification should be for-
       warded to the LSR for Message Id of the next-hop or previous-hop for
         corresponding Label Request Message.

       COS
         Specifies the LSP,
       if any, Class of Service (COS) to be associated with the event being signalled.
         FEC-Label mapping.  If clear
       (=0), not present, the notification LSR should not be forwarded.

     Status Data
       30-bit unsigned integer which specifies use its
         default COS for IP packets as the status information.

     This specification defines Status Codes (32-bit unsigned integers
     with COS.

       Hop Count
         Specifies the above encoding).

     A Status Code running total of 0 signals success. the number of LSR hops along the
         LSP being setup by the Label Message.  Section "Hop Count Pro-
         cedures" describes how to handle this TLV.

       Path Vector
         Specifies the LSRs along the LSP being setup by the Label Mes-
         sage.  Section "Path Vector Procedures" describes how to handle
         this TLV.

3.5.7.1. Label Mapping Message ID Procedures

   The Mapping message is used by an LSR to distribute a label mapping
   for a FEC to an LDP peer.  If non-zero, 32-bit value that identifies an LSR distributes a mapping for a FEC
   to multiple LDP peers, it is a local matter whether it maps a single
   label to the peer message FEC, and distributes that mapping to which all its peers, or
   whether it uses a different mapping for each of its peers.

   An LSR is responsible for the Status TLV refers. consistency of the label map- pings it
   has distributed, and that its peers have these mappings.

   See Appendx A "LDP Label Distribution Procedures" for more details.

3.5.7.1.1. Independent Control Mapping

   If zero, no specific peer an LSR is configured for independent control, a mapping message is being
     identified.

   Message Type
     If non-zero,
   transmitted by the type LSR upon any of the peer message to which following conditions:

      1. The LSR recognizes a new FEC via the Status TLV
     refers.  If zero, forwarding table, and the Status TLV does not refer to any specific
         label advertisement mode is Downstream Unsolicited advertise-
         ment.

      2. The LSR receives a Request message from an upstream peer message.

3.4. LDP Messages

   All LDP messages have the following TLV 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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Message Type              |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                     Mandatory Parameters                      |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                     Optional Parameters                       |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   Message Type
     Identifies for a
         FEC present in the type LSR's forwarding table.

      3. The next hop for a FEC changes to another LDP peer, and loop
         detection is configured.

      4. The attributes of message

   Message Length
     Specifies a mapping change.

      5. The receipt of a mapping from the length downstream next hop  AND
            a) no upstream mapping has been created  OR
            b) loop detection is configured  OR
            c) the attributes of the message value component (Mandatory plus
     Optional Parameters) in octets

   Message Id
     Four octet integer used to identify this message.  Used mapping have changed.

3.5.7.1.2. Ordered Control Mapping

   If an LSR is doing ordered control, a Mapping message is transmitted
   by downstream LSRs upon any of the
     sending following conditions:

      1. The LSR to facilitate identifying notification messages recognizes a new FEC via the forwarding table, and is
         the egress for that
     may apply to this message.  An FEC.

      2. The LSR sending receives a notification message
     in response to this message will include this Message Id in the
     notification message; see Section "Notification Message".

   Mandatory Parameters
     Variable length set of required Request message parameters.  Some messages
     have no required parameters.

     For messages that have required parameters, the required parameters
     MUST appear from an upstream peer for a
         FEC present in the order specified by LSR's forwarding table, and the individual message
     specifications in LSR is the sections
         egress for that follow.

   Optional Parameters
     Variable length set of optional message parameters.  Many messages
     have no optional parameters.

     For messages FEC OR has a downstream mapping for that have optional parameters, the optional parameters
     may appear in any order. FEC.

      3. The following message types are defined in this version next hop for a FEC changes to another LDP peer, and loop
         detection is configured.

      4. The attributes of LDP:

       Message Name            Type     Section Title

       Notification            0x0001   "Notification Message"
       Hello                   0x0100   "Hello Message"
       Initialization          0x0200   "Initialization Message"
       KeepAlive               0x0201   "KeepAlive Message"
       Address                 0x0300   "Address Message"
       Address Withdraw        0x0301   "Address Withdraw Message"
       Label Mapping           0x0401   "Label Mapping Message"
       Label Request           0x0402   "Label Request Message"
       Label Withdraw          0x0403   "Label Withdraw Message"
       Label Release           0x0404   "Label Release Message"
       Label Query             0x0405   "Label Query Message"
       Explicit Route Request  0x0500   "Explicit Route Request Message"
       Explicit Route Response 0x0501   "Explicit Route Response Message" a mapping change.

      5. The sections that follow specify receipt of a mapping from the encodings and procedures for
   these messages.

   Some downstream next hop  AND
            a) no upstream mapping has been created   OR
            b) loop detection is configured   OR
            c) the attributes of the above message mapping have changed.

3.5.7.1.3. Downstream-on-Demand Label Advertisement

   In general, the upstream LSR is responsible for requesting label map-
   pings when operating in Downstream-on-Demand mode.  However, unless
   some rules are related to one another, followed, it is possible for example neighboring LSRs with
   different advertisement modes to get into a livelock situation where
   everything is functioning properly, but no labels are distributed.
   For example, consider two LSRs Ru and Rd where Ru is the
   Label Mapping, Label Request, Label Withdraw, upstream LSR
   and Label Release mes-
   sages.

   While Rd is possible to think about messages related in this way in
   terms of the downstream LSR for a message type particular FEC.  In this example,
   Ru is using Downstream Unsolicited advertisement mode and Rd is using
   Downstream-on-Demand mode.  In this case, Rd may assume that specifies Ru will
   request a message class label mapping when it wants one and a message
   subtype Ru may assume that specifies Rd
   will advertise a particular kind of message within that
   class, this specification does label if it wants Ru to use one.  If Rd and Ru
   operate as suggested, no labels will be distributed from Rd to Ru.

   This livelock situation can be avoided if the following rule is
   observed: an LSR operating in Downstream-on-Demand mode should not formalize be
   expected to send unsolicited mapping advertisements.  Therefore, if
   the downstream LSR is operating in Downstream-on-Demand mode, the notion of a message
   subtype.

   The specification assigns type values
   upstream LSR is responsible for related messages, such requesting label mappings as needed.

3.5.7.1.4. Downstream Unsolicited Label Advertisement

   In general, the label messages, from of downstream LSR is responsible for advertising a contiguous block in label
   mapping when it wants an upstream LSR to use the 16-bit message
   type number space.

3.4.1. Notification label.  An upstream
   LSR may issue a mapping request if it so desires.

3.5.8. Label Request Message

   An LSR sends a Notification message the Label Request Message to inform an LDP peer of to request a signi-
   ficant event.  A Notification message signals
   binding (mapping) for a fatal error or pro-
   vides advisory information regarding an item such as the processing
   of LDP messages or the state of the LDP session. FEC.

   The encoding for the Notification Label Request Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     Notification (0x0001)
   |U|   Label Request (0x0401)    |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Status (TLV)                     FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this
     32-bit value used to identify this message.

   FEC TLV
     The FEC for which a label is being requested.  See Section "FEC
     TLV" for encoding.

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a TLV.  The optional parameters are:

         Optional Parameter    Length       Value

         Return Message Id     0            See below
         COS TLV               1            See below
         Hop Count TLV         1            See below
         Path Vector TLV       variable     See below

     The encodings for the COS, Hop Count, and Path Vector TLVs can be
     found in Section "TLV Encodings for Commonly Used Parameters".

       Return Message Id
         Requests the LDP peer include the Message Id of this Label
         Request message in its Label Mapping message response.  If an
         LDP peer receives a Label Request message with the Return Mes-
         sage Id optional parameter, its Label Mapping message response
         must contain a Label Request Message Id optional parameter with
         the Message Id of the Label Request message.

   Status TLV
     Indicates  See Section
         "Label Mapping Message".

       COS
         Specifies the event being signalled.  The encoding Class of Service (COS) to be associated with the
         requested FEC-Label mapping.  If not present, the LSR should
         use its default COS for IP packets as the Status
     TLV is specified in COS.

       Hop Count
         Specifies the running total of the number of LSR hops along the
         LSP being setup by the Label Request Message.  Section "Status TLV".

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a TLV.  The following Optional Parameters are generic
     and may appear in any Notification Message:

         Optional Parameter     Type     Length  Value

         Extended Status        0x0301     4      See below

     Other Optional Parameters, specific "Hop
         Count Procedures" describes how to handle this TLV.

       Path Vector
         Specifies the particular event LSRs along the LSR being
     signalled setup by the Notification Messages may appear.  These are
     described elsewhere.

       Extended Status Label
         Request Message.  Section "Path Vector Procedures" describes
         how to handle this TLV.

3.5.8.1. Label Request Message Procedures

   The 4 octet value Request message is used by an Extended Status Code that encodes addi-
         tional information upstream LSR to explicitly request
   that supplements the status information con-
         tained in the Notification Status Code.

3.4.1.1. Notification Message Procedures

   If an downstream LSR encounters assign and advertise a condition requiring it to notify its peer with
   advisory or error information it sends the peer label for a Notification mes-
   sage containing FEC.

   An LSR may transmit a Request message under any of the following con-
   ditions:

      1. The LSR recognizes a Status TLV that encodes new FEC via the information forwarding table, and option-
   ally additional TLVs that provide more information about the event.

   If the condition is one that
         next hop is an LDP peer, and the LSR doesn't already have a fatal error
         mapping from the Status Code carried
   in next hop for the notification will indicate that.  In this case, after sending given FEC.

      2. The next hop to the Notification message FEC changes, and the LSR should terminate doesn't already
         have a mapping from that next hop for the given FEC.

      3. The LSR receives a Label Request for a FEC from an upstream LDP session by
   closing
         peer, the session TCP connection FEC next hop is an LDP peer, and discard all state associated
   with the session, including all label-FEC bindings learned via LSR doesn't
         already have a mapping from the
   session.

   When an next hop.

   The receiving LSR receives should respond to a Notification Label Request message that carries with a Status
   Code that indicates
   Label Mapping for the requested label or with a fatal error, Notification message
   indicating why it should terminate cannot satisfy the LDP ses-
   sion immediately by closing request.

   This version of the session TCP connection protocol defines the following Status Codes for
   the Notification message that signals a request cannot be satisfied:

     No Route
       The FEC for which a label was requested is for a Prefix FEC Ele-
       ment, and discard
   all state associated with the session, including all label-FEC bind-
   ings learned via LSR does not have a route for that prefix.

     No Label Resources
       The LSR cannot provide a label because of resource limitations.
       When resources become available the LSR must notify the session.

3.4.1.2. Events Signalled request-
       ing LSR by sending a Notification Messages

   It is useful for descriptive purpose message with the Label
       Resources Available Status Code.

       An LSR that receives a No Label Resources response to classify events signalled by a Label
       Request message must not issue further Label Request messages
       until it receives a Notification Messages into message with the following categories.

3.4.1.2.1. Malformed PDU or Label Resources
       Available Status code.

     Loop Detected
       The LSR has detected a looping Label Requst message.

   See Appendx A "LDP Label Distribution Procedures" for more details.

3.5.9. Label Withdraw Message

   Malformed LDP PDUs or Messages that are part of the LDP Discovery
   mechanism are handled by silently discarding them.

   An LDP PDU received on LSR sends a TCP connection for Label Withdraw Message to an LDP session is mal-
   formed if:

     - The LDP Identifier in the PDU header is unknown peer to signal the receiver,
       or it is known but is
   peer that the peer may not continue to use specific FEC-label map-
   pings the LDP Identifier associated by LSR had previously advertised.  This breaks the
       receiver with mapping
   between the LDP session.  This is a fatal error signalled
       by FECs and the Bad LDP Identifier Status Code.

     - labels.

   The LDP protocol version is not supported by encoding for the receiver, or it
       is supported but is not Label Withdraw Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Label Withdraw (0x0402)   |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Label TLV (optional)                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit value used to identify this message.

   FEC TLV
     Identifies the version negotiated FEC for which the session
       during session establishment.  This FEC-label mapping is a fatal error signalled by
       the Bad Protocol Version Status Code.

     - The PDU Length being with-
     drawn.

   Optional Parameters
     This variable length field is too short (< 20) contains 0 or too long (> TBD).
       This is more parameters, each
     encoded as a fatal error signaled by the Bad PDU Length Status Code.

   An LDP Message is malformed if:

     - TLV.  The Message Type is unknown. optional parameters are:

         Optional Parameter    Length       Value

         Label TLV             variable     See below

     The encoding for Label TLVs are found in Section "Unknown "Label TLVs".

       Label
         If present, specifies the label being withdrawn (see procedures
         below).

3.5.9.1. Label Withdraw Message Types" Procedures

   An LSR transmits a Label Withdraw message under the following condi-
   tions:

      1. The LSR no longer recognizes a previously known FEC.

      2. The LSR has decided unilaterally (e.g., via configuration) to
         no longer label switch a FEC (or FECs) with the label mapping
         being withdrawn.

   The FEC TLV specifies the FEC for more detail. which labels are to be withdrawn.
   If no Label TLV follows the Message Type FEC, all labels associated with the FEC
   are to be withdrawn; otherwise only the label specified in the
   optional Label TLV is < 0x80000000 (high order bit = 0) to be withdrawn.

   The FEC TLV may contain the Wildcard FEC Element; if so, it is a
       fatal error signalled by may con-
   tain no other FEC Elements.  In this case, if the Unknown Message Type Status Code.

       If Label Withdraw mes-
   sage contains an optional Label TLV, then the Message Type label is >= 0x8000000 (high order bit = 1) to be with-
   drawn from all FECs to which it is
       silently discarded.

     - The Message Length bound.  If there is too large, that is, indicates that the mes-
       sage extends beyond not an
   optional Label TLV in the end of Label Withdraw message, then the containing LDP PDU.  This sending
   LSR is a
       fatal error signalled by withdrawing all label mappings previously advertised to the Bad
   receiving LSR.

   See Appendx A "LDP Label Distribution Procedures" for more details.

3.5.10. Label Release Message Length Status Code.

3.4.1.2.2. Unknown or Malformed TLV

   Malformed TLVs contained in

   An LSR sends a Label Release message to an LDP messages peer to signal the
   peer that are part of the LDP
   Discovery mechanism are handled LSR no longer needs specific FEC-label mappings previ-
   ously requested of and/or advertised by silently discarding the containing
   message.

   A TLV contained in an LDP message received on a TCP connection of an
   LDP is malformed if:

     - peer.

   The TLV Length is too large, that is, indicates that encoding for the Label Release Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|   Label Release (0x0403)   |      Message Length            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC TLV
       extends beyond                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Label TLV (optional)                      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     32-bit value used to identify this message.

   FEC TLV
     Identifies the end of FEC for which the containing message.  This FEC-label mapping is being
     released.

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a
       fatal error signalled by the Bad TLV Length Status Code.

     - TLV.  The optional parameters are:

         Optional Parameter    Length       Value
         Label TLV type is unknown.             variable     See Section "Unknown TLV in Known Mes-
       sage Type" below

     The encodings for more detail. Label TLVs are found in Section "Label TLVs".

       Label
         If present, the TLV type is < 0x80000000 (high order bit 0) label being released (see procedures below).

3.5.10.1. Label Release Message Procedures

   An LSR transmits a Label Release message to a peer when it is no
   longer needs a fatal
       error signalled by the Unknown TLV Status Code.

       If the TLV type is >= 0800000000 (high order bit 1) label previously received from or requested of that
   peer.

   An LSR must transmit a Label Release message under any of the TLV is
       silently dropped.  Section "Unknown TLV in Known Message Type"
       elaborates on this behavior.

     - follow-
   ing conditions:

      1. The TLV Value LSR which sent the label mapping is malformed.  This occurs when no longer the receiver han-
       dles next hop
         for the TLV but cannot decode mapped FEC, and the TLV Value.  This LSR is
       intrepreted as indicative of configured for conservative
         operation.

      2. The LSR receives a bug in either the sending or
       receiving LSR.  It label mapping from an LSR which is a fatal error signalled by not the Malformed
       TLV Value Status Code.

3.4.1.2.3. Session Hold Timer Expiration

   This is a fatal error signalled by
         next hop for the Hold Timer Expired Status
   Code.

3.4.1.2.4. Unilateral Session Shutdown

   This is a non-fatal event signalled by FEC, and the Shutdown Status Code.  The
   Notification Message may optionally include an Extended Status TLV to
   provide LSR is configured for conserva-
         tive operation.

      3. The LSR has received a reason Label Withdraw message for the Shutdown. a previously
         received label.

   Note that although this if an LSR is configured for "liberal mode", a
   "non-fatal" event, release mes-
   sage will never be transmitted in the sending LSR terminates case of conditions (1) and (2)
   as specified above.  In this case, the session upstream LSR keeps each unused
   label, so that it can immediately
   after sending be used later if the Notification.

3.4.1.2.5. Initialization Message Events downstream
   peer becomes the next hop for the FEC.

   The session initialization negotiation (see Section "Session Initial-
   ization") may fail if FEC TLV specifies the session parameters received in FEC for which labels are to be released.
   If no Label TLV follows the Initial-
   ization Message FEC, all labels associated with the FEC
   are unacceptable.  This to be released; otherwise only the label specified in the
   optional Label TLV is a fatal error. to be released.

   The
   specific Status Code depends on FEC TLV may contain the parameter deemed unacceptable,
   and are defined in Sections "Initialization Message Notification
   Status Codes".

3.4.1.2.6. Events Resulting From Other Messages

   Messages Wildcard FEC Element; if so, it may con-
   tain no other than FEC Elements.  In this case, if the Initialization message may result in events
   that must Label Release mes-
   sage contains an optional Label TLV, then the label is to be signalled released
   for all FECs to LDP peers via Notification Messages.  These
   events and the Status Codes used which it is bound.  If there is not an optional Label
   TLV in the Notification Label Release message, then the sending LSR is releasing
   all label mappings previously learned from the receiving LSR.

   See Appendx A "LDP Label Distribution Procedures" for more details.

3.6. Messages to sig-
   nal them are described in and TLVs for Extensibility

   Support for LDP extensibility includes the sections rules for the U and F bits
   that describe these messages.

3.4.1.2.7. Explicitly Routed LSP Setup Events

   Establishment of specify how an Explicitly Routed LSP may fail LSR should handle unknown TLVs and messages.

   This section specifies TLVs and messages for a variety of
   reasons.  All such failures are considered non-fatal conditions vendor-private and
   they are signalled by the Explicit Response Message.

3.4.1.2.8. Miscellaneous Events

   These are events that fall into none of the categories above.  There
   are no miscellaneous events defined in this version of the protocol.

3.4.2. Hello Message
   experimental use.

3.6.1. LDP Hello Messages Vendor-private Extensions

   Vendor-private TLVs and messages are exchanged as part of the used to convey vendor-private
   information between LSRs.

3.6.1.1. LDP Discovery Mechan-
   ism; see Section "LDP Discovery". Vendor-private TLVs

   The Type range 0x2F00 through 0x2FFF is reserved for vendor-private
   TLVs.

   The encoding for the Hello Message a vendor-private TLV is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|F|    Type (0x2F00-0x2FFF)   |     Hello (0x0100)            |      Message            Length             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message                           Vendor ID                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message.

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a TLV.  The optional parameters defined by this version
   |                           Data....                            |
   ~                                                               ~
   |                                                               |
   |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   U bit
     Unknown TLV bit.  Upon receipt of the protocol are
         Optional Parameter    Type     Length  Value

         Targeted Hello        0x0400     0      --
         Send Targeted Hello   0x0401     0      --
         Transport Address     0x0402     4      See below
         Hello Hold Time       0x0403     4      See below

     Targeted Hello
       This Hello is a Targeted Hello.  Without this optional parameter
       the Hello an unknown TLV, if U is clear
     (=0), a Link Hello.

     Send Targeted Hello
       Requests the receiver to send periodic Targeted Hellos notification must be returned to the
       source of this Hello.  An LSR initiating Extended Discovery uses
       this option.

     Transport Address
       Specifies message originator and
     the IPv4 address to entire message must be used for the sending LSR when
       opening ignored; if U is set (=1), the LDP session TCP connection.  If this optional unknown
     TLV is
       not present silently ignored and the IPv4 source address for rest of the UDP packet carrying message is processed as
     if the Hello should be used.

     Hello Hold Time
       An LSR maintains unknown TLV did not exist.

     The determination as to whether a record of Hellos received from potential peers
       (see below) When present, this parameter specifies vendor-private message is under-
     stood is based on the time in
       seconds Type and the sending LSR will maintain its record of Hellos from mandatory Vendor ID field.

   F bit
     Forward unknown TLV bit.  This bit only applies when the receiving LSR without receipt of another Hello.  When U bit is
     set and the LDP message containing the unknown TLF is is to be for-
     warded.  If F is clear (=0), the unknown TLV is not
       present, forwarded with
     the sender will use a default hold time.  There are
       interface type specific defaults for Link Hellos as well a
       default for Targeted Hellos.

3.4.2.1. Hello Message Procedures

   An LSR receiving Hellos from another LSR maintains a Hello adjacency
   for containing message; if F is set (=1), the Hellos.  The LSR maintains a hold timer unknown TLV is for-
     warded with the Hello adja-
   cency which it restarts whenever it receives a Hello that matches containing message.

   Type
     Type value in the
   Hello adjacency.  If range 0x2F00 through 0x2FFF.  Together, the hold timer for a Hello adjacency expires Type
     and Vendor Id field specify how the
   LSR discards Data field is to be inter-
     preted.

   Length
     Specifies the Hello adjacency: see sections "Maintaining Hello
   Adjacencies" cumulative length in octets of the Vendor ID and "Maintaining LDP Sessions".

   A LSR processes a received LDP Hello Data
     fields.

   Vendor Id
     802 Vendor ID as follows:

      1. assigned by the IEEE.

   Data
     The LSR checks whether remaining octets after the Hello is acceptable. Vendor ID in the Value field are
     optional vendor-dependent data.

3.6.1.2. LDP Vendor-private Messages

   The criteria Message Type range 0x2F00 through 0x2FFF is reserved for determining whether vendor-
   private Messages.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |U|    Msg Type (0x2F00-0x2FFF) |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Vendor ID                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   +                                                               +
   |                     Remaining Mandatory Parameters            |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   +                                                               +
   |                     Optional Parameters                       |
   +                                                               +
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   U bit
     Unknown message bit.  Upon receipt of an unknown message, if U is
     clear (=0), a Hello notification is acceptable are implementa-
         tion dependent (see below for example criteria).

      2. If returned to the Hello message originator;
     if U is not acceptable, the LSR ignores it.

      3. If set (=1), the Hello unknown message is acceptable, the LSR checks silently ignored.

     The determination as to whether it has a
         Hello adjacency for the Hello source. If so, it restarts the
         hold timer for the Hello adjacency.  If not it creates a Hello
         adjacency for the Hello source and starts its hold timer.

      4. If the Hello carries any optional TLVs vendor-private message is under-
     stood is based on the LSR processes them
         (see below).

      5. Finally, if Msg Type and the LSR has no LDP session for Vendor ID parameter.

   Msg Type
     Message type value in the label space
         specified by range 0x2F00 through 0x2FFF.  Together,
     the LDP identifier in Msg Type and the common header for Vendor ID specify how the
         Hello, it attempts message is to establish a session for be
     interpreted.

   Message Length
     Specifies the label space;
         see section "LDP Session Establishment".

   The following are examples cumulative length in octets of acceptability criteria for Link and
   Targeted Hellos:

       A Link Hello is acceptable if the interface on which it was
       received has been configured for label switching.

       A Targeted Hello from IP source address a.b.c.d is acceptable if
       either:

           - The LSR has been configured to accept Targeted Hellos, or

           - The LSR has been configured to send Targeted Hellos Message ID, Vendor
     ID, Remaining Mandatory Parameters and Optional Parameters.

   Message ID
     32-bit integer used to
             a.b.c.d.

       The following describes how an LSR processes Hello optional TLVs:

           Targeted Hello
             No special processing required.

           Send Targeted Hello
             If the Send Targeted Hello option is carried identify this message.  Used by the Hello,
             the sending
     LSR checks whether it has been configured to send Tar-
             geted Hellos facilitate identifying notification messages that may apply
     to the Hello source this message.  An LSR sending a notification message in response
     to Hellos with this option.  If not, it ignores message will include this Message Id in the option.  If so, it
             initiates periodic transmission notification
     message; see Section "Notification Message".

   Vendor ID
     802 Vendor ID as assigned by the IEEE.

   Remaining Mandatory Parameters
     Variable length set of remaining required message parameters.

   Optional Parameters
     Variable length set of Targeted Hellos optional message parameters.

3.6.2. LDP Experimental Extensions

   LDP support for experimentation is similar to support for vendor-
   private extensions with the
             Hello source.

           Transport Address following differences:

     - The LSR associates Type range 0x3F00 through 0x3FFF is reserved for experimental
       TLVs.

     - The Message Type range 0x3F00 through 0x3FFF is reserved for
       experimental messages.

     - The encodings for experimental TLVs and messages are similar to
       the specified transport address vendor-private encodings with the
             Hello adjacency.

           Hello Hold Time
             A pair of LSRs negotiate the hold times they following difference.

       Experimental TLVs and messages use for Hellos
             from each other.  Each LSR proposes a hold time an Experiment ID field in its Hel-
             los either explicitly by including the Hold Time optional
             TLV or implicitly by omitting it.
       place of a Vendor ID field.  The hold time Experiment ID field is used by with
       the LSRs is Type or Message Type field to specify the minimum interpretation of
       the hold times proposed in their
             Hellos.

       We recommend that experimental TLV or Message.

       Administration of Experiment IDs is the interval between Hello transmissions be at
       most one third responsiblity of the Hello hold time.

3.4.3. Initialization
       experimenters.

3.7. Message Summary

   The LDP Initialization Message is exchanged as part of following are the LDP ses-
   sion establishment procedure; see Section "LDP Session Establish-
   ment".

   The encoding for messages defined in this version of the Initialization
   protocol.

       Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Name            Type     Section Title

       Notification            0x0001   "Notification Message"
       Hello                   0x0100   "Hello Message"
       Initialization (0x0200)    |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          0x0200   "Initialization Message"
       KeepAlive               0x0201   "KeepAlive Message"
       Address                 0x0300   "Address Message"
       Address Withdraw        0x0301   "Address Withdraw Message"
       Label Mapping           0x0400   "Label Mapping Message"
       Label Request           0x0401   "Label Request Message"
       Label Withdraw          0x0402   "Label Withdraw Message"
       Label Release           0x0403   "Label Release Message"
       Vendor-Private          0x2F00-0x2FFF
       Experimental            0x3F00-0x3FFF

3.8. TLV Summary

   The following are the TLVs defined in this version of the protocol.

       TLV                      Type      Section Title

       FEC                      0x0100    "FEC TLV"
       Address List             0x0101    "Address List TLV"
       COS                      0x0102    "COS TLV"
       Hop Count                0x0103    "Hop Count TLV"
       Path Vector              0x0104    "Path Vector TLV"
       Generic Label            0x0200    "Generic Label TLV"
       ATM Label                0x0201    "ATM Label TLV"
       Frame Relay Label        0x0202    "Frame Relay Label TLV"
       Status                   0x0300    "Status TLV"
       Extended Status          0x0301    "Notification Message"
       Returned PDU             0x0302    "Notification Message"
       Returned Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         0x0303    "Notification Message"
       Common Session Parameters TLV             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Hello             0x0400    "Hello Message"
          Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message.
       Transport Address        0x0401    "Hello Message"
       Configuration            0x0402    "Hello Message"
          Sequence Number
       Common Session           0x0500    "Initialization Message"
          Parameters TLV
     Specifies values proposed by the sending LSR for parameters common
     to all LDP sessions.

     The encoding for the Basic
       ATM Session Parameters TLV is:

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       | Common Sess Params (0x0500)  |      Message Length            |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       | Protocol Version              |      Hold Time                |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                 Receiver LDP Identifer                        |
       +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Protocol Version
         Two octet unsigned integer containing   0x0501    "Initialization Message"
       Frame Relay Session      0x0502    "Initialization Message"
          Parameters
       Vendor-Private           0x2F00-0x2FFF
       Experimental             0x3F00-0x3FFF

3.9. Status Code Summary

   The following are the Status Codes defined in this version number of the
   protocol.  This version of the specification specifies

       Status Code               Type          Section Title

       Success                   0x00000000    "Status TLV"
       Bad LDP pro-
         tocol version 1.

       Hold Time
         Two octet unsigned non zero integer that indicates the number
         of seconds that the sending LSR proposes for the value of the
         KeepAlive Interval.  The receiving LSR MUST calculate the value
         of the KeepAlive Timer Identifer         0x80000001    "Events Signaled by using the smaller of its proposed
         Hold Time and the Hold Time received in the PDU.  The value
         chosen for Hold Time indicates the maximum number of seconds
         that may elapse between the receipt of successive PDUs from the
         LSR peer.  The Keepalive Timer is reset each time a ..."
       Bad Protocol Version      0x80000002    "Events Signaled by ..."
       Bad PDU
         arrives.

       Receiver LDP Identifer
         Identifies the receiver's label space.  This LDP Identifier,
         together with the sender's LDP Identifier in the common header
         enables the receiver to match the Initialization message with
         one of its Hello adjacencies; see Section "Hello Length            0x80000003    "Events Signaled by ..."
       Unknown Message Pro-
         cedures".

   Optional Parameters
     This variable length field contains 0 or more parameters, each
     encoded as a TLV.  The optional parameters are:

         Optional Parameter Type      0x80000004    "Events Signaled by ..."
       Bad Message Length        0x80000005    "Events Signaled by ..."
       Unknown TLV               0x80000006    "Events Signaled by ..."
       Bad TLV length            0x80000007    "Events Signaled by ..."
       Malformed TLV Value

         Label Allocation         0x0501     1     See below
            Discipline       0x80000008    "Events Signaled by ..."
       Hold Timer Expired        0x80000009    "Events Signaled by ..."
       Shutdown                  0x8000000A    "Events Signaled by ..."
       Loop Detection           0x0502     0      --
         Merge                    0x0503     1     See below
         ATM Null Encapsulation   0x0504     0      --
         ATM Label Range          0x0600     8     See below
         Frame Relay Detected             0x0000000B    "Loop Detection"
       Unknown FEC               0x0000000C    "FEC Procedures"
       No Route                  0x0000000D    "Label Request Mess ..."
       No Label Range  0x0601     8     See below Resources        0x0000000E    "Label Request Mess ..."
       Label Allocation Discipline
         Indicates the type of Resources Available 0x0000000F    "Label Request Mess ..."
       Session Rejected/         0x80000010    "Session Initialization"
          No Hello
       Session Rejected/         0x80000011    "Session Initialization"
          Parameters Advertisement Mode
       Session Rejected/         0x80000012    "Session Initialization"
          Parameters Max PDU Length
       Session Rejected/         0x80000013    "Session Initialization"
          Parameters Label allocation.    A value of 0 Range

3.10. UDP and TCP Ports

   The UDP port for LDP Hello messages is
         Downstream allocation, A value of 1 646.

   The TCP port for establishing LDP session connections is Downstream On Demand.
         If this 646.

4. Security

   This section specifies an optional parameter is not specfied, Downstream alloca-
         tion is used.

       Loop Detection
         If present, indicates that Loop Detection is enabled.  If
         absent, Loop Detection is disabled.

       Merge
         Specifies mechanism to protect against the merge capabilities
   introduction of an ATM or Frame Relay
         switch.  The following values are supported spoofed TCP segments into LDP session connection
   streams.

   It is based on use of the TCP MD5 Signature Option specified in this version
   [rfc2385] for use by BGP.  See [rfc1321] for a specification of the specification:

                   Value          Meaning

                     0            Merge not supported

                   For ATM Merge:
                     1            VP Merge supported
                     2            VC Merge supported
                     3            VP & VC Merge supported

                   For Frame Relay Merge:
                     Non-zero     Merge supported

       ATM Null Encapsulation
         If present, specifies that
   MD5 hash function.

4.1. The TCP MD5 Signature Option

   The following quotes from [rfc2385] outline the LSR supports security properties
   achieved by using the null
         encapsulation of [rfc1483] TCP MD5 Signature Option and summarizes its
   operation:

      "IESG Note

         This document describes currrent existing practice for securing
         BGP against certain simple attacks.  It is understood to have
         security weaknesses against concerted attacks."

      "Abstract

         This memo describes a TCP extension to enhance security for
         BGP.  It defines a new TCP option for carrying an MD5 [RFC1321]
         digest in a TCP segment.  This digest acts like a signature for
         that segment, incorporating information known only to the con-
         nection end points.  Since BGP uses TCP as its data VCs transport, using
         this option in the way described in this paper significantly
         reduces the danger from certain security attacks on BGP."

      "Introduction

         The primary motivation for this option is to allow BGP to pro-
         tect itself against the ATM link
         managed by introduction of spoofed TCP segments
         into the LDP session.  In this case IP packets connection stream.  Of particular concern are
         carried directly inside AAL5 frames.  If absent, TCP
         resets.

         To spoof a connection using the null
         encapsulation is not supported.

       ATM Label Range
         Used when an LDP session manages label exchange for scheme described in this paper,
         an ATM link.
         The ATM Label Range TLV contains the label range supported by attacker would not only have to guess TCP sequence numbers,
         but would also have had to obtain the
         transmitting LSR.  A receiving LSR MUST calculate password included in the intersection
         between
         MD5 digest.  This password never appears in the received range connection
         stream, and its own supported label range.  The
         intersection the actual form of the password is up to the range in which appli-
         cation.  It could even change during the LSR may allocate and accept
         labels.  LSRs may NOT establish an adjacency lifetime of a particu-
         lar connection so long as this change was synchronized on both
         ends (although retransmission can become problematical in some
         TCP implementations with neighbors whose
         intersection range changing passwords).

         Finally, there is NULL.

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |  Res  |    Minimum VPI        |        Minimum VCI            |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |  Res  |    Maximum VPI        |        Maximum VCI            |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

         Res
           This field no negotiation for the use of this option in
         a connection, rather it is reserved. It must purely a matter of site policy
         whether or not its connections use the option."

      "MD5 as a Hashing Algorithm

         Since this memo was first issued (under a different title), the
         MD5 algorithm has been found to be set vulnerable to zero on transmis-
           sion collision
         search attacks [Dobb], and must is considered by some to be ignored on receipt.

         Minimum VPI (12 bits) insuffi-
         ciently strong for this type of application.

         This 12 bit field memo still specifies the lower bound MD5 algorithm, however, since the
         option has already been deployed operationally, and there was
         no "algorithm type" field defined to allow an upgrade using the
         same option number.  The original document did not specify a
         type field since this would require at least one more byte, and
         it was felt at the time that taking 19 bytes for the complete
         option (which would probably be padded to 20 bytes in TCP
         implementations) would be too much of a block waste of
           Virtual Path Identifiers that is supported on the originating
           switch.  If already
         limited option space.

         This does not prevent the VPI is less than 12-bits deployment of another similar option
         which uses another hashing algorithm (like SHA-1).  Also, if
         most implementations pad the 18 byte option as defined to 20
         bytes anyway, it should be right
           justified in this field and preceding bits should would be set just as well to
           0.

         Minimum VCI (16 bits) define a new option
         which contains an algorithm type field.

         This 16 bit field specifies would need to be addressed in another document, however."

   End of quotes from [rfc2385].

4.2. LDP Use of the lower bound TCP MD5 Signature Option

   LDP uses the TCP MD5 Signature Option as follows:

     - Use of the MD5 Signature Option for LDP TCP connections is a block of
           Virtual Connection Identifiers con-
       figurable LSR option.

     - An LSR that is supported on the ori-
           ginating switch.  If uses the VCI MD5 Signature Option is less than 16-bits it should
           be right justified configured with a
       password for each potential LDP peer.

     - The LSR applies the MD5 algorithm as specified in this field and preceding bits should [RFC2385] to
       compute the MD5 digest for a TCP segment to be
           set sent to 0.

         Maximum VPI (12 bits) a peer.
       This 12 bit field specifies the upper bound computation makes use of the peer password as well as the
       TCP segment.

     - When the LSR receives a block TCP segment with an MD5 digest, it vali-
       dates the segment by calculating the MD5 digest (using its own
       record of
           Virtual Path Identifiers that is supported on the originating
           switch. password) and compares the computed digest with the
       received digest.  If the VPI comparison fails, the segment is less than 12-bits it should be right
           justified in this field and preceding bits should be set dropped
       without any response to
           0.

         Maximum VCI (16 bits)
           This 16 bit field specifies the upper bound of sender.

     - The LSR ignores LDP Hellos from any LSR for which a block of
           Virtual Connection Identifiers password has
       not been configured.  This ensures that is supported on the ori-
           ginating switch.  If LSR establishes LDP
       TCP connections only with LSRs for which a password has been con-
       figured.

5. Intellectual Property Considerations

   The IETF has been notified of intellectual property rights claimed in
   regard to some or all of the VCI is less than 16-bits it should
           be right justified specification contained in this field docu-
   ment.  For more information consult the online list of claimed
   rights.

6. Acknowledgments

   The ideas and preceding bits should be
           set text in this document have been collected from a number
   of sources. We would like to 0.

       Frame Relay thank Rick Boivie, Ross Callon, Alex
   Conta, Eric Gray, Yoshihiro Ohba, Eric Rosen, Bernard Suter, Yakov
   Rekhter, and Arun Viswanathan.

7. References

   [ARCH] E. Rosen, A. Viswanathan, R. Callon, "Multiprotocol Label
   Switching Architecture", draft-ietf-mpls-arch-02.txt, July 1998

   [ATM] B. Davie, J. Lawrence, K. McCloghrie, Y. Rekhter, E. Rosen, G.
   Swallow, P. Doolan, "Use of Label Switching With ATM", draft-ietf-
   mpls-atm-00.txt, September, 1998

   [DIFFSERV] S. Blake, D. Black, M. Carlson, E. Davies, Z. Wang, W.
   Weiss, "An Architecture for Differentiated Services", draft-ietf-
   diffserv-arch-02.txt, October, 1998

   [ENCAP] E. Rosen, Y. Rekhter, D. Tappan, D. Farinacci, G. Fedorkow,
   T. Li, A. Conta, "MPLS Label Stack Encoding" draft-ietf-mpls-label-
   encaps-02.txt, July, 1998

   [FR] A. Conta, P. Doolan, A. Malis, "Use of Label Range
         Used when an LDP session manages label exchange for a Frame
         Relay link.  The Switching on Frame
   Relay Networks" draft-ietf-mpls-fr-02.txt, October, 1998
   [FRAMEWORK] R. Callon, P. Doolan, N. Feldman, A. Fredette, G. Swal-
   low, A. Viswanathan, "A Framework for Multiprotocol Label Range TLV contains the label
         range supported by the transmitting LSR.  A receiving LSR MUST
         calculate the intersection between the received range and its
         own supported label range.  The intersection is the range in
         which the LSR may allocate and accept labels.  LSRs may NOT
         establish an adjacency with neighbors whose intersection range
         is NULL.

          0                   1                   2                   3
          0 1 2 3 4 5 6 7 8 9 0 1 2 3 Switching"
   draft-ietf-mpls-framework-02.txt, November 1997

   [rfc1321] Rivest, R., "The MD5 Message-Digest Algorithm," RFC 1321,
   April 1992.

   [rfc1483] J. Heinanen, "Multiprotocol Encapsulation over ATM Adapta-
   tion Layer 5", RFC 1483, Telecom Finland, July 1993

   [rfc1583] J. Moy, "OSPF Version 2", RFC 1583, Proteon Inc, March 1994

   [rfc1700] J. Reynolds, J.Postel, "ASSIGNED NUMBERS", October 1994.

   [rfc1771] Y. Rekhter, T. Li, "A Border Gateway Protocol 4 5 6 7 (BGP-4)",
   RFC 1771, IBM Corp, Cisco Systems, March 1995

   [rfc2385] Heffernan, A., "Protection of BGP Sessions via the TCP MD5
   Signature Option", RFC 2385, August 1998.

8. Author Information

   Loa Andersson
   Nortel Networks Inc
   Kungsgatan 34, PO Box 1788
   111 97 Stockholm
   Sweden
   Phone: +46 8 9 0 1 2 441 78 34,  Mobile: +46 70 522 78 34
   email: loa_andersson@baynetworks.com

   Paul Doolan
   Ennovate Networks
   330 Codman Hill Rd
   Marlborough MA 01719
   Phone: 978-263-2002
   email: pdoolan@ennovatenetworks.com

   Nancy Feldman
   IBM Corp.
   17 Skyline Drive
   Hawthorne NY 10532
   Phone:  914-784-3254
   email: nkf@us.ibm.com

   Andre Fredette
   Nortel Networks Inc
   3 4 5 6 7 8 9 0 1
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         | Reserved        |Len|                 Minimum DLCI            |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         | Reserved        |                     Maximum DLCI            |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

         Len Federal Street
   Billerica, MA  01821
   Phone:  978-916-8524
   email: fredette@baynetworks.com

   Bob Thomas
   Cisco Systems, Inc.
   250 Apollo Dr.
   Chelmsford, MA 01824
   Phone:  978-244-8078
   email: rhthomas@cisco.com

Appendix A. LDP Label Distribution Procedures

   This field section specifies the number of bits label distribution behavior in terms of the DLCI.  The
           following values are supported:

                Len    DLCI bits

                0       10
                1       17
                2       23

3.4.3.1. Initialization Message Procedures

   See Section "LDP Session Establishment" and particularly Section
   "Session Initialization" for general procedures for handling the Ini-
   tialization Message.

3.4.4. KeepAlive Message

   An LSR sends KeepAlive Messages as part of a mechanism that monitors
   the integrity of the LDP session transport connection.

   The encoding for
   response to the KeepAlive Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |     KeepAlive (0x0201)        |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | following events:

     - Receive Label Request Message;
     - Receive Label Mapping Message;
     - Receive Label Release Message;
     - Receive Label Withdraw Message;
     - Recognize new FEC;
     - Detect change in FEC next hop;
     - Receive Notification Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / No Label Resources;
     - Receive Notification Message Id
     Four octet integer used to identify this message.

   Optional Parameters / No optional parameters are defined for the KeepAlive message.

3.4.4.1. KeepAlive Route;
     - Receive Notification Message Procedures

   The Hold Timer mechanism described in Section "Maintaining LDP Ses-
   sions" resets a seesion hold timer every time an LDP PDU is received.
   The KeepAlive / Loop Detected;
     - Receive Notification Message is provided / Label Resources Available;
     - Detect local label resources have become available;
     - LSR decides to allow reset no longer label switch a FEC;
     - Timeout of deferred label request.

   The specification of the Hold Timer in
   circumstances where an LSR has no other information to communicate behavior in response to an LDP peer.

   An LSR must arrange event has three
   parts:

      1. Summary. Prose that its peer sees an LDP Message from it at
   least every Hold Time period. That message may be any other from describes LSR response to the
   protocol or, event in circumstances where there is no need
         overview.

      2. Context. A list of elements referred to send one by the Algorithm part
         of
   them, it must be KeepAlive Message.

3.4.5. Address Message the specification.  (See 3.)

      3. Algorithm. An algorithm for LSR sends the Address Message to an LDP peer response to advertise its
   interface addresses.

   The encoding for the Address Message is:

    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 (0x0300)          |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   |                     Address List TLV                          |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message.

   Address List TLV event.

   The list Summary may omit details of interface addresses being advertised by the sending
     LSR.  The encoding for LSR response, such as bookkeeping
   action or behavior dependent on the Address List TLV is specified LSR label advertisement mode,
   control mode, or label retention mode in Section
     "Address List TLV".

   Optional Parameters
     No optional parameters are defined for use. The intent is that the
   Algorithm fully and unambiguously specify the Address message.

3.4.5.1. Address Message Procedures

   An LSR that receives an Address Message message uses response.

   The algorithms in this section use procedures defined in the addresses it
   learns MPLS
   architecture specification [ARCH] for hop-by-hop routed traffic.
   These procedures are:

     - Label Distribution procedure, which is performed by a downstream
       LSR to maintain determine when to distribute a database label for mapping between peer LDP Identif-
   iers and next hop addresses; see section "LDP Identifiers and Next
   Hop Addresses".

   When a new FEC to LDP session is initialized and before sending
       peers. The architecture defines four Label Map-
   ping or Distribution pro-
       cedures:

         . Downstream Unsolicited Independent Control, called PushUncon-
           ditional in [ARCH].

         . Downstream Unsolicited Ordered Control, called PushCondi-
           tional in [ARCH].

         . Downstream On Demand Independent Control, called PulledUncon-
           ditional in [ARCH].

         . Downstream On Demand Ordered Control, called PulledCondi-
           tional in [ARCH].

     - Label Request messages and LSR should advertise its interface
   addresses with one or more Address messages.

   Whenever an LSR "activates" a new interface address, it should adver-
   tise the new address with an Address message.

   Whenever an LSR "de-activates" Withdrawal procedure, which is performed by a previously advertised address, it
   should withdraw the address with an Address Withdraw message; see
   Section "Address Withdraw Message".

3.4.6. Address Withdraw Message

   An downstream
       LSR sends the Address Message to an LDP peer determine when to withdraw previ-
   ously advertised interface addresses.

   The encoding for the Address Withdraw Message is:

    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 Withdraw (0x0301) |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   |                     Address List TLV                          |
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used withdraw a FEC label mapping previously
       distributed to identify this message.

   Address list TLV LDP peers. The list of interface addresses being withdrawn by architecture defines a single Label
       Withdrawal procedure. Whenever an LSR breaks the sending LSR.
     The encoding for binding between
       a label and a FEC, it must withdraw the Address list TLV is specified in Section
     "Address List TLV".

   Optional Parameters
     No optional parameters are defined for FEC label mapping from
       all LDP peers to which it has previously sent the Address Withdraw mes-
     sage.

3.4.6.1. Address Withdraw Message Procedures

   See Section "Address Message Procedures"

3.4.7. mapping.

     - Label Mapping Message

   An Request procedure, which is performed by an upstream LSR sends a Label Mapping message to an LDP peer
       determine when to advertise
   FEC-label bindings explicitly request that a downstrem LSR bind a
       label to a FEC and send it the peer. corresponding label mapping. The encoding for the Label Mapping Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |
       architecture defines three Label Mapping (0x0400)    |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Label Mapping TLV 1                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Label Mapping TLV n                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer Request procedures:

         . Request Never. The LSR never requests a label.

         . Request When Needed. The LSR requests a label whenever it
           needs one.

         . Request On Request. This procedure is used to identify this message.

   FEC-Label Mapping TLV
     Each specifies by non-label merg-
           ing LSRs. The LSR requests a binding between an FEC and label when it receives a label.  A FEC-Label
     Mapping TLV request
           for one, in addition to whenever it needs one.

     - Label Release procedure, which is performed by an upstream LSR to
       determine when to release a nested TLV that contains a FEC TLV, previously received label mapping for
       a FEC. The architecture defines two Label TLV,
     an optional COS TLF, an optional Hop Count TLV, and Release procedures:

         . Conservative label retention, called Release On Change in
           [ARCH].

         . Liberal label retention, called No Release On Change in
           [ARCH].

     - Label Use procedure, which is performed by an optional
     Path Vector TLV:

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   FEC-label Mapping (0x0700)  |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | LSR to determine
       when to start using a FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | label for forwarding/switching. The
       architecture defines three Label TLV                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     COS TLV (optional)                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Hop Count TLV (optional)                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Path Vector TLV (optional)                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Use procedures:

         . Use Immediate. The encodings LSR immediately uses a label received from
           a FEC next hop for the FEC, Label, COS, Hop Count, and Path Vector
   TLVs can be found in Section "Commonly Used TLVs".

   NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

     Need to add multipath possibility to above by allowing multiple forwarding/switching.

         . Use If Loop Free. The LSR uses a FEC label TLVs to received from a
           FEC next hop for forwarding/switching only if it has deter-
           mined that by doing so it will not cause a forwarding loop.

         . Use If Loop Not Detected. This procedure is the same as Use
           Immediate unless the FEC-label Mapping TLV.  This LSR has detected a loop in the FEC LSP.
           Use of the FEC label for forwarding/switching will be done with continue
           until the addition:

              Label TLV2 (optional)
              ...
              Label TLVn (optional)

     with discussion.

   END NOTE * END NOTE * END NOTE:

   Optional Parameters
     No optional parameters are defined next hop for the FEC changes or the loop is no
           longer detected.

       This version of LDP does not include a loop prevention mechanism;
       therefore, the procedures below do not make use of the Use If
       Loop Free procedure.

     - Label Mapping message.

3.4.7.1. No Route procedure (called Label Mapping Message Procedures

   The Mapping message Not Available procedure in
       [ARCH]), which is used performed by an upstream LSR to distribute determine how
       to respond to a label mapping
   for No Route notification from a FEC to its LDP peers.  If an downstream LSR distributes in
       response to a mapping request for a FEC to multiple LDP peers, it is label mapping.  The architecture
       specification defines two Label No Route procedures:

         . Request Retry. The LSR should issue the label request at a local matter whether
           later time.

         . No Request Retry. The LSR should assume the downstream LSR
           will provide a label mapping when the downstream LSR has a
           next hop and it maps should not reissue the request.

A.1. Handling Label Distribution Events

   The algorithms for handling label distribution events share common
   actions.  The specifications below package these common actions into
   procedure units.  Specifications for these common procedures are in
   their own section "Common Label Distribution Procedures", which fol-
   lows this.

   An implementation would use data structures to store information
   about protocol activity.  This appendix specifies the information to
   be stored in sufficient detail to describe the algorithms, and
   assumes the ability to retrieve the information as needed.  It does
   not specify the details of the data structures.

A.1.1. Receive Label Request

 Summary:

     The response by an LSR to receipt of a
   single FEC label to the FEC, and distributes that mapping to all its
   peers, request from an
     LDP peer may involve one or whether it uses a different mapping for each more of its peers.

   An LSR is always responsible for the consistency following actions:

     - Transmission of a notification message to the label map-
   pings it has distributed, and that its peers have these mappings.

3.4.7.1.1. Independent Control Mapping

   If an requesting LSR is configured
       indicating why a label mapping for independent control, the FEC cannot be provided;

     - Transmission of a FEC label mapping message is
   transmitted by an LSR to peers upon any of the following conditions:

      1. The LSR recognizes requesting LSR;

     - Transmission of a new FEC via label request to the forwarding table, and FEC next hop;

     - Installation of labels for forwarding/switching use by the
         label advertisement mode is Downstream allocation.

      2. LSR.

 Context:

     - LSR. The LSR receives a Request message from an upstream handling the event.

     - MsgSource. The LDP peer for an that sent the message.

     - FEC. The FEC present specified in the LSR's forwarding table.

      3. message.

     - RAttributes. Attributes received with the message. E.g., CoS, Hop
       Count Path Vector.

     - SAttributes. Attributes to be included in Label Request message,
       if any, propagated to FEC Next Hop.

     - StoredHopCount. The next hop count, if any, previously recorded for an FEC changes to another LDP peer, and loop
         detection is configured.

      4. The attributes of
       the FEC.

 Algorithm:

   LRq.1   Execute procedure Check_Received_Attributes (MsgSource, RAt-
           tributes).
           If Loop Detected, goto LRq.11.

   LRq.2   Is there a mapping change.

      5. The receipt of Next Hop for FEC?
           If so, goto LRq.4.

   LRq.3   Execute procedure Send_Notification (MsgSource, No Route).
           Goto LRq.11.

   LRq.4   Has LSR previously received a mapping label request for FEC from
           MsgSource?
           If not, goto LRq.6.  (See Note 1.)
   LRq.5   Is the downstream next hop  AND
            a) no upstream mapping has been created  OR
            b) loop detection is configured  OR
            c) the attributes of the mapping have changed.

3.4.7.1.2. Ordered Control Mapping label request a duplicate request?
           If an so, Goto LRq.11.  (See Note 2.)

   LRq.6   Record label request for FEC received from MsgSource and mark
           it pending.

   LRq.7   Perform LSR is doing ordered control, a Mapping message is transmitted
   by downstream LSRs upon any of the following conditions: Label Distribution procedure:

             For Downstream Unsolicited Independent Control OR
             For Downstream On Demand Independent Control

               1. The  Has LSR recognizes previously received and retained a new label map-
                   ping for FEC via the forwarding table, and is
         the from Next Hop?.
                   Is so, set Propagating to IsPropagating.
                   If not, set Propagating to NotPropagating.

               2.  Execute procedure
                   Prepare_Label_Mapping_Attributes(MsgSource, FEC, RAt-
                   tributes, SAttributes, Propagating, StoredHopCount).

               3.  Execute procedure Send_Label (MsgSource, FEC, SAttri-
                   butes).

               4.  Is LSR egress for that FEC.

      2. The FEC? OR
                   Has LSR receives previously received and retained a Request message from an upstream peer label map-
                   ping for an FEC present in the LSR's forwarding table, and the from Next Hop?
                   If so, goto LRq.9.  If not, goto LRq.8.

             For Downstream Unsolicited Ordered Control OR
             For Downstream On Demand Ordered Control

               1.  Is LSR is the egress for that FEC FEC? OR has
                   Has LSR previously received and retained a downstream mapping label map-
                   ping for that FEC. FEC from Next Hop?
                   If not, goto LRq.8.

               2.  Execute procedure
                   Prepare_Label_Mapping_Attributes(MsgSource, FEC, RAt-
                   tributes, SAttributes, IsPropagating, StoredHopCount)

               3. The next hop  Execute procedure Send_Label (MsgSource, FEC, SAttri-
                   butes).
                   Goto LRq.9.

   LRq.8   Perform LSR Label Request procedure:

             For Request Never
               1.  Goto LRq.11.

             For Request When Needed OR
             For Request On Request

               1.  Execute procedure Prepare_Label_Request_Attributes
                   (Next Hop, FEC, RAttributes, SAttributes);

               2.  Execute procedure Send_Label_Request (Next Hop, FEC,
                   SAttributes).
                   Goto LRq.11.

   LRq.9   Has LSR successfully sent a label for an FEC changes to another LDP peer, MsgSource?
           If not, goto LRq.11.  (See Note 3.)

   LRq.10  Perform LSR Label Use procedure.

             For Use Immediate OR
             For Use If Loop Not Detected

               1.  Install label sent to MsgSource and loop
         detection is configured.

      4. The attributes of a mapping change.

      5. The receipt of a mapping label from the downstream next hop  AND
            a) no upstream mapping has been created   OR
            b) loop detection is configured   OR
            c) the attributes of the mapping have changed.

3.4.7.1.3. Downstream-on-Demand Label Advertisement Next
                   Hop (if LSR is not egress) for forwarding/switching
                   use.

   LRq.11  DONE

 Notes:

      1. In general, the upstream LSR case where MsgSource is responsible a non-label merging LSR it will
         send a label request for requesting each upstream LDP peer that has
         requested a label map-
   pings when operating in Downstream-on-Demand mode.  However, unless
   some rules are followed, it is possible for neighboring LSRs with
   different advertisement modes FEC from it. The LSR must be able to get into dis-
         tinguish such requests from a livelock situation where
   everything is functioning properly, but no labels are distributed.
   For example, consider two LSRs Ru and Rd where Ru is the upstream non-label merging MsgSource from
         duplicate label requests.

      2. When an LSR sends a label request to a peer it records that the
         request has been sent and Rd marks it as outstanding. As long as
         the request is marked outstanding the downstream LSR should not send
         another request for the same label to the peer. Such a particular FEC.  In this example,
   Ru is using Downstream allocation mode and Rd is using Downstream-
   on-Demand mode.  In this case, Rd may assume that Ru will second
         request would be a duplicate. The Send_Label_Request procedure
         described below obeys this rule.

         A duplicate label mapping when it wants one request is considered a protocol error and Ru may assume that Rd will adver-
   tise
         should be dropped by the receiving LSR (perhaps with a suitable
         notification returned to MsgSource).

      3. The Send_Label procedure may fail due to lack of label if it wants Ru
         resources, in which case the LSR should not perform the Label
         Use procedure.

A.1.2. Receive Label Mapping

 Summary:

     The response by an LSR to use one.  If Rd and Ru operate as sug-
   gested, no labels will be distributed and packets must be routed at
   layer-3.

   This livelock situation can be avoided if receipt of a FEC label mapping from an
     LDP peer may involve one or more of the following rule is
   observed: an LSR operating in Downstream-on-Demand mode should not be
   expected actions:

     - Transmission of a label release message for the FEC label to send unsolicited the
       LDP peer;

     - Transmission of label mapping advertisements.  Therefore, if messages for the downstream FEC to one or more
       LDP peers,

     - Installation of the newly learned label for forwarding/switching
       use by the LSR.

 Context:

     - LSR. The LSR is operating handling the event.

     - MsgSource. The LDP peer that sent the message.

     - FEC. The FEC specified in Downstream-on-Demand mode, the
   upstream LSR is responsible for requesting message.

     - Label. The label mappings as needed.
   However, if all interfaces on an LSR are configured to operate specified in
   Downstream- on-Demand mode the LSR can wait message.

     - PrevAdvLabel. The label for FEC, if any, previously advertised to issue a request until
   a corresponding request has been sent from
       an upstream LSR.

3.4.7.1.4. Downstream Allocation peer.

     - StoredHopCount. The hop count previously recorded for the FEC.

     - RAttributes. Attributes received with the message. E.g., CoS, Hop
       Count, Path Vector.

     - SAttributes to be included in Label Advertisement

   In general, Mapping message, if any, pro-
       pagated to upstream peers.

 Algorithm:

   LMp.1   Does the downstream LSR is responsible for advertising a received label mapping when it wants match an upstream LSR outstanding label
           request for FEC previously sent to use MsgSource.
           If not, goto LMp.9.

   LMp.2   Delete record of outstanding FEC label request.

   LMp.3   Execute procedure Check_Received_Attributes (MsgSource, RAt-
           tributes).
           If No Loop Detected, goto LMp.9.

   LMp.4   Does the label.  An upstream LSR may issue have a previously received label mapping request if it so desires.

3.4.8. Label Request Message

   An LSR sends for FEC
           from MsgSource?
           If not, goto LMp.8. (See Note 1.).

   LMp.5   Does the label previously received from MsgSource match Label Request Message to an LDP peer to request a
   binding (mapping)
           (i.e., the label received in the message)?
           If not, goto LMp.8. (See Note 2.)

   LMp.6   Delete matching label mapping for one or more specific FECs.

   The encoding FEC previously received
           from MsgSource.

   LMp.7   Remove Label from forwarding/switching use. (See Note 3.).

   LMp.8   Execute procedure Send_Message (MsgSource, Label Release,
           FEC, Label).  Goto LMp.26.

   LMp.9   Determine the Next Hop for FEC.

   LMp.10  Is MsgSource the Next Hop for FEC?
           If so, goto LMp.12.

   LMp.11  Perform LSR Label Request Message is:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Release procedure:

             For Conservative Label Request (0x0401)    |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Request TLV 1                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Request TLV n                         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message.

   FEC-Request TLV
     Each specifies an FEC retention:

               1.  Execute procedure Send_Message (MsgSource, Label
                   Release, FEC, Label).
                   Goto LMp.26.

             For Liberal Label retention:

               1.  Record label mapping for which FEC with Label and RAttri-
                   butes has been received from MsgSource.
                   Goto LMp.26.

   LMp.12  Does LSR have a previously received label mapping is requested.  A
     FEC-Request TLV is a nested TLV that contains a for FEC TLV, an
     optional COS TLV, and
           from MsgSource?
           If not, goto LMp.14

   LMp.13  Does the label previously received from MsgSource match Label
           (i.e., the label received in the message)?
           If not, goto LMp.8.  (See Note 2.)
   LMp.14  Is LSR an optional Hop Count TLV.

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   FEC-Request (0x0701)        |      Length                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     COS TLV (optional)                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Hop Count TLV (optional)                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   The encodings ingress for FEC?
           If not, goto LMp.16.

   LMp.15  Install Label for forwarding/switching use.

   LMp.16  Record label mapping for the FEC, COS, FEC with Label and Hop Count TLVs are specified in
   Section "Commonly Used TLVs".

 Optional Parameters
   No optional parameters are defined RAttributes has
           been received from MsgSource.

   LMp.17  Iterate through for LMp.25 for each Peer, other than
           MsgSource.

   LMp.18  Has LSR previously sent a label mapping for FEC to Peer?
           If not, goto LMp.23.

   LMp.19  Are RAttributes in the received label mapping consistent with
           those previously sent to Peer?
           If so, goto LMp.24.  (See Note 4.)

   LMp.20  Execute procedure Prepare_Label_Mapping_Attributes(Peer, FEC,
           RAttributes, SAttributes, IsPropagating, StoredHopCount).

   LMp.21  Execute procedure Send_Message (Peer, Label Request message.

3.4.8.1. Mapping, FEC,
           PrevAdvLabel, SAttributes).  (See Note 5.)

   LMp.22  Update record of label mapping for FEC previously sent to
           Peer to include the new attributes sent.
           Goto LMp.24.

   LMp.23  Perform LSR Label Request Message Procedures

   The Request message is used by an upstream Distribution procedure:

             For Downstream Unsolicited Independent Control OR
             For Downstream Unsolicited Ordered Control

               1.  Execute procedure
                   Prepare_Label_Mapping_Attributes(Peer, FEC, RAttri-
                   butes, SAttributes, IsPropagating, UnknownHopCount).

               2.  Execute procedure Send_Label (Peer, FEC, SAttri-
                   butes).
                   If the procedure fails, continue iteration for next
                   Peer at LMp.17.

               3.  Goto LMp.24.

             For Downstream On Demand Independent Control OR
             For Downstream On Demand Ordered Control

               1.  Does LSR to explicitly have a label request
   that for FEC from Peer
                   marked as pending?
                   If not, continue iteration for next Peer at LMp.17.

               2.  Execute procedure
                   Prepare_Label_Mapping_Attributes(Peer, FEC, RAttri-
                   butes, SAttributes, IsPropagating, UnknownHopCount)

               3.  Execute procedure Send_Label (Peer, FEC, SAttri-
                   butes).
                   If the downstream procedure fails, continue iteration for next
                   Peer at LMp.17.

               4.  Goto LMp.24.

   LMp.24  Perform LSR assign Label Use procedure:

             For Use Immediate OR
             For Use If Loop Not Detected

               1.  Install label received and advertise a label sent to Peer for an FEC.

   An LSR transmits a Request message under any of the following condi-
   tions:
                   forwarding/switching use.
                   Goto LMp.25.

   LMp.25  End iteration from LMp.17.

   LMp.26  DONE.

 Notes:

      1. The If LSR recognizes has detected a new FEC via the forwarding table, loop and it has not previously received a
         label mapping from MsgSource for the
         next hop FEC, it simply releases
         the label.

      2. A mapping with a different label from the same peer would be an
         attempt to establish multipath label switching, which is not
         supported in this version of LDP.

      3. If Label is not in forwarding/switching use, LMp.7 has no
         effect.

      4. The loop detection Path Vector attribute is an Operational LDP peer, and considered in this
         check.  If the LSR doesn't
         already have received RAttributes include a mapping from the next hop for the given FEC.

      2. The  next hop Path Vector and
         no Path Vector had been previously sent to the FEC changes, and Peer, or if the LSR doesn't already
         have a mapping from that next hop for
         received Path Vector is inconsistent with the given FEC.

   If a request cannot be satisfied by Path Vector pre-
         viously sent to the downstream LSR, Peer, then the request-
   ing attributes are considered to
         be inconsistent.  Note that an LSR may optionally choose is not required to request again at store a later time, or,
   if
         received Path Vector after it propagates the downstream Path Vector in a
         mapping message.  If an LSR is configured for Downstream Allo- cation, does not store the
   requesting LSR may wait for Path Vector, it
         has no way to check the mapping, assuming consistency of a newly received Path
         Vector.  This means that the downstream whenever such an LSR will provide the mapping automatically when receives a map-
         ping message carrying a Path Vector it is available.

   NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

     In must always propagate
         the case where Path Vector.

      5. LMp.19 through LMp.21 deal with a situation that can arise when
         the downstream LSR is doing DoD, how does the
     requesting LSR decide when to make its request?

     TDP addresses this issue by having a "now I have label resources"
     message which using independent control and it sends to downwstream peers whose requests receives a mapping
         from the downstream peer after it has
     denied.  This serves as sent a signal mapping to them an
         upstream peer. In this situation the LSR needs to re-issue their
     requests.  LDP should probably have this.  Without propagate any
         changed attributes, such a signal, as Hop Count, upstream. If Loop Detec-
         tion is configured on, the denied requester has no recourse but to periodically retry.

   END NOTE * END NOTE * END NOTE:

3.4.9. propagated attributes must include
         the Path Vector

A.1.3. Receive Label Withdraw Message

   An Release

 Summary:

     When an LSR sends receives a Label Withdraw Message to an LDP peer to signal the
   peer that label release message for a FEC from a peer,
     it checks whether other peers hold the peer may not continue to use specific FEC-label map-
   pings released label. If none do,
     the LSR had previously advertised.  This breaks the mapping
   between removes the FECs label from forwarding/switching use, if it has
     not already done so, and if the labels.

   The encoding for the Label Withdraw Message is:

    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 Withdraw (0x0402)   |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Withdraw-Release TLV 1                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Withdraw-Release TLV n                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message.

   FEC-Withdraw-Release TLV
     Each TLV specifies a FEC-label mapping being withdrawn.  A FEC-
     Withdraw-Release TLV is a nested TLV that contains LSR holds a FEC TLV and an
     optional label TLV.

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | FEC-Withdraw-Release (0x0702) |      Length                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | mapping from the
     FEC TLV                                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                     Label TLV (optional)                      |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ next hop, it releases the label mapping.

 Context:

     - LSR. The encodings for LSR handling the event.

     - MsgSource. The LDP peer that sent the message.

     - Label. The label specified in the message.

     - FEC. The FEC and Label TLVs are specified in Section
     "Commonly Used TLVs".

     NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

       Need the message.

 Algorithm:

   LRl.1   Remove MsgSource from record of peers that hold Label for
           FEC.  (See Note 1.)

   LRl.2   Does message match an outstanding label withdraw for FEC pre-
           viously sent to add multipath possibility MsgSource?
           If not, goto LRl.4

   LRl.3   Delete record of outstanding label withdraw for FEC previ-
           ously sent to above by allowing multiple MsgSource.

   LRl.4   Is LSR merging labels for this FEC?
           If not, goto LRl.6.  (See Note 2.)
   LRl.5   Has LSR previously advertised a label TLVs for this FEC to other
           peers?
           If so, goto LRl.10.

   LRl.6   Is LSR egress for the FEC-label Mapping TLV.  This will be done with
       the addition: FEC?
           If so, goto LRl.10

   LRl.7   Is there a Next Hop for FEC? AND
           Does LSR have a previously received label mapping for FEC
           from Next Hop?
           If not, goto LRl.10.

   LRl.8   Is LSR configured to propagate releases?
           If so, goto LRl.10.  (See Note 3.)

   LRl.9   Execute procedure Send_Message (Next Hop, Label TLV2 (optional)
                ... Release, FEC,
           Label TLVn (optional) from Next Hop).

   LRl.10  Remove Label from forwarding/switching use for traffic from
           MsgSource.

   LRl.11  Do any peers still hold Label for FEC?
           If so, goto LRl.13.

   LRl.12  Free the Label.

   LRl.13  DONE.

 Notes:

      1. If LSR is using Downstream Unsolicted label distribution, it
         should not re-advertise a label mapping for FEC to MsgSource
         until MsgSource requests it.

      2. LRl.4 through LRl.8 deal with discussion.

     END NOTE * END NOTE * END NOTE:

 Optional Parameters
   No optional parameters are defined determining whether where the LSR
         should propagate the label release to a downstream peer
         (LRl.9).

      3. If LRl.8 is reached, no upstream LSR holds a label for the FEC,
         and the LSR holds a label for the FEC from the FEC Next Hop.
         The LSR could propagate the Label Withdraw message.

3.4.9.1. Release to the Next Hop. By
         propagating the Label Withdraw Message Procedures

   An Release the LSR transmits releases a Withdraw message under potentially
         scarce label resource. In doing so, it also increases the following condition:

      1. The
         latency for re-establishing the LSP should MsgSource or some
         other upstream LSR no longer recognizes send it a previously known new Label Request for FEC.

      2. Optionally, the LSR has unspliced an upstream label from the
         downstream label.

   The FEC in

         Whether or not to propagate the FEC-Withdraw-Release TLV release is not a FEC for which protocol
         issue. Label distribution will operate properly whether or not
         the release is propagated. The decision to propagate or not
         should take into consideration factors such as: whether labels
         are
   to be withdrawn.  If no label TLV follows a scarce resource in the FEC, all labels associ-
   ated with operating environment; the FEC are to be withdrawn, else only impor-
         tance of keeping LSP setup latency low by keeping the labels specified amount of
         signalling required small; whether LSP setup is ingress-
         controlled or egress-controlled in the following Label TLV are to be withdrawn.

3.4.10. operating environment.

A.1.4. Receive Label Release Message

   An Withdraw

 Summary:

     When an LSR sends receives a Label Release label withdraw message to for a FEC from an LDP peer to signal
     peer, it responds with a label release message and it removes the
   peer that
     label from any forwarding/switching use. If ordered control is in
     use, the LSR no longer needs specific FEC-label mappings previ-
   ously requested of and/or advertised by the peer.

   The encoding for the Label Release Message is:

    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 Release (0x0403)   |      Message Length            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Withdraw-Release TLV 1                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-Withdraw-Release TLV n                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Optional Parameters                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used sends a label withdraw message to each LDP peer to identify this message.

   FEC-Withdraw-Release TLVs
     Each TLV specifies
     which it had previously sent a FEC-label label mapping being released.  The encod-
     ing for the FEC-Withdraw-Release TLV FEC. If the
     LSR is using Downstream on Demand label advertisement with indepen-
     dent control, it then acts as if it had just recognized the FEC.

 Context:

     - LSR. The LSR handling the event.

     - MsgSource. The LDP peer that sent the message.

     - Label. The label specified in Section "With-
     draw Message".

     NOTE*NOTE*NOTE*NOTE*NOTE*NOTE:

       Need to add multipath possibility to above by allowing multiple
       label TLVs to the FEC-label Mapping TLV.  This will be done with message.

     - FEC. The FEC specified in the addition: message.

 Algorithm:

   LWd.1   Remove Label TLV2 (optional)
                ... from forwarding/switching use.  (See Note 1.)

   LWd.2   Execute procedure Send_Message (MsgSource, Label TLVn (optional)

       with discussion.

     END NOTE * END NOTE * END NOTE:

   Optional Parameters
     No optional parameters are defined Release,
           FEC, Label)

   LWd.3   Has LSR previously received and retained a matching label
           mapping for FEC from MsgSource?
           If not, goto LWd.13.

   LWd.4   Delete matching label mapping for FEC previously received
           from MsgSource.

   LWd.5   Is LSR using ordered control?
           If so, goto LWd.8.

   LWd.6   Is MsgSource using Downstream On Demand label advertisement?
           If not, goto LWd.13.

   LWd.7   Generate Event: Recognize New FEC for FEC.
           Goto LWd.13.  (See Note 2.)

   LWd.8   Iterate through LWd.12 for each Peer, other than MsgSource.

   LWd.9   Has LSR previously sent a label mapping for FEC to Peer?
           If not, continue interation for next Peer at LWd.8.

   LWd.10  Does the label previously sent to Peer "map" to the withdrawn
           Label?
           If not, continue iteration for next Peer at LWd.8.  (See Note
           3.)

   LWd.11  Execute procedure Send_Label_Withdraw (Peer, FEC, Label Release message.

3.4.10.1. pre-
           viously sent to Peer).

   LWd.12  End iteration from LWd.8.

   LWd.13  DONE

 Notes:

      1. If Label Release Message Procedures

   An is not in forwarding/switching use, LWd.1 has no
         effect.

      2. LWd.7 handles the case where the LSR is using Downstream On
         Demand label distribution with independent control. In this
         situation the LSR should send a label request to the FEC next
         hop as if it had just recognized the FEC.

      3. LWd.10 handles both label merging (one or more incoming labels
         map to the same outgoing label) and no label merging (one label
         maps to the outgoing label) cases.

A.1.5. Recognize New FEC

 Summary:

     The response by an LSR transmits a Release message to learning a peer when it is no longer
   needs a new FEC may involve one or
     more of the following actions:

     - Transmission of label previously received from mappings for the FEC to one or requested more LDP
       peers;
     - Transmission of that peer.

   An LSR transmits a Release message under any label request for the FEC to the FEC next hop;

     - Any of the following condi-
   tions:

      1. The LSR which sent actions that can occur when the LSR receives a label
       mapping is no longer for the FEC from the FEC next hop.

 Context:

     - LSR. The LSR handling the event.

     - FEC. The newly recognized FEC.

     - Next Hop. The next hop for the mapped FEC, and FEC.

     - InitAttributes. Attributes to be associated with the new FEC.
       (See Note 1.)

     - SAttributes. Attributes to be included in Label Mapping or Label
       Request messages, if any, sent to peers.

     - StoredHopCount. Hop count associated with FEC label mapping , if
       any, previously received from Next Hop.

 Algorithm:

   FEC.1   Perform LSR is configured Label Distribution procedure:

             For Downstream Unsolicited Independent Control

               1.  Iterate through 5 for conservative
         operation. each Peer.

               2. The  Has LSR determines that a previously received and retained a label is no
         longer valid, as the downstream LSR map-
                   ping for FEC from which it was received
         is no longer the next Next Hop?
                   If so, set Propagating to IsPropagating.
                   If not, set Propagating to NotPropagating.

               3.  Execute procedure Prepare_Label_Mapping_Attributes
                   (Peer, FEC, InitAttributes, SAttributes, Propagating,
                   Unknown hop for the count(0)).

               4.  Execute procedure Send_Label (Peer, FEC, and SAttributes)

               5.  End iteration from 1.
                   Goto FEC.2.

             For Downstream Unsolicited Ordered Control

               1.  Iterate through 5 for each Peer.

               2.  Is LSR egress for the FEC? OR
                   Has LSR is config-
         ured previously received and retained a label map-
                   ping for conservative operation. FEC from Next Hop?
                   If not, continue iteration for next Peer.

               3. The  xecute procedure Prepare_Label_Mapping_Attributes
                   (Peer, FEC, InitAttributes, SAttributes, Propagating,
                   StoredHopCount).

               4.  Execute procedure Send_Label (Peer, FEC, SAttributes)

               5.  End iteration from 1.
                   Goto FEC.2.

             For Downstream On Demand Independent Control OR
             For Downstream On Demand Ordered Control

               1.  Goto FEC.2.  (See Note 2.)

   FEC.2   Has LSR has previously received and retained a Withdraw message label mapping for a previously
         received label.

   Note that if
           FEC from Next Hop?
           If so, goto FEC.5

   FEC.3   Is Next Hop an LDP peer?
           If not, Goto FEC.6

   FEC.4   Perform LSR is configured for "liberal mode", a release mes-
   sage will never be transmitted in the case Label Request procedure:

             For Request Never

               1.  Goto FEC.6

             For Request When Needed OR
             For Request On Request

               1.  Execute procedure Prepare_Label_Request_Attributes
                   (Next Hop, FEC, InitAttributes, SAttributes);

               2.  Execute procedure Send_Label_Request (Next Hop, FEC,
                   SAttributes).
                   Goto FEC.6.

   FEC.5   Generate Event: Received Label Mapping from Next Hop.  (See
           Note 3.)

   FEC.6   DONE.

 Notes:

      1. An example of conditions (1) and (2)
   as specified above.  In this case, the upstream LSR keeps each unused
   label, so an attribute that it can immediately might be used later if the downstream
   peer becomes the next hop for the FEC.

   The FEC in the FEC-Withdraw-Release TLV part of InitAttributes
         is a FEC for CoS. The means by which labels are
   to be released.  If no label TLV follows the FEC TLV, all labels
   associated with the FEC InitAttributes, if any, are to be released, else only the labels
         specified in the following Label TLV are to be released.

3.4.11. Label Query Message

   An LSR sends a Label Query message to an LDP peer when performing is beyond the
   loop prevention diffusion algorithm on an FEC.

   The encoding for scope of LDP. Note that the Label Query Message is:

    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 Query (0x0405)      |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     Message ID                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC TLV                                   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | InitAttri-
         butes will not include a known Hop Count or a Path Vector TLV                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Message Id
     Four octet integer used to identify this message. Vector.

      2. An LSR using Downstream On Demand label distribution would send
         a label only if it had a previously received label request
         marked as pending. The encodings LSR would have no such pending requests
         because it responds to any label request for the an unknown FEC and Path Vector TLVs can be found in Sec-
   tion "Commonly Used TLVs".

   Optional Parameters by
         sending the requesting LSR a No optional parameters are defined for Route notification and discard-
         ing the Label Query message.

3.4.11.1. Label Query Message Procecures

   See Section "Loop Prevention via Diffusion" for general procedures label request; see LRq.3

      3. If the LSR has a label for handling the Query Message.

3.4.12. Explicit Route Request Message

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |       ER Request (0x0500)     |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Message ID                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-ER TLV 1                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                                                               |
   ~                                                               ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     FEC-ER TLV n                              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   Message Id
     Four octet integer used FEC from the Next Hop, it should
         behave as if it had just received the label from the Next Hop.
         This occurs in the case of Liberal label retention mode.

A.1.6. Detect change in FEC next hop

 Summary:

     The response by an LSR to identify this message.

   FEC-ER TLV
     Each specifies a binding between an FEC and change in the next hop for a label.  A FEC-ER TLV
     is FEC may
     involve one or more of the following actions:

     - Removal of the label from the FEC's old next hop from
       forwarding/switching use;

     - Transmission of label mappping messages for the FEC to one or
       more LDP peers;

     - Transmission of a nested TLV label request to the FEC's new next hop;

     - Any of the actions that contains a FEC TLV, can occur when the LSR receives a Label TLV, an explicit-
     route identifier (ERLSPID) TLV, label
       mapping from the explict-route TLV, an optional
     COS TLF, and an optional Bandwith Reservation TLV:

      0                   1                   2                   3
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |         FEC-ER TLV  (0x0703)  |      Length                   |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     | FEC's new next hop.

 Context:

     - LSR. The LSR handling the event.

     - FEC. The FEC TLV                                    |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                    ERLSPID TLV                                |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                    Explicit Route TLV                         |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                    COS TLV (optional)                         |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                    Bandwidth Reservation TLV (optional)       |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ whose next hop changed.

     - New Next Hop. The encodings current next hop for the FEC.

     - Old Next Hop. The previous next hop for the FEC.

     - OldLabel. Label, if any, previously received from Old Next Hop.

     - CurAttributes. The attributes, if any, currently associated with
       the FEC.

     - SAttributes. Attributes to be included in Label Label Request
       message, if any, sent to New Next Hop.

 Algorithm:

    NH.1   Has LSR previously received and retained a label mapping for
           FEC from Old Next Hop?
           If not, goto NH.6.

    NH.2   Remove label from forwarding/switching use.  (See Note 1.)

    NH.3   Is LSR using Liberal label retention?
           If so, goto NH.6.

    NH.4   Execute procedure Send_Message (Old Next Hop, Label Release,
           OldLlabel).

    NH.5   Delete label mapping for FEC previously received from Old
           Next Hop.

    NH.6   Has LSR previously received and COS TLVs can be found retained a label mapping for
           FEC from New Next Hop?
           If not, goto NH.8.

    NH.7   Generate Event: Received Label Mapping from New Next Hop.
           Goto NH.11.  (See Note 2.)

    NH.8   Is LSR using Downstream on Demand advertisement? OR
           Is Next Hop using Downstream on Demand advertisement? OR
           Is LSR using Conservative label retention?  (See Note 3.)
           If so, goto NH.9. If not, goto NH.11.

    NH.9   Execute procedure Prepare_Label_Request_Attributes (Next Hop,
           FEC, CurAttributes, SAttributes)

    NH.10  Execute procedure Send_Label_Request (New Next Hop, FEC, SAt-
           tributes).
           (See Note 4.)

    NH.11  DONE.

 Notes:

      1. If Label is not in Section
     "Commonly Used TLVs".

     ERLSPID TLV
       The globally unique value that identifies forwarding/switching use, NH.2 has no
         effect.

      2. If the explicit route.
       The encoding LSR has a label for the ERLSPID is:

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         ERLSPID (0x0801)      |      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                       Explicit Identifier                     |
       +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                               |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                     Peg Explicit Identifier                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Explicit Identifier
         A 6-octet globally unique value that identifies FEC from the explicit
         route LSP.  It is generated by New Next Hop, it
         should behave as if it had just received the LSR that creates label from the Expli-
         cit Request message. New
         Next Hop.

      3. The first four octets is purpose of the LSR IP
         Address.  The last two octets contain a `Local identifier'
         value.  It is incumbent check on an LSR that originates an Explicit
         Request message label retention mode is to choose an unused value for the Local Iden-
         tifier.

       Peg Explicit Identifier
         A 6-octet globally unique value that identifies avoid a loose segment
         race with steps LMp.10-LMp.11 of an explicit route LSP.  It is generated by the upstream peg
         LSR that creates the loose segment.  The first four octets is procedure for handling a
         Label Mapping message where the LSR IP Address.  The last two octets contain a 'Local iden-
         tifier' value.  It is incumbent on operating in Conservative
         Label retention mode may have released a peg LSR that creates label mapping received
         from the New Next Hop before it detected the FEC next hop had
         changed.

      4. Regardless of the Label Request procedure in use by the LSR, it
         must send a
         loose segment to choose an unused value for label request if the Local Identif-
         ier every time conditions in NH.8 hold.
         Therefore it executes the segment is reestablished. Send_Label_Request procedure directly
         rather than perform LSR Label Request procedure.

A.1.7. Receive Notification / No Label Resources

 Summary:

     When an LSR receives a segment is
         strictly routed this field is set No Label Resources notification from an LDP
     peer, it stops sending label request messages to zero by the sender and
         ignored by the receiver.

     Explicit Route TLV
       The sequence of ER Next Hop (ERNH) TLVs and peer until it
     receives a pointer to the one
       that should be processed by Label Resources Available Notification from the peer.

 Context:

     - LSR. The LSR that receives this ER TLV. handling the event.

     - FEC. The encoding FEC for which a label was requested.

     - MsgSource. The LDP peer that sent the Explicit Route is:

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |  Explicit Route TLV  (0x0800) |      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |     Next ERNH TLV Pointer     |     Reserved        |P|Preempt|
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                 ERNH TLV  (Variable length)                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Next ERNH TLV Pointer
         This 16 bit unsigned integer points to the offset in octets Notification message.

 Algorithm:

   NoRes.1 Delete record of
         the next ERNH TLV outstanding label request for FEC sent to be processed.  The first octet after the
         two reserved octets
           MsgSource.

   NoRes.2 Record label mapping for FEC from MsgSource is needed but
           that follow this pointer no label resources are available.

   NoRes.3 Set status record indicating it is defined not OK to have send label
           requests to MsgSource.

   NoRes.4 DONE.

A.1.8. Receive Notification / No Route

 Summary:

     When an offset value of zero.  For example LSR receives a No Route notification from an ERNH TLV Pointer value
         of zero would point to the first ERNH TLV LDP peer in
     response to a Label Request message, the sequence of
         ERNH Objects.

       P bit
         when set indicates that the loosely routed segments must remain
         pinned-down.  ERLSP must be rerouted only when adjacency is
         lost along Label No Route procedure
     in use dictates its response. The LSR either will take no further
     action, or it will defer the segment.  When not set indicates loose segment
         is not pinned down label request by starting a timer and must be changed
     send another Label Request message to match the underlying
         hop-by-hop path.

       Preempt
         A 16 level preemption is provided to facilitate placement of
         ERLSP peer when resources aren't available.  Each the timer later
     expires.

 Context:

     - LSR. The LSR maintains this
         value in handling the ERLSP control block.  A higher preemption value
         can preempt LSPs event.

     - FEC. The FEC for which a label was requested.

     - Attributes. The attibutes associated with lower value.

       Reserved
         This field is reserved.  It must be set to zero on transmission
         and must be ignored on receipt.

       ERNH TLV
         This TLV contains the four octet IP address label request.

     - MsgSource. The LDP peer that sent the Notification message.

 Algorithm:

   NoNH.1  Delete record of an outstanding label request for FEC sent to
           MsgSource.

   NoNH.2  Perform LSR through
         which the Explicit Label No Route LSP is to pass procedure.

             For Request No Retry

               1.  Goto NoNH.3.

             For Request Retry

               1.  Record deferred label request for FEC and an (optional)
         reservation (RES) TLV Attributes
                   to be processed by that LSR.

         The strict TLV indicates that the ER LSP setup must be routed
         directly via the sent to MsgSource.

               2.  Start timeout. Goto NoNH.3.

   NoNH.3  DONE.

A.1.9. Receive Notification / Loop Detected

 Summary:

     When an LSR indicated receives a Loop Detected notification from an LDP peer
     in the ERNH object; i.e. that
         that response to a Label Request message, it behaves as if it had
     received a No Route notification.

     Context:

         See "Receive Notification / No Route".

     Algorithm:

         See "Receive Notification / No Route"

A.1.10. Receive Notification / Label Resources Available

 Summary:

     When an LSR must be receives a Label Resources Available notification from
     an LDP peer, it resumes sending label requests to the next hop in peer.

 Context:

     - LSR. The LSR handling the Explicit Route LSP's path. event.

     - MsgSource. The loose TLV indicates LDP peer that sent the LSP may be routed in any way;
         i.e. via other unspecified LSRs, so long as Notification message.

     - SAttributes. Attributes stored with postponed Label Request mes-
       sage.

 Algorithm:

   Res.1   Set status record indicating it (eventually)
         reaches the LSR specified in the ERNH object.  This TLV may be
         followed by the optional Reservation TLV.

         The ERNH encodings are:
          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
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |      ER Strict TLV  (0x0802)  |      Length                   |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |                             IPv4 Address                      |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

          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
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |      ER Loose TLV  (0x0803)   |      Length                   |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         |                             IPv4 Address                      |
         +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Ipv4 Address
         The IP address is OK to send label requests
           to MsgSource.

   Res.2   Iterate through Res.6 for each record of a FEC label mapping
           needed from MsgSource for which no label resources are avail-
           able.

   Res.3   Is MsgSource the next LSR in hop for FEC?
           If not, goto Res.5.

   Res.4   Execute procedure Send_Label_Request (MsgSource, FEC, SAttri-
           butes).  If the Explicit Route LSP.

     Bandwidth Reservation TLV
       Specifies procedure fails, terminate iteration.

   Res.5   Delete record that no resources are available for a label
           mapping for FEC needed from MsgSource.

   Res.6   End iteration from Res.2

   Res.7   DONE.

A.1.11. Detect local label resources have become available

 Summary:

     After an LSR has sent a No Label Resources notification to an LDP
     peer, when label resources later become available it sends a Label
     Resources Available notification to each such peer.

 Context:

     - LSR. The LSR handling the bandwidth reservation required at event.

     - Attributes. Attributes stored with postponed Label Mapping mes-
       sage.

 Algorithm:

   ResA.1  Iterate through ResA.4 for each Peer to which LSR hop.
       The encoding has previ-
           ously sent a No Label Resources notification.

   ResA.2  Execute procedure Send_Notification (Peer, Label Resources
           Available)

   ResA.3  Delete record that No Label Resources notification was previ-
           ously sent to Peer.

   ResA.4  End iteration from ResA.1

   ResA.5  Iterate through ResA.8 for each record of a label mapping
           needed for FEC for Peer but no-label-resources.  (See Note
           1.)

   ResA.6  Execute procedure Send_Label (Peer, FEC, Attributes). If the Bandwidth Reservation is:

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |      Bandwidth TLV  (0x0804)  |      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                      BW requirement                           |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     BW Requirement
       Unsigned 32 bit integer representing the bandwidth, in units
           procedure fails, terminate iteration.

   ResA.7  Clear record of
       kilo bps, that must be reserved FEC label mapping needed for peer but no-
           label-resources.

   ResA.8  End iteration from ResA.5
   ResA.9  DONE.

 Notes:

      1. Iteration ResA.5 through ResA.8 handles the LSP at every LSR identi-
       fied in situation where the ERNH Object.  The bandwidth
         LSR is guaranteed within using Downstream Unsolicited label distribution and was
         previously unable to allocate a
       coarser time period allowing label for simpler implementations.  The
       specified bandwidth is guaranteed within several milliseconds or a few seconds time period.  Nodes FEC.

A.1.12. LSR decides to no longer label switch a FEC

 Summary:

     An LSR may also use this as unilaterally decide to no longer label switch a minimal
       bandwidth guarantee within the same time period.

3.4.12.1. Explicit Route Request Procedures

   See Sections "Explicitly Routing LSPs" and "ERLSP State Machine" for
   general procedures FEC for handling the Explicit Route Request Message.

3.4.13. Explicit Route Response Message

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      ER Response (0x0501)     |      Message Length           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Message ID                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    ERLSPID TLV                                |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Label TLV                                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Status TLV                                 |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   The encodings
     an LDP peer. An LSR that does so must send a label withdraw message
     for the Label, and Status TLVs can be found in Section
   3.3.3 ("Commonly Used TLVs").

   Message Id
     Four octet integer used FEC to identify this message.

   ERLSPID TLV the peer.

 Context:

     - Peer. The globally unique value used peer.

     - FEC. The FEC.

     - PrevAdvLabel. The label for ERLSPID in FEC previously advertised to Peer.

 Algorithm:

   NoLS.1  Execute procedure Send_Label_Withdraw (Peer, FEC, PrevAdvLa-
           bel).  (See Note 1.)

   NoLS.2  DONE.

 Notes:

      1. The LSR may remove the Explicit Request
     message that elicited label from forwarding/switching use as
         part of this Response message.  The encoding for event or as part of processing the
     ERLSPID (shown above label release
         from the peer in response to the label withdraw.

A.1.13. Timeout of deferred label request

 Summary:

     Label requests are deferred in response to No Route and repeated here Loop
     Detected notifications.  When a deferred FEC label request for convenience) is:

        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
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |         ERLSPID (0x0801)      |      Length                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                       Explicit Identifier                     |
       +                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
       |                               |                               |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
       |                     Peg Explicit Identifier                   |
       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     Explicit Identifier
       A 6-octet globally unique value that identifies a
     peer times out, the explicit
       route LSP.  It is generated by LSR sends the label request.

 Context:

     - LSR. The LSR that creates handling the Explicit
       Request message. event.

     - FEC. The first four octets is FEC associated with the LSR IP Address. timeout event.

     - Peer. The last two octets contain a `Local identifier' value.  It is
       incumbent on an LSR that originates an Explicit LDP peer associated with the timeout event.

     - Attributes. Attributes stored with deferred Label Request message
       to choose an unused value mes-
       sage.

 Algorithm:

   TO.1    Retrieve the record of the deferred label request.

   TO.2    Is Peer the next hop for FEC?
           If not, goto TO.4.

   TO.3    Execute procedure Send_Label_Request (Peer, FEC).

   TO.4    DONE.

A.2. Common Label Distribution Procedures

   This section specifies utility procedures used by the Local Identifier.

     Peg Explicit Identifier
       A 6-octet globally unique value algorithms that identifies
   handle label distribution events.

A.2.1. Send_Label

 Summary:

     The Send_Label procedure allocates a loose segment
       of label for a FEC for an explicit route LSP.  It is generated by LDP
     peer, if possible, and sends a label mapping for the upstream peg
       LSR that creates FEC to the loose segment.  The first four octets is
     peer. If the LSR IP Address.  The last two octets contain a 'Local identifier'
       value.  It is incumbent on unable to allocate the label and if it has a peg LSR that creates
     pending label request from the peer, it sends the LDP peer a loose segment No
     Label Resources notification.

 Parameters:

     - Peer. The LDP peer to choose an unused value for the Local Identifier every time which the
       segment label mapping is reestablished.  When to be sent.

     - FEC. The FEC for which a segment is strictly routed this
       field label mapping is set to zero by be sent.

     - Attributes. The attributes to be included with the sender and ignored by label mapping.

 Additional Context:

     - LSR. The LSR executing the receiver.

3.4.13.1. Explicit Route Response Procedures

   See Sections "Explicitly Routing LSPs" procedure.

     - Label. The label allocated and "ERLSP State Machine" sent to Peer.

 Algorithm:

    SL.1   Does LSR have a label to allocate?
           If not, goto SL.9.

    SL.2   Allocate Label and bind it to the FEC.

    SL.3   Install Label for
   general procedures forwarding/switchng use.

    SL.4   Execute procedure Send_Message (Peer, Label Mapping, FEC,
           Label, Attributes).

    SL.5   Record label mapping for handling the Explicit Response Request Mes-
   sage.

3.5. Messages FEC with Label and TLVs for Extensibility

   The procedures Attributes has
           been sent to provide Peer.

    SL.6   Does LSR have a record of a FEC label request from Peer
           marked as pending?
           If not, goto SL.8.

    SL.7   Delete record of pending label request for LDP extensiblity include rules FEC from Peer.

    SL.8   Return success.

    SL.9   Does LSR have a label request for han-
   dling unknown messages FEC from Peer marked as
           pending?
           If not, goto SL.13.

    SL.10  Execute procedure Send_Notification (Peer, No Label
           Resources).

    SL.11  Delete record of pending label request for FEC from Peer.

    SL.12  Record No Label Resources notification has been sent to Peer.
           Goto SL.14.

    SL.13  Record label mapping needed for FEC and TLVs.  The rules described in Attributes for Peer,
           but no-label-resources. (See Note 1.)

    SL.14  Return failure.

 Notes:

      1. SL.13 handles the sections
   that follow make use case of Downstream Unsolicited label distri-
         bution when the high order bits in LSR is unable to allocate a label for a FEC to
         send to a Peer.

A.2.2. Send_Label_Request

 Summary:

     An LSR uses the message or TLV
   type field.  In these rules, "b" represents an arbitray bit value in Send_Label_Request procedure to send a message or TLV type.

3.5.1. Procedures request for Unknown Messages and TLVs

3.5.1.1. Unknown Message Types

   When
     a message with an unknown Message Type is received, there are
   two possibilities as described below.  The choice label for how a FEC to handle an unknown Message Type is determined by the high-order bit of the
   Message Type field. LDP peer if currently permitted to do so.

 Parameters:

     - Message Type = 0bbbbbbbbbbbbbbb Peer. The entire message must be rejected and LDP peer to which the event signalled by label request is to be sent.

     - FEC. The FEC for which a
       Notification Message with label request is to be sent.

     - Attributes. Attributes to be included in the Unknown Message Type Status Code. label request. E.g.,
       Hop Count, Path Vector, CoS.

 Additional Context:

     - Message Type = 1bbbbbbbbbbbbbbb LSR. The entire message must be dropped silently (i.e., LSR executing the procedure.

 Algorithm:

   SLRq.1  Has a label request for FEC previously been sent to Peer and
           is it should be
       ignored marked as outstanding?
           If so, Return success.  (See Note 1.)

   SLRq.2  Is status record indicating it is OK to send label requests
           to Peer set?
           If not, goto SLRq.6

   SLRq.3  Execute procedure Send_Message (Peer, Label Request, FEC,
           Attributes).

   SLRq.4  Record label request for FEC has been sent to Peer and mark
           it as outstanding.

   SLRq.5  Return success.

   SLRq.6  Postpone the label request by recording label mapping for FEC
           and Attributes from Peer is needed but that no error should be returned).

       In either case described above, an label
           resources are available.

   SLRq.7  Return failure.

 Notes:

      1. If the LSR that does is a non-merging LSR it must distinguish between
         attempts to send label requests for a FEC triggered by dif-
         ferent upstream LDP peers from duplicate requests. This pro-
         cedure will not understand send a duplicate label request.

A.2.3. Send_Label_Withdraw

 Summary:

     An LSR uses the message type must not attempt Send_Label_Withdraw procedure to process the message.

3.5.1.2. Unknown TLV in Known Message Type

   When an unknown TLV is found in withdraw a known Message Type, there are three
   possibilities as described below.  The choice label
     for how to handle a FEC from an
   unknown TLV is determined by the high-order two bits of the TLV Type
   field.

     - TLV Type = 0bbbbbbbbbbbbbbb

       The entire message must be rejected and LDP peer. To do this the event signalled by LSR sends a
       Notification Message with Label With-
     draw message to the Unknown TLV Status Code. peer.

 Parameters:

     - TLV Type = 10bbbbbbbbbbbbbb Peer. The TLV must be dropped silently (i.e., it should be ignored and
       no error should be returned).  If the semantics of the including
       Message Type dictate that message be forwarded LDP peer to other nodes, which the TLV must not label withdraw is to be forwarded with the message. sent.

     - TLV Type = 11bbbbbbbbbbbbbb FEC. The TLV must be silently ignored (i.e., no error should be
       returned). If the semantics of FEC for which a label is being withdrawn.

     - Label. The label being withdrawn

 Additional Context:

     - LSR. The LSR executing the including Message Type dictate
       that message be forwarded procedure.

 Algorithm:

    SWd.1  Execute procedure Send_Message (Peer, Label Withdraw, FEC,
           Label)

    SWd.2  Record label withdraw for FEC has been sent to other nodes, the TLV must be for-
       warded unmodified with the message.

3.5.2. LDP Vendor-Private Extensions

   Both Vendor-Private Messages Peer and Vendor-Private Objects are defined mark
           it as outstanding.

A.2.4. Send_Notification

 Summary:

     An LSR uses the Send_Notification procedure to convey vendor-private information or LDP extensions between LDP
   nodes. These extensions may also be useful for experimentation in
   existing networks.

3.5.2.1. send an LDP Vendor-Private TLV peer a
     notificaction message.

 Parameters:

     - Peer. The following three Vendor-Private TLV classes are defined LDP peer to which the label withdraw is to be used
   in any message:

     - Vendor Private TLV Class 1.  TLV type values:

       0x3FXX (boolean 00111111bbbbbbbb)

     - Vendor Private TLV Class 2.  TLV type values:

       0xBFXX (boolean 10111111bbbbbbbb) sent.

     - Vendor Private TLV Class 3,  TLV type values:

       0xFFXX (boolean 11111111bbbbbbbb)

   These TLVs are Status. Status code to be handled according to included in the high order bit(s) of Notification message.

 Additional Context:

     None.

 Algorithm:

   SNt.1  Execute procedure Send_Message (Peer, Notification, Status)

A.2.5. Send_Message

 Summary:

     An LSR uses the TLV type. Send_Message procedure to send an LDP peer an LDP
     message.

 Parameters:

     - Peer. The unspecified part of LDP peer to which the TLV message is to be sent.

     - Message Type. The type of message to be sent.

     - Additional message contents . . .  .

 Additional Context:

     None.

 Algorithm:

     This procedure is assigned by the vendor and should be interpreted means by a receiving which an LSR only if it
   understands sends an LDP message of
     the Vendor ID encoded specified type to the specified LDP peer.

A.2.6. Check_Received_Attributes

 Summary:

     Check the attributes received in a Label Mapping or Label Request
     message. If the TLV Value field.

   The Value field of attributes include a Vendor Private TLV Hop Count or Path Vector, per-
     form a loop detection check. If a loop is defined as follows:

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                          Vendor ID                            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           Data....                            |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

     Vendor detected, send a Loop
     Detected Notification message to MsgSource.

 Parameters:

     - MsgSource. The LDP peer that sent the message.

     - RAttributes. The attributes in the message.

 Additional Context:

     - LSR Id. The unique LSR Id
          802 Vendor ID as assigned by of this LSR.

     - Hop Count. The Hop Count, if any, in the IEEE.

     Data received attributes.

     - Path Vector. The remaining octets after Path Vector, if any in the Vendor ID received attributes.

 Algorithm:

   CRa.1   Do RAttributes include Hop Count?
           If not, goto CRa.5.

   CRa.2   Does Hop Count exceed Max allowable hop count?
           If so, goto CRa.6.

   CRa.3   Do RAttributes include Path Vector?
           If not, goto CRa.5.

   CRa.4   Does Path Vector Include LSR Id? OR
           Does length of Path Vector exceed Max allowable length?
           If so, goto CRa.6

   CRa.5   Return No Loop Detected.

   CRa.6   Execute procedure Send_Notification (MsgSource, Loop
           Detected)

   CRa.7   Return Loop Detected.

   CRa.8   DONE

A.2.7. Prepare_Label_Request_Attributes

 Summary:

     This procedure is used whenever a Label Request is to be sent to a
     Peer to compute the Hop Count and Path Vector, if any, to include
     in the Value field
          are optional vendor-dependent data.

3.5.2.2. LDP Vendor-Private Messages message.

 Parameters:

     - Peer. The LDP Vendor-Private Message peer to which the message is carried in LDP PDUs to convey
   vendor-private information or LDP extensions between LSRs. be sent.

     - FEC. The following two Vendor-Private Message classes are defined: FEC for which a label request is to be sent.

     - Vendor Private Message Class 1.  Message type values:

               0x7FXX (boolean 01111111bbbbbbbb) RAttributes. The attributes this LSR associates with the LSP for
       FEC.

     - Vendor Private Message Class 2.  Message type values:

               0xFFXX (boolean 11111111bbbbbbbb) SAttributes. The first TLV in a vendor private message must attributes to be included in the Vendor
       Private ID TLV, Label Request
       message.

 Additional Context:

     - LSR Id. The unique LSR Id of this LSR.

 Algorithm:

   PRqA.1  Is Hop Count required for this Peer (see Note 1.) ? OR
           Do RAttributes include a Vendor Private Class 3 TLV, encoded as shown
       below:

            0                   1                   2                   3
            0 1 2 3 4 5 6 7 8 9 0 Hop Count? OR
           Is Loop Detection configured on LSR?
           If not, goto PRqA.14.

   PRqA.2  Is LSR ingress for FEC?
           If not, goto PRqA.6.

   PRqA.3  Include Hop Count of 1 2 3 4 5 6 7 8 9 0 in SAttributes.

   PRqA.4  Is Loop Detection configured on LSR?
           If not, goto PRqA.14.

   PRqA.5  Is LSR merge-capable?
           If so, goto PRqA.14.
           If not, goto PRqA.13.

   PRqA.6  Do RAttributes include a Hop Count?
           If not, goto PRqA.8.

   PRqA.7  Increment RAttributes Hop Count and copy the resulting Hop
           Count to SAttributes. (See Note 2.)
           Goto PRqA.9.

   PRqA.8  Include Hop Count of unknown (0) in SAttributes.

   PRqA.9  Is Loop Detection configured on LSR?
           If not, goto PRqA.14.

   PRqA.10 Do RAttributes have a Path Vector?
           If so, goto PRqA.12.

   PRqA.11 Is LSR merge-capable?
           If so, goto PRqA.14.
           If not, goto PRqA.13.

   PRqA.12 Add LSR Id to beginning of Path Vector from RAttributes and
           copy the resulting Path Vector into SAttributes.
           Goto PRqA.14.

   PRqA.13 Include Path Vector of length 1 2 3 4 5 6 7 8 9 0 containing LSR Id in SAttri-
           butes.

   PRqA.14 DONE.

         Notes:

              1. The link with Peer may require that Hop Count be
                 included in Label Request messages; for example, see
                 [ATM].

              2. For hop count arithmetic, unknown + 1
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |      0xFF     |      0x00     |               0x04            |
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
           |                          Vendor ID                            |
           +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

       Vendor-Private messages are = unknown.

A.2.8. Prepare_Label_Mapping_Attributes

 Summary:

     This procedure is used whenever a Label Mapping is to be handled according sent to a
     Peer to compute the high
       order bit of Hop Count and Path Vector, if any, to include
     in the message type number. message.

 Parameters:

     - Peer. The determination as LDP peer to
       whether which the Vendor-Private message is understood to be sent.

     - FEC. The FEC for which a label request is based on the
       Vendor ID in first TLV in the message body.

3.6. TLV Summary to be sent.

     - RAttributes. The following are the TLVs defined in attributes this version of the protocol.

       TLV                    Type      Section Title

       FEC                      0x0100    "FEC TLV"
       Address List             0x0101    "Address List TLV"
       COS                      0x0102    "COS TLV"
       Hop Count                0x0103    "Hop Count TLV"
       Path Vector              0x0104    "Path Vector TLV"
       Generic Label            0x0200    "Generic Label TLV"
       ATM Label                0x0201    "ATM Label TLV"
       Frame Relay Label        0x0202    "Frame Relay Label TLV"
       Status                   0x0300    "Status TLV"
       Extended Status          0x0301    "Notification Message"
       Targeted Hello           0x0400    "Hello Message"
       Send Targeted Hello      0x0401    "Hello Message"
       Transport Address        0x0402    "Hello Message"
       Hello Hold Time          0x0403    "Hello Message"
       Common Session           0x0500    "Initialization Message"
          Parameters
       Label Allocation         0x0501    "Initialization Message"
          Discipline
       Loop Detection           0x0502    "Initialization Message"
       Merge                    0x0503    "Initialization Message"
       ATM Null Encapsulation   0x0504    "Initialization Message"
       ATM LSR associates with the LSP for
       FEC.

     - SAttributes. The attributes to be included in the Label Range          0x0600    "Initialization Message"
       Frame Relay Request
       message.

     - IsPropagating. The LSR is sending the Label Range  0x0601    "Initialization Message"
       FEC-Label Mapping        0x0700    "Label Mapping Message"
       FEC-Request              0x0701    "Label Request Message"
       FEC-Withdraw-Release     0x0702    "Label Withdraw Message"
       FEC-ER TLV               0x0703    "Explicit Request Message"
       Explicit Route           0x0800    "Explicit Request Message"
       ERLSPID                  0x0801    "Explicit Request Message"
       ER Strict                0x0802    "Explicit Request Message"
       ER Loose                 0x0803    "Explicit Request Message"
       Bandwidth                0x0804    "Explicit Request Message"

3.7. Status Code Summary message to
       propagate one received from the FEC next hop.

     - PrevHopCount. The following are Hop Count, if any, this LSR associates with the Status Codes defined in
       LSP for the FEC.

 Additional Context:

     - LSR Id. The unique LSR Id of this version LSR.

 Algorithm:

   PMpA.1  Is Hop Count required for this Peer (see Note 1.) ? OR
           Do RAttributes include a Hop Count? OR
           Is Loop Detection configured on LSR?
           If not, goto PMpA.19.

   PMpA.2  Is LSR egress for FEC?
           If not, goto PMpA.4.

   PMpA.3  Include Hop Count of 1 in SAttributes. Goto PMpA.19.

   PMpA.4  Do RAttributes have a Hop Count?
           If not, goto PMpA.6.

   PMpA.5  Increment RAttributes Hop Count and copy the
   protocol.

       Status Code                   Type      Section Title

       Success                       0x0000    "Status TLV"
       Bad LDP Identifer             0x8001    "Events Signalled by ..."
       Bad Protocol Version          0x8002    "Events Signalled by ..."
       Bad PDU Length                0x8003    "Events Signalled by ..."
       Unknown Message Type          0x8004    "Events Signalled by ..."
       Bad Message Length            0x8005    "Events Signalled by ..."
       Unknown TLV                   0x8006    "Events Signalled by ..."
       Bad TLV length                0x8007    "Events Signalled by ..."
       Malformed TLV Value           0x8008    "Events Signalled by ..."
       Hold Timer Expired            0x8009    "Events Signalled by ..."
       Shutdown                      0x000A    "Events Signalled by ..." resulting Hop
           Count to SAttributes. See Note 2. Goto PMpA.7.

   PMpA.6  Include Hop Count of unknown (0) in SAttributes.

   PMpA.7  Is Loop Detected                 0x000B    "Loop Detection Via Diffusion"

4. Security

   Security considerations will be addressed configured on LSR?
           If not, goto PMpA.19.

   PMpA.8  Do RAttributes have a Path Vector?
           If so, goto PMpA.17.

   PMpA.9  Is LSR propagating a received Label Mapping?
           If not, goto PMpA.18.

   PMpA.10 Does LSR support merging?
           If not, goto PMpA.12.

   PMpA.11 Has LSR previously sent a Label Mapping for FEC to Peer?
           If not, goto PMpA.18.

   PMpA.12 Do RAttributes include a Hop Count?
           If not, goto PMpA.19.

   Res.13 Is Hop Count in Rattributes unknown(0)?
           If so, goto PMpA.18.

   PMpA.14 Has LSR previously sent a future revision of
   this document.

5. Acknowledgments

   The ideas and text Label Mapping for FEC to Peer?
           If not goto PMpA.19.

   PMpA.15 Is Hop Count in this document have been collected RAttributes different from a number
   of sources. We would like PrevHopCount ?
           If not goto PMpA.19.

   PMpA.16 Is the Hop Count in RAttributes > PrevHopCount? OR
           Is PrevHopCount unknown(0)
           If not, goto PMpA.19.

   PMpA.17 Add LSR Id to thank Rick Boivie, Ross Callon, Alex
   Conta, Eric Rosen, Bernard Suter, Yakov Rekhter, beginning of Path Vector from RAttributes and Arun
   Viswanathan.

6. References

   [FRAMEWORK] Callon et al, "A Framework for Multiprotocol Label
   Switching" draft-ietf-mpls-framework-01.txt, July 1997

   [ARCH] Rosen et al, "A Proposed Architecture for MPLS" draft-ietf-
   mpls-arch-02.txt, July 1998

   [ENCAP] Farinacci et al, "MPLS Label Stack Encoding" draft-ietf-
   mpls-label-encaps-02.txt, July, 1998

   [FR] Conta et al, "Use
           copy the resulting Path Vector into SAttributes. Goto
           PMpA.19.

   PMpA.18 Include Path Vector of length 1 containing LSR Id in SAttri-
           butes.

   PMpA.19 DONE.

 Notes:

      1. The link with Peer may require that Hop Count be included in
         Label Switching on Frame Relay Networks"
   draft-ietf-mpls-fr-01.txt, August, 1998

   [rfc1583] J. Moy, "OSPF Version 2", RFC 1583, Proteon Inc, March 1994

   [rfc1771] Y. Rekhter, T. Li, "A Border Gateway Protocol 4 (BGP-4)",
   RFC 1771, IBM Corp, Cisco Systems, March 1995

   [rfc1483] J. Heinanen, "Multiprotocol Encapsulation over ATM Adapta-
   tion Layer 5", RFC 1483, Telecom Finland, July 1993

7. Author Information

   Loa Andersson
   Bay Networks Inc
   3 Federal Street
   Billerica, MA  01821
   email: Loa_Andersson@baynetworks.com

   Paul Doolan
   Ennovate Networks
   330 Codman Hill Rd
   Marlborough MA 01719
   Phone: 978-263-2002
   email: pdoolan@ennovatenetworks.com

   Nancy Feldman
   IBM Corp.
   17 Skyline Drive
   Hawthorne NY 10532
   Phone:  914-784-3254
   email: nkf@us.ibm.com

   Andre Fredette
   Bay Networks Inc
   3 Federal Street
   Billerica, MA  01821
   Phone:  978-916-8524
   email: fredette@baynetworks.com

   Bob Thomas
   Cisco Systems, Inc.
   250 Apollo Dr.
   Chelmsford, MA 01824
   Phone:  978-244-8078
   email: rhthomas@cisco.com Mapping messages; for example, see [ATM].

      2. For hop count arithmetic, unknown + 1 = unknown.