MP_UNREACH_NLRI RFC8277 compatibility
Hi! According to RFC 8277, NLRI for withdrawal contains 3 fields: Length, Compatibility and Prefix. "Upon transmission, the Compatibility field SHOULD be set to 0x800000.Upon reception, the value of the Compatibility field MUST be ignored." Right now, BIRD 2.0.2 checks Compatibility field for value 0x800000, and this is not compatible with RFC, and at least Juniper MX do not set this field to 0x800000, and BGP session between BIRD and Juniper resets with Malformed Attribute List. Attached patch fixes this behavior. diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 190fd6f..5dcb00d 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -1165,8 +1165,11 @@ bgp_decode_mpls_labels(struct bgp_parse_state *s, byte **pos, uint *len, uint *p ADVANCE(*pos, *len, 3); *pxlen -= 24; - /* Withdraw: Magic label stack value 0x800000 according to RFC 3107, section 3, last paragraph */ - if (!a && !s->err_withdraw && (lnum == 1) && (label == BGP_MPLS_MAGIC)) + /* + * Withdraw: According to RFC 3107, section 2.4, second paragraph + * Upon reception, the value of the Compatibility field MUST be ignored. + */ + if (!a && !s->err_withdraw && (lnum == 1) && (s->mp_unreach_len)) break; } while (!(label & BGP_MPLS_BOS));
On Fri, Jun 29, 2018 at 04:26:46PM +0300, Vadim Fedorenko wrote:
Hi! According to RFC 8277, NLRI for withdrawal contains 3 fields: Length, Compatibility and Prefix. "Upon transmission, the Compatibility field SHOULD be set to 0x800000.Upon reception, the value of the Compatibility field MUST be ignored." Right now, BIRD 2.0.2 checks Compatibility field for value 0x800000, and this is not compatible with RFC, and at least Juniper MX do not set this field to 0x800000, and BGP session between BIRD and Juniper resets with Malformed Attribute List. Attached patch fixes this behavior.
Hi Thanks, will merge that. The current code is based on RFC 3107, which was vague in many ways, and we did not yet reviewed it w.r.t RFC 8277. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Ondrej Zajicek -
Vadim Fedorenko