When an LSR receives a BGP labeled route by way of IBGP for a specific /32 prefix, the following procedures are performed.
BGP resolves and installs the route in BGP if:
An LDP LSP to the BGP neighbor exists, for example, the ABR or ASBR, which advertised it and which is the next-hop of the BGP labeled route.
When the BGP route is installed, BGP programs the following:
Push NHLFE in the egress data path to forward packets to this BGP labeled route.
The CPM tunnel table with a tunnel entry for the NHLFE.
When LDP learns the BGP labeled route from the CPM tunnel table and the prefix exists in the new LDP tunnel table route export policy, it does the following:
Advertise a new LDP FEC-label binding for the same prefix to its LDP neighbors according the global and per-peer LDP export prefix policies. If LDP already advertised a FEC for the same /32 prefix after receiving it from an LDP neighbor then no action is required. For LDP neighbors that negotiated LDP Downstream on Demand (DoD), the FEC is advertised only when this node receives a Label Request message for this FEC from its neighbor.
Install the ILM entry pointing to the BGP NHLFE if a new LDP FEC-label binding is advertised. If an ILM entry exists and points to an LDP NHLFE for the same prefix then no update to the ILM entry is performed. The LDP route is always preferred over the BGP labeled route.
The prefer-protocol-stitching command (in the LDP context) has no effect on LDP-to-BGP stitching except for one specific case. Typically BGP does not add a TTM entry if the BGP-LU route is not the most preferred route in RTM. Because a BGP-LU route cannot be used for LDP FEC resolution, there are no two TTM entries to choose from, so the command has no effect. However, it is possible to program BGP-LU tunnels for prefixes available in the IGP by blocking those prefixes from the label-ipv4 RIB in the rib-management>label-ipv4>import-route-table context. In this context, the prefer-protocol-stitching command has an effect and prefers stitching to BGP over to LDP. Be aware that the BGP label-preference command, if set to a lower value than the IGP preference in the route table, overrides the IGP preference.