bgpd: No nexthop tracking for EVPN-imported leaked routes

IPv4 or IPv6 unicast routes which are imported from EVPN routes
(type-2 or type-5) and installed in a BGP instance and then leaked
do not need any nexthop tracking, as any tracking should happen in
the source instance.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
vivek 2019-02-28 11:11:01 +00:00
parent 12d6100c52
commit 0a2f9ac170
3 changed files with 35 additions and 3 deletions

View File

@ -101,6 +101,12 @@ static inline int is_route_parent_evpn(struct bgp_path_info *ri)
return 0;
}
/* Flag if the route path's family is EVPN. */
static inline bool is_pi_family_evpn(struct bgp_path_info *pi)
{
return is_pi_family_matching(pi, AFI_L2VPN, SAFI_EVPN);
}
extern void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf,
struct prefix *p,
struct attr *src_attr, afi_t afi,

View File

@ -46,6 +46,7 @@
#include "bgpd/bgp_zebra.h"
#include "bgpd/bgp_nexthop.h"
#include "bgpd/bgp_nht.h"
#include "bgpd/bgp_evpn.h"
#if ENABLE_BGP_VNC
#include "bgpd/rfapi/rfapi_backend.h"
@ -552,8 +553,12 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
if (bpi->extra && bpi->extra->bgp_orig)
bgp_nexthop = bpi->extra->bgp_orig;
/* No nexthop tracking for redistributed routes */
if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
/*
* No nexthop tracking for redistributed routes or for
* EVPN-imported routes that get leaked.
*/
if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE ||
is_pi_family_evpn(bpi_ultimate))
nh_valid = 1;
else
/*
@ -614,8 +619,11 @@ leak_update(struct bgp *bgp, /* destination bgp instance */
* No nexthop tracking for redistributed routes because
* their originating protocols will do the tracking and
* withdraw those routes if the nexthops become unreachable
* This also holds good for EVPN-imported routes that get
* leaked.
*/
if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE)
if (bpi_ultimate->sub_type == BGP_ROUTE_REDISTRIBUTE ||
is_pi_family_evpn(bpi_ultimate))
nh_valid = 1;
else
/*

View File

@ -341,6 +341,24 @@ static inline int bgp_fibupd_safi(safi_t safi)
return 0;
}
/* Flag if the route path's family matches params. */
static inline bool is_pi_family_matching(struct bgp_path_info *pi,
afi_t afi, safi_t safi)
{
struct bgp_table *table;
struct bgp_node *rn;
rn = pi->net;
if (!rn)
return false;
table = bgp_node_table(rn);
if (table &&
table->afi == afi &&
table->safi == safi)
return true;
return false;
}
/* Prototypes. */
extern void bgp_rib_remove(struct bgp_node *rn, struct bgp_path_info *pi,
struct peer *peer, afi_t afi, safi_t safi);