From e9cf8c8ece32891304b2e7419763d4f6d68248bf Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 5 Sep 2016 15:54:49 +0200 Subject: [PATCH] bgpd: evpn RT-5 bgp update carries nexthop attribute This patch appends nexthop attribute to EVPN message, in addition to appending gateway IP in RT-5 NLRI itself. In reception, if both informations are stored, then the GW IP information will supersede the NLRI nexthop attribute. Signed-off-by: Philippe Guibert --- bgpd/bgp_attr.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index a0e8d5499b..cc2e23ec04 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2812,6 +2812,39 @@ bgp_packet_mpattr_start (struct stream *s, afi_t afi, safi_t safi, afi_t nh_afi, break; } break; + case AFI_L2VPN: + switch (safi) + { + case SAFI_EVPN: + if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV4) + { + stream_putc (s, 12); + stream_putl (s, 0); /* RD = 0, per RFC */ + stream_putl (s, 0); + stream_put (s, &attr->extra->mp_nexthop_global_in, 4); + } + else if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) + { + stream_putc (s, 24); + stream_putl (s, 0); /* RD = 0, per RFC */ + stream_putl (s, 0); + stream_put (s, &attr->extra->mp_nexthop_global, IPV6_MAX_BYTELEN); + } + else if (attr->extra->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) + { + stream_putc (s, 48); + stream_putl (s, 0); /* RD = 0, per RFC */ + stream_putl (s, 0); + stream_put (s, &attr->extra->mp_nexthop_global, IPV6_MAX_BYTELEN); + stream_putl (s, 0); /* RD = 0, per RFC */ + stream_putl (s, 0); + stream_put (s, &attr->extra->mp_nexthop_local, IPV6_MAX_BYTELEN); + } + break; + break; + default: + break; + } default: break; }