Skip to content

Commit

Permalink
bgpd: fix import of evpn routes into vni/vrf/esi after nexthop update
Browse files Browse the repository at this point in the history
Related to issue #10271

After an update of the BGP nexthop (e.g. update of the igp metric), the
EVPN routes are not updated in VNIs, VRFs and ESIs.

Fix the issue.

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Feb 9, 2022
1 parent c748ab2 commit 74309be
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
7 changes: 5 additions & 2 deletions bgpd/bgp_evpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2496,8 +2496,11 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
pi = bgp_create_evpn_bgp_path_info(parent_pi, dest, &attr);
new_pi = true;
} else {
if (attrhash_cmp(pi->attr, &attr)
&& !CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
if (attrhash_cmp(pi->attr, &attr) &&
((pi->extra && parent_pi->extra &&
pi->extra->igpmetric == parent_pi->extra->igpmetric) ||
(!pi->extra && !parent_pi->extra)) &&
!CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)) {
bgp_dest_unlock_node(dest);
return 0;
}
Expand Down
30 changes: 16 additions & 14 deletions bgpd/bgp_nht.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,31 +1079,33 @@ void evaluate_paths(struct bgp_nexthop_cache *bnc)
path_valid = CHECK_FLAG(path->flags, BGP_PATH_VALID);
if (path_valid != bnc_is_valid_nexthop) {
if (path_valid) {
/* No longer valid, clear flag; also for EVPN
* routes, unimport from VRFs if needed.
*/
/* No longer valid, clear flag */
bgp_aggregate_decrement(bgp_path, p, path, afi,
safi);
bgp_path_info_unset_flag(dest, path,
BGP_PATH_VALID);
if (safi == SAFI_EVPN &&
bgp_evpn_is_prefix_nht_supported(bgp_dest_get_prefix(dest)))
bgp_evpn_unimport_route(bgp_path,
afi, safi, bgp_dest_get_prefix(dest), path);
} else {
/* Path becomes valid, set flag; also for EVPN
* routes, import from VRFs if needed.
*/
/* Path becomes valid, set flag */
bgp_path_info_set_flag(dest, path,
BGP_PATH_VALID);
bgp_aggregate_increment(bgp_path, p, path, afi,
safi);
if (safi == SAFI_EVPN &&
bgp_evpn_is_prefix_nht_supported(bgp_dest_get_prefix(dest)))
bgp_evpn_import_route(bgp_path,
afi, safi, bgp_dest_get_prefix(dest), path);
}
}
if ((path_valid != bnc_is_valid_nexthop ||
CHECK_FLAG(path->flags, BGP_PATH_IGP_CHANGED)) &&
safi == SAFI_EVPN &&
bgp_evpn_is_prefix_nht_supported(
bgp_dest_get_prefix(dest))) {
if (bnc_is_valid_nexthop)
bgp_evpn_import_route(bgp_path, afi, safi,
bgp_dest_get_prefix(dest),
path);
else
bgp_evpn_unimport_route(
bgp_path, afi, safi,
bgp_dest_get_prefix(dest), path);
}

bgp_process(bgp_path, dest, afi, safi);
}
Expand Down

0 comments on commit 74309be

Please sign in to comment.