Skip to content

Commit

Permalink
bgpd: only import specific route-types into EVIs
Browse files Browse the repository at this point in the history
Prior to this we were only filtering EVPN routes from the import logic
if they were not route-type 1/2/3/5, which allowed things like RT-5s to
be imported into an L2VNI/MAC-VRF. This adds additional logic to ensure
routes are only imported into EVIs where they make sense.
No more nonsensical route importing!

Ticket: 2848204
Signed-off-by: Trey Aspelund <[email protected]>
  • Loading branch information
Trey Aspelund authored and donaldsharp committed Dec 7, 2024
1 parent 923718a commit d2c32ff
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -4137,9 +4137,7 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi,

assert(attr);

/* Only type-1, type-2, type-3, type-4 and type-5
* are supported currently
*/
/* Only EVPN route-types 1-5 are supported currently */
if (!(evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE
|| evp->prefix.route_type == BGP_EVPN_IMET_ROUTE
|| evp->prefix.route_type == BGP_EVPN_ES_ROUTE
Expand Down Expand Up @@ -4196,26 +4194,34 @@ static int bgp_evpn_install_uninstall_table(struct bgp *bgp, afi_t afi,
bgp_evpn_attr_get_esi(pi->attr));

/*
* macip routes (type-2) are imported into VNI and VRF tables.
* IMET route is imported into VNI table.
* prefix routes are imported into VRF table.
* AD/IMET routes (type-1/3) are imported into VNI table.
* MACIP routes (type-2) are imported into VNI and VRF tables.
* Prefix routes (type 5) are imported into VRF table.
*/
if (evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE ||
evp->prefix.route_type == BGP_EVPN_IMET_ROUTE ||
evp->prefix.route_type == BGP_EVPN_AD_ROUTE ||
evp->prefix.route_type == BGP_EVPN_IP_PREFIX_ROUTE) {

irt = in_vni_rt ? lookup_import_rt(bgp, eval) : NULL;
if (irt)
install_uninstall_route_in_vnis(
bgp, afi, safi, evp, pi, irt->vnis,
import);
if (evp->prefix.route_type
!= BGP_EVPN_IP_PREFIX_ROUTE) {
irt = in_vni_rt ? lookup_import_rt(bgp, eval)
: NULL;
if (irt)
install_uninstall_route_in_vnis(
bgp, afi, safi, evp, pi,
irt->vnis, import);
}

vrf_irt = in_vrf_rt ? lookup_vrf_import_rt(eval) : NULL;
if (vrf_irt)
install_uninstall_route_in_vrfs(
bgp, afi, safi, evp, pi, vrf_irt->vrfs,
import);
if (evp->prefix.route_type != BGP_EVPN_AD_ROUTE &&
evp->prefix.route_type != BGP_EVPN_IMET_ROUTE) {
vrf_irt = in_vrf_rt ? lookup_vrf_import_rt(eval)
: NULL;
if (vrf_irt)
install_uninstall_route_in_vrfs(
bgp, afi, safi, evp, pi,
vrf_irt->vrfs, import);
}

/* Also check for non-exact match.
* In this, we mask out the AS and
Expand Down

0 comments on commit d2c32ff

Please sign in to comment.