diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-03-26 10:30:52 +0200 | 
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2025-03-26 10:30:52 +0200 | 
| commit | 94e2aadf7187d7d695babce21033b5bc8e454f25 (patch) | |
| tree | baccbc3a03340973b32b091531a460adcd84b3bc /bgpd | |
| parent | 42b9d985ccced6ee4ccc70b139c78cd47867b2ba (diff) | |
bgpd: Set the label for MP_UNREACH_NLRI 0x800000 instead of 0x000000
RFC8277 says:
The procedures in [RFC3107] for withdrawing the binding of a label
or sequence of labels to a prefix are not specified clearly and correctly.
=> How to Explicitly Withdraw the Binding of a Label to a Prefix
Suppose a BGP speaker has announced, on a given BGP session, the
   binding of a given label or sequence of labels to a given prefix.
   Suppose it now wishes to withdraw that binding.  To do so, it may
   send a BGP UPDATE message with an MP_UNREACH_NLRI attribute.  The
   NLRI field of this attribute is encoded 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
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |    Length     |        Compatibility                          |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
     |                          Prefix                               ~
     ~                                                               |
     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                       Figure 4: NLRI for Withdrawal
   Upon transmission, the Compatibility field SHOULD be set to 0x800000.
   Upon reception, the value of the Compatibility field MUST be ignored.
[RFC3107] also made it possible to withdraw a binding without
   specifying the label explicitly, by setting the Compatibility field
   to 0x800000.  However, some implementations set it to 0x000000.  In
   order to ensure backwards compatibility, it is RECOMMENDED by this
   document that the Compatibility field be set to 0x800000, but it is
   REQUIRED that it be ignored upon reception.
In FRR case where a single label is used per-prefix, we should send 0x800000,
and not 0x000000.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd')
| -rw-r--r-- | bgpd/bgp_attr.c | 8 | 
1 files changed, 7 insertions, 1 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index f280add12a..9f8f1f6c69 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -5028,7 +5028,13 @@ void bgp_packet_mpunreach_prefix(struct stream *s, const struct prefix *p,  {  	uint8_t wlabel[4] = {0x80, 0x00, 0x00}; -	if (safi == SAFI_LABELED_UNICAST) { +	/* [RFC3107] also made it possible to withdraw a binding without +	 * specifying the label explicitly, by setting the Compatibility field +	 * to 0x800000. However, some implementations set it to 0x000000. In +	 * order to ensure backwards compatibility, it is RECOMMENDED by this +	 * document that the Compatibility field be set to 0x800000. +	 */ +	if (safi == SAFI_LABELED_UNICAST || safi == SAFI_MPLS_VPN) {  		label = (mpls_label_t *)wlabel;  		num_labels = 1;  	}  | 
