Merge pull request #15727 from donaldsharp/evpn_zebra_interactions

Evpn zebra interactions
This commit is contained in:
Donatas Abraitis 2024-04-13 22:19:10 +03:00 committed by GitHub
commit 88c55b8e6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3862,7 +3862,7 @@ int bgp_evpn_route_entry_install_if_vrf_match(struct bgp *bgp_vrf,
* Install or uninstall mac-ip routes are appropriate for this * Install or uninstall mac-ip routes are appropriate for this
* particular VRF. * particular VRF.
*/ */
static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install) static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, bool install)
{ {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -3926,9 +3926,7 @@ static int install_uninstall_routes_for_vrf(struct bgp *bgp_vrf, int install)
* particular VNI. * particular VNI.
*/ */
static int install_uninstall_routes_for_vni(struct bgp *bgp, static int install_uninstall_routes_for_vni(struct bgp *bgp,
struct bgpevpn *vpn, struct bgpevpn *vpn, bool install)
bgp_evpn_route_type rtype,
int install)
{ {
afi_t afi; afi_t afi;
safi_t safi; safi_t safi;
@ -3959,7 +3957,9 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
(const struct prefix_evpn *)bgp_dest_get_prefix( (const struct prefix_evpn *)bgp_dest_get_prefix(
dest); dest);
if (evp->prefix.route_type != rtype) if (evp->prefix.route_type != BGP_EVPN_IMET_ROUTE &&
evp->prefix.route_type != BGP_EVPN_AD_ROUTE &&
evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE)
continue; continue;
for (pi = bgp_dest_get_bgp_path_info(dest); pi; for (pi = bgp_dest_get_bgp_path_info(dest); pi;
@ -3986,13 +3986,13 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
bgp, vpn, evp, pi); bgp, vpn, evp, pi);
if (ret) { if (ret) {
flog_err( flog_err(EC_BGP_EVPN_FAIL,
EC_BGP_EVPN_FAIL,
"%u: Failed to %s EVPN %s route in VNI %u", "%u: Failed to %s EVPN %s route in VNI %u",
bgp->vrf_id, bgp->vrf_id,
install ? "install" install ? "install"
: "uninstall", : "uninstall",
rtype == BGP_EVPN_MAC_IP_ROUTE evp->prefix.route_type ==
BGP_EVPN_MAC_IP_ROUTE
? "MACIP" ? "MACIP"
: "IMET", : "IMET",
vpn->vni); vpn->vni);
@ -4013,7 +4013,7 @@ static int install_uninstall_routes_for_vni(struct bgp *bgp,
*/ */
static int install_routes_for_vrf(struct bgp *bgp_vrf) static int install_routes_for_vrf(struct bgp *bgp_vrf)
{ {
install_uninstall_routes_for_vrf(bgp_vrf, 1); install_uninstall_routes_for_vrf(bgp_vrf, true);
return 0; return 0;
} }
@ -4024,29 +4024,17 @@ static int install_routes_for_vrf(struct bgp *bgp_vrf)
*/ */
static int install_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn) static int install_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
{ {
int ret; /*
* Install type-3 routes followed by type-2 routes - the ones applicable
/* Install type-3 routes followed by type-2 routes - the ones applicable
* for this VNI. * for this VNI.
*/ */
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_IMET_ROUTE, return install_uninstall_routes_for_vni(bgp, vpn, true);
1);
if (ret)
return ret;
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_AD_ROUTE,
1);
if (ret)
return ret;
return install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_MAC_IP_ROUTE,
1);
} }
/* uninstall routes from l3vni vrf. */ /* uninstall routes from l3vni vrf. */
static int uninstall_routes_for_vrf(struct bgp *bgp_vrf) static int uninstall_routes_for_vrf(struct bgp *bgp_vrf)
{ {
install_uninstall_routes_for_vrf(bgp_vrf, 0); install_uninstall_routes_for_vrf(bgp_vrf, false);
return 0; return 0;
} }
@ -4056,25 +4044,11 @@ static int uninstall_routes_for_vrf(struct bgp *bgp_vrf)
*/ */
static int uninstall_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn) static int uninstall_routes_for_vni(struct bgp *bgp, struct bgpevpn *vpn)
{ {
int ret; /*
* Uninstall type-2 routes followed by type-3 routes - the ones
/* Uninstall type-2 routes followed by type-3 routes - the ones * applicable for this VNI.
* applicable
* for this VNI.
*/ */
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_MAC_IP_ROUTE, return install_uninstall_routes_for_vni(bgp, vpn, false);
0);
if (ret)
return ret;
ret = install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_AD_ROUTE,
0);
if (ret)
return ret;
return install_uninstall_routes_for_vni(bgp, vpn, BGP_EVPN_IMET_ROUTE,
0);
} }
/* /*