From d2d71b042edc628cb6edae0b25d0a49aa9ad2050 Mon Sep 17 00:00:00 2001 From: vivek Date: Fri, 18 Dec 2020 10:55:40 -0800 Subject: [PATCH] bgpd: Prevent multipathing among EVPN and non-EVPN paths Ensure that a multipath set is fully comprised of EVPN paths (i.e., paths imported into the VRF from EVPN address-family) or non-EVPN paths. This is actually a condition that existed already in the code but was not properly enforced. This change, as a side effect, eliminates the known trigger condition for bad or missing RMAC programming in an EVPN deployment, described in tickets CM-29043 and CM-31222. Routes (actually, paths) in a VRF routing table that require VXLAN tunneling to the next hop currently need some special handling in zebra to deal with the nexthop (neigh) and RMAC programming, and this is implemented for the entire route (prefix), not per-path. This can lead to the bad or missing RMAC situation, which is now eliminated by ensuring all paths in the route are 'similar'. The longer-term solution in CL 5.x will be to deal with the special programming by means of explicit communication between bgpd and zebra. This is already implemented for EVPN-MH via CM-31398. These changes will be extended to non-MH also and the special code in zebra removed or refined. Signed-off-by: Vivek Venkatraman Acked-by: Trey Aspelund Acked-by: Anuradha Karuppiah Acked-by: Chirag Shah Ticket: CM-29043 Testing Done: 1. Manual testing 2. precommit on both MLX and BCM platforms 3. evpn-smoke - BCM and VX Results described in the ticket --- bgpd/bgp_route.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 6def66c023..801ea1a2a1 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -1213,9 +1213,18 @@ static int bgp_path_info_cmp(struct bgp *bgp, struct bgp_path_info *new, /* If one path has a label but the other does not, do not treat * them as equals for multipath */ - if ((new->extra &&bgp_is_valid_label(&new->extra->label[0])) - != (exist->extra - && bgp_is_valid_label(&exist->extra->label[0]))) { + int newl, existl; + + newl = existl = 0; + + if (new->extra) + newl = new->extra->num_labels; + if (exist->extra) + existl = exist->extra->num_labels; + if (((new->extra &&bgp_is_valid_label(&new->extra->label[0])) != + (exist->extra && + bgp_is_valid_label(&exist->extra->label[0]))) || + (newl != existl)) { if (debug) zlog_debug( "%s: %s and %s cannot be multipath, one has a label while the other does not", -- 2.39.5