summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvivek <vivek@cumulusnetworks.com>2018-01-19 09:29:49 -0800
committermitesh <mitesh@cumulusnetworks.com>2018-02-08 23:02:05 -0800
commit25f2ca5307e4c7ad5a65cbf4639ee4d13a906cb4 (patch)
treeeed39af0376368dd22e6d73ac001b40b771194d9
parent509d742fb39d8ca7182cfe8edc0e9857faca2918 (diff)
bgpd: Ensure EVPN routes are not injected back into EVPN
EVPN type-2 and type-5 routes received with a L3 VNI and corresponding RTs are installed into the appropriate BGP RIB. Ensure that these routes are not re-injected back into EVPN as type-5 routes when type-5 advertisement is enabled; only regular IPv4 routes (and IPv6 routes in future) in the RIB should be injected into EVPN. As a benefit of this change, no longer restrict that EVPN type-5 routes should be non-host routes - i.e., allow /32 IPv4 routes (and /128 IPv6 routes in future). Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com> Ticket: CM-19456 Reviewed By: CCR-7117 Testing Done: 1. Manual replication of problem and verification of fix 2. evpn-min
-rw-r--r--bgpd/bgp_evpn.c25
-rw-r--r--bgpd/bgp_route.c6
2 files changed, 20 insertions, 11 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index c7d5f8d111..a69c3465e3 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -3210,15 +3210,25 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf,
{
struct bgp_table *table = NULL;
struct bgp_node *rn = NULL;
+ struct bgp_info *ri;
/* Bail out early if we don't have to advertise type-5 routes. */
if (!advertise_type5_routes(bgp_vrf, afi))
return;
table = bgp_vrf->rib[afi][safi];
- for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
- bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p, afi, safi);
-
+ for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
+ /* Only care about "selected" routes - non-imported. */
+ /* TODO: Support for AddPath for EVPN. */
+ for (ri = rn->info; ri; ri = ri->next) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
+ (!ri->extra || !ri->extra->parent)) {
+ bgp_evpn_withdraw_type5_route(bgp_vrf, &rn->p,
+ afi, safi);
+ break;
+ }
+ }
+ }
}
/*
@@ -3239,10 +3249,6 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p,
if (!advertise_type5_routes(bgp_vrf, afi))
return;
- /* only advertise subnet routes as type-5 */
- if (is_host_route(p))
- return;
-
build_type5_prefix_from_ip_prefix(&evp, p);
ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr);
if (ret)
@@ -3270,11 +3276,12 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf,
table = bgp_vrf->rib[afi][safi];
for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) {
/* Need to identify the "selected" route entry to use its
- * attribute.
+ * attribute. Also, we only consider "non-imported" routes.
* TODO: Support for AddPath for EVPN.
*/
for (ri = rn->info; ri; ri = ri->next) {
- if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED)) {
+ if (CHECK_FLAG(ri->flags, BGP_INFO_SELECTED) &&
+ (!ri->extra || !ri->extra->parent)) {
bgp_evpn_advertise_type5_route(bgp_vrf, &rn->p,
ri->attr,
afi, safi);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 36e0c92482..fe2c5d11a1 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2225,11 +2225,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn,
/* advertise/withdraw type-5 routes */
if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) {
- if (new_select)
+ if (new_select &&
+ (!new_select->extra || !new_select->extra->parent))
bgp_evpn_advertise_type5_route(bgp, &rn->p,
new_select->attr,
afi, safi);
- else if (old_select)
+ else if (old_select &&
+ (!old_select->extra || !old_select->extra->parent))
bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi);
}